Version 0.7.6.4 .
svn merge -c 28079 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 28107 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@28108 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 285f385..dff2717 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -504,13 +504,9 @@
void ClassFinalizer::FinalizeTypeParameters(const Class& cls) {
if (cls.IsMixinApplication()) {
- // Copy the type parameters to the mixin application.
+ // Setup the type parameters of the mixin application and finalize the
+ // mixin type.
ApplyMixinType(cls);
- // Finalize the mixin type.
- Type& mixin_type = Type::Handle(cls.mixin());
- mixin_type ^= FinalizeType(cls, mixin_type, kCanonicalizeWellFormed);
- // TODO(regis): Check for a malbounded mixin_type.
- cls.set_mixin(mixin_type);
}
// The type parameter bounds are not finalized here.
const TypeArguments& type_parameters =
@@ -743,8 +739,14 @@
// parameterized class.
const intptr_t offset = parameterized_class.NumTypeArguments() -
parameterized_class.NumTypeParameters();
- type_parameter.set_index(type_parameter.index() + offset);
- type_parameter.set_is_finalized();
+ // Calling NumTypeParameters() may finalize this type parameter if it
+ // belongs to a mixin application class.
+ if (!type_parameter.IsFinalized()) {
+ type_parameter.set_index(type_parameter.index() + offset);
+ type_parameter.set_is_finalized();
+ } else {
+ ASSERT(cls.IsMixinApplication());
+ }
// We do not canonicalize type parameters.
return type_parameter.raw();
}
@@ -1682,7 +1684,17 @@
mixin_app_class.type_parameters()).ToCString(),
AbstractType::Handle(mixin_app_class.super_type()).ToCString());
}
+ // Mark the application class as having been applied its mixin type in order
+ // to avoid cycles while finalizing its mixin type.
mixin_app_class.set_is_mixin_type_applied();
+ // Finalize the mixin type, which may have been changed in case
+ // mixin_app_class is a typedef.
+ mixin_type = mixin_app_class.mixin();
+ ASSERT(!mixin_type.IsBeingFinalized());
+ mixin_type ^=
+ FinalizeType(mixin_app_class, mixin_type, kCanonicalizeWellFormed);
+ // TODO(regis): Check for a malbounded mixin_type.
+ mixin_app_class.set_mixin(mixin_type);
}
@@ -2130,6 +2142,8 @@
if (num_type_arguments == num_type_parameters) {
for (intptr_t i = 0; i < num_type_arguments; i++) {
arg = type_args.TypeAt(i);
+ arg = arg.CloneUnfinalized();
+ ASSERT(!arg.IsBeingFinalized());
collected_args.Add(arg);
}
return;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index d7ad1f5..421ff4a 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -1706,16 +1706,15 @@
// resolved, which is checked by the type_class() call on the super type.
// Note that calling type_class() on a MixinAppType fails.
Isolate* isolate = Isolate::Current();
- ReusableHandleScope reused_handles(isolate);
- Class& cls = reused_handles.ClassHandle();
- TypeArguments& type_params = reused_handles.TypeArgumentsHandle();
- AbstractType& sup_type = reused_handles.AbstractTypeHandle();
+ Class& cls = Class::Handle(isolate);
+ TypeArguments& type_params = TypeArguments::Handle(isolate);
+ AbstractType& sup_type = AbstractType::Handle(isolate);
cls ^= raw();
intptr_t num_type_args = 0;
do {
if (cls.IsSignatureClass()) {
- Function& signature_fun = reused_handles.FunctionHandle();
+ Function& signature_fun = Function::Handle(isolate);
signature_fun ^= cls.signature_function();
if (!signature_fun.is_static() &&
!signature_fun.HasInstantiatedSignature()) {
@@ -3426,6 +3425,20 @@
}
+bool TypeArguments::IsFinalized() const {
+ ASSERT(!IsNull());
+ AbstractType& type = AbstractType::Handle();
+ const intptr_t num_types = Length();
+ for (intptr_t i = 0; i < num_types; i++) {
+ type = TypeAt(i);
+ if (!type.IsFinalized()) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
bool TypeArguments::IsBounded() const {
AbstractType& type = AbstractType::Handle();
const intptr_t num_types = Length();
@@ -3582,6 +3595,23 @@
}
+RawAbstractTypeArguments* TypeArguments::CloneUnfinalized() const {
+ if (IsFinalized()) {
+ return raw();
+ }
+ AbstractType& type = AbstractType::Handle();
+ const intptr_t num_types = Length();
+ const TypeArguments& clone = TypeArguments::Handle(
+ TypeArguments::New(num_types));
+ for (intptr_t i = 0; i < num_types; i++) {
+ type = TypeAt(i);
+ type = type.CloneUnfinalized();
+ clone.SetTypeAt(i, type);
+ }
+ return clone.raw();
+}
+
+
RawAbstractTypeArguments* TypeArguments::Canonicalize() const {
if (IsNull() || IsCanonical()) {
ASSERT(IsOld());
@@ -10824,6 +10854,13 @@
}
+RawAbstractType* AbstractType::CloneUnfinalized() const {
+ // AbstractType is an abstract class.
+ UNREACHABLE();
+ return NULL;
+}
+
+
RawAbstractType* AbstractType::Canonicalize() const {
// AbstractType is an abstract class.
UNREACHABLE();
@@ -11353,6 +11390,20 @@
}
+RawAbstractType* Type::CloneUnfinalized() const {
+ ASSERT(IsResolved());
+ if (IsFinalized()) {
+ return raw();
+ }
+ ASSERT(!IsMalformed()); // Malformed types are finalized.
+ ASSERT(!IsBeingFinalized()); // Cloning must occur prior to finalization.
+ AbstractTypeArguments& type_args = AbstractTypeArguments::Handle(arguments());
+ type_args = type_args.CloneUnfinalized();
+ const Class& type_cls = Class::Handle(type_class());
+ return Type::New(type_cls, type_args, token_pos());
+}
+
+
RawAbstractType* Type::Canonicalize() const {
ASSERT(IsFinalized());
if (IsCanonical() || IsMalformed()) {
@@ -11642,6 +11693,19 @@
}
+RawAbstractType* TypeParameter::CloneUnfinalized() const {
+ if (IsFinalized()) {
+ return raw();
+ }
+ // No need to clone bound, as it is not part of the finalization state.
+ return TypeParameter::New(Class::Handle(parameterized_class()),
+ index(),
+ String::Handle(name()),
+ AbstractType::Handle(bound()),
+ token_pos());
+}
+
+
intptr_t TypeParameter::Hash() const {
ASSERT(IsFinalized());
uword result = 0;
@@ -11821,6 +11885,21 @@
}
+RawAbstractType* BoundedType::CloneUnfinalized() const {
+ if (IsFinalized()) {
+ return raw();
+ }
+ AbstractType& bounded_type = AbstractType::Handle(type());
+
+ bounded_type = bounded_type.CloneUnfinalized();
+ // No need to clone bound or type parameter, as they are not part of the
+ // finalization state of this bounded type.
+ return BoundedType::New(bounded_type,
+ AbstractType::Handle(bound()),
+ TypeParameter::Handle(type_parameter()));
+}
+
+
intptr_t BoundedType::Hash() const {
uword result = 0;
result += AbstractType::Handle(type()).Hash();
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index ffceea0..2caf67d 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1136,6 +1136,9 @@
// InstantiatedTypeArguments.
class AbstractTypeArguments : public Object {
public:
+ // Returns true if all types of this vector are finalized.
+ virtual bool IsFinalized() const { return true; }
+
// Returns true if both arguments represent vectors of equal types.
static bool AreEqual(const AbstractTypeArguments& arguments,
const AbstractTypeArguments& other_arguments);
@@ -1149,7 +1152,13 @@
const AbstractTypeArguments& instantiator_type_arguments,
Error* bound_error) const;
- // Do not canonicalize InstantiatedTypeArguments or NULL objects
+ // Do not clone InstantiatedTypeArguments or null vectors, since they are
+ // considered finalized.
+ virtual RawAbstractTypeArguments* CloneUnfinalized() const {
+ return this->raw();
+ }
+
+ // Do not canonicalize InstantiatedTypeArguments or null vectors.
virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); }
// The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>".
@@ -1248,7 +1257,9 @@
virtual bool IsUninstantiatedIdentity() const;
virtual bool CanShareInstantiatorTypeArguments(
const Class& instantiator_class) const;
+ virtual bool IsFinalized() const;
virtual bool IsBounded() const;
+ virtual RawAbstractTypeArguments* CloneUnfinalized() const;
// Canonicalize only if instantiated, otherwise returns 'this'.
virtual RawAbstractTypeArguments* Canonicalize() const;
@@ -3852,6 +3863,11 @@
const AbstractTypeArguments& instantiator_type_arguments,
Error* bound_error) const;
+ // Return a clone of this unfinalized type or the type itself if it is
+ // already finalized. Apply recursively to type arguments, i.e. finalized
+ // type arguments of an unfinalized type are not cloned, but shared.
+ virtual RawAbstractType* CloneUnfinalized() const;
+
virtual RawInstance* CheckAndCanonicalize(const char** error_str) const {
return Canonicalize();
}
@@ -3989,6 +4005,7 @@
virtual RawAbstractType* InstantiateFrom(
const AbstractTypeArguments& instantiator_type_arguments,
Error* malformed_error) const;
+ virtual RawAbstractType* CloneUnfinalized() const;
virtual RawAbstractType* Canonicalize() const;
virtual intptr_t Hash() const;
@@ -4103,6 +4120,7 @@
virtual RawAbstractType* InstantiateFrom(
const AbstractTypeArguments& instantiator_type_arguments,
Error* bound_error) const;
+ virtual RawAbstractType* CloneUnfinalized() const;
virtual RawAbstractType* Canonicalize() const { return raw(); }
virtual intptr_t Hash() const;
@@ -4175,6 +4193,7 @@
virtual RawAbstractType* InstantiateFrom(
const AbstractTypeArguments& instantiator_type_arguments,
Error* bound_error) const;
+ virtual RawAbstractType* CloneUnfinalized() const;
virtual RawAbstractType* Canonicalize() const { return raw(); }
virtual intptr_t Hash() const;
diff --git a/sdk/lib/_internal/compiler/implementation/library_loader.dart b/sdk/lib/_internal/compiler/implementation/library_loader.dart
index be9e3b7..1342ce8 100644
--- a/sdk/lib/_internal/compiler/implementation/library_loader.dart
+++ b/sdk/lib/_internal/compiler/implementation/library_loader.dart
@@ -421,15 +421,6 @@
if (loadedLibrary == null) return;
compiler.withCurrentElement(library, () {
handler.registerDependency(library, tag, loadedLibrary);
-
- if (!loadedLibrary.hasLibraryName()) {
- compiler.reportFatalError(
- tag == null ? null : tag.uri,
- MessageKind.GENERIC,
- {'text':
- 'Error: No library name found in '
- '${loadedLibrary.canonicalUri}.'});
- }
});
});
}
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index 94ab233..788a3df 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -98,6 +98,12 @@
LibTest/core/double/round_A01_t02: Fail # truncate/ceil/floor/round returns ints, issue 389
LibTest/core/double/round_A01_t04: Fail # truncate/ceil/floor/round returns ints, issue 389
+Language/14_Libraries_and_Scripts/1_Imports_A01_t17: Fail # co19 Issue 603
+Language/14_Libraries_and_Scripts/1_Imports_A04_t01: Fail # co19 Issue 603
+
+Language/14_Libraries_and_Scripts/2_Exports_A05_t01: Fail # co19 Issue 604
+
+
# co19-roll r546 (11.08.2013) caused these failures
[ $compiler == dart2dart ]
Language/03_Overview/1_Scoping_A02_t28: Fail # co19-roll r559: Please triage this failure
@@ -220,7 +226,6 @@
Language/14_Libraries_and_Scripts/1_Imports_A03_t29: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A03_t30: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A03_t65: pass, fail, ok # co19 issue 560
-Language/14_Libraries_and_Scripts/1_Imports_A04_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t01: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -251,5 +256,5 @@
Language/13_Statements/11_Try_A06_t01: fail # co19-roll r546: Please triage this failure
LibTest/json/stringify_A02_t01: fail # co19-roll r587: Please triage this failure
LibTest/json/stringify_A03_t02: fail # co19-roll r587: Please triage this failure
-
-
+LibTest/json/printOn_A02_t01: fail # co19-roll r587: Please triage this failure
+LibTest/json/printOn_A03_t02: fail # co19-roll r587: Please triage this failure
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 2860893..9bc5de1 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -229,6 +229,10 @@
LibTest/typed_data/Uint32x4/toFloat32x4_A01_t02: RuntimeError # co19 Issue 601
LibTest/typed_data/Float32x4/clamp_A02_t01: RuntimeError # co19 Issue 600
+Language/14_Libraries_and_Scripts/1_Imports_A01_t17: Fail # co19 Issue 603
+Language/14_Libraries_and_Scripts/1_Imports_A04_t01: Fail # co19 Issue 603
+
+Language/14_Libraries_and_Scripts/2_Exports_A05_t01: Fail # co19 Issue 604
[ $compiler == dart2js && $jscl ]
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A04_t01: Fail, Pass # issue 3333
@@ -459,7 +463,6 @@
Language/14_Libraries_and_Scripts/1_Imports_A03_t28: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A03_t29: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A03_t30: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A04_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t01: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -624,21 +627,14 @@
Language/07_Classes/6_Constructors/2_Factories_A10_t02: fail # co19-roll r587: Please triage this failure
Language/07_Classes/6_Constructors/2_Factories_A10_t03: fail # co19-roll r587: Please triage this failure
Language/10_Generics/09_Generics_A01_t17: fail # co19-roll r587: Please triage this failure
-LibTest/json/parse_A01_t01: fail # co19-roll r587: Please triage this failure
-LibTest/json/parse_A02_t01: fail # co19-roll r587: Please triage this failure
-LibTest/json/printOn_A01_t01: fail # co19-roll r587: Please triage this failure
-LibTest/json/printOn_A02_t01: fail # co19-roll r587: Please triage this failure
-LibTest/json/printOn_A03_t01: fail # co19-roll r587: Please triage this failure
-LibTest/json/printOn_A03_t02: fail # co19-roll r587: Please triage this failure
-LibTest/json/printOn_A03_t03: fail # co19-roll r587: Please triage this failure
-LibTest/json/printOn_A04_t01: fail # co19-roll r587: Please triage this failure
[ $compiler == dart2js ]
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t04: fail # co19-roll r587: Please triage this failure
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t04: fail # co19-roll r587: Please triage this failure
LibTest/json/stringify_A01_t01: fail # co19-roll r587: Please triage this failure
LibTest/json/stringify_A02_t01: fail # co19-roll r587: Please triage this failure
+LibTest/json/printOn_A01_t01: fail # co19-roll r587: Please triage this failure
+LibTest/json/printOn_A02_t01: fail # co19-roll r587: Please triage this failure
LibTest/math/pow_A04_t01: fail # co19-roll r587: Please triage this failure
LibTest/math/pow_A14_t01: fail # co19-roll r587: Please triage this failure
LibTest/math/pow_A16_t01: fail # co19-roll r587: Please triage this failure
-
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 499ad55..4bb4278 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -121,6 +121,7 @@
mixin_mixin2_test: RuntimeError # Issue 13109.
mixin_mixin3_test: RuntimeError # Issue 13109.
mixin_mixin7_test: RuntimeError # Issue 13109.
+mixin_regress_13688_test: RuntimeError # Issue 13109.
# Compilation errors.
const_var_test: CompileTimeError # Issue 12793
diff --git a/tests/language/mixin_regress_13688_test.dart b/tests/language/mixin_regress_13688_test.dart
new file mode 100644
index 0000000..0011539
--- /dev/null
+++ b/tests/language/mixin_regress_13688_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+class ComparableMixin<E> {
+ e() {
+ return E;
+ }
+}
+
+class KUID extends Object with ComparableMixin<KUID> { }
+
+main() {
+ var kuid = new KUID();
+ Expect.equals(kuid.runtimeType.toString(), kuid.e().toString());
+}
diff --git a/tools/VERSION b/tools/VERSION
index c1958e4..7dc526d 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 7
BUILD 6
-PATCH 3
+PATCH 4