cleanup language_2 and corelib_2 tests that import dart:mirrors
Preserves tests that didn't really need mirrors, and moves tests for
mirror functionality into lib_2/mirrors tests.
Change-Id: Ie16dee1a4b508e3f14da53499f57c5dae2d1e513
Reviewed-on: https://dart-review.googlesource.com/49624
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
diff --git a/tests/corelib_2/apply3_test.dart b/tests/corelib_2/apply3_test.dart
index d96fa0d..5bf1bce 100644
--- a/tests/corelib_2/apply3_test.dart
+++ b/tests/corelib_2/apply3_test.dart
@@ -5,7 +5,6 @@
// Test [Function.apply] on user-defined classes that implement [noSuchMethod].
import "package:expect/expect.dart";
-import 'dart:mirrors';
class F {
call([p1]) => "call";
@@ -24,46 +23,12 @@
main() {
Expect.equals('call', Function.apply(new F(), []));
Expect.equals('call', Function.apply(new F(), [1]));
- Expect.equals('NSM', Function.apply(new F(), [1, 2]));
- Expect.equals('NSM', Function.apply(new F(), [1, 2, 3]));
+ Expect.throwsNoSuchMethodError(() => Function.apply(new F(), [1, 2]));
+ Expect.throwsNoSuchMethodError(() => Function.apply(new F(), [1, 2, 3]));
- var symbol = const Symbol('a');
- var requiredParameters = [1];
- var optionalParameters = new Map<Symbol, int>()..[symbol] = 42;
- Invocation i =
- Function.apply(new G(), requiredParameters, optionalParameters);
-
- Expect.equals(const Symbol('call'), i.memberName);
- Expect.listEquals(requiredParameters, i.positionalArguments);
- Expect.mapEquals(optionalParameters, i.namedArguments);
- Expect.isTrue(i.isMethod);
- Expect.isFalse(i.isGetter);
- Expect.isFalse(i.isSetter);
- Expect.isFalse(i.isAccessor);
-
- // Check that changing the passed list and map for parameters does
- // not affect [i].
- requiredParameters[0] = 42;
- optionalParameters[symbol] = 12;
- Expect.listEquals([1], i.positionalArguments);
- Expect.mapEquals(new Map()..[symbol] = 42, i.namedArguments);
-
- // Check that using [i] for invocation yields the same [Invocation]
- // object.
- var mirror = reflect(new G());
- Invocation other = mirror.delegate(i);
- Expect.equals(i.memberName, other.memberName);
- Expect.listEquals(i.positionalArguments, other.positionalArguments);
- Expect.mapEquals(i.namedArguments, other.namedArguments);
- Expect.equals(i.isMethod, other.isMethod);
- Expect.equals(i.isGetter, other.isGetter);
- Expect.equals(i.isSetter, other.isSetter);
- Expect.equals(i.isAccessor, other.isAccessor);
+ Expect.throwsNoSuchMethodError(() => Function.apply(new G(), [1], {#a: 42}));
// Test that [i] can be used to hit an existing method.
Expect.equals(43, new H().call(1, a: 42));
- Expect.equals(43, Function.apply(new H(), [1], new Map()..[symbol] = 42));
- mirror = reflect(new H());
- Expect.equals(43, mirror.delegate(i));
- Expect.equals(43, mirror.delegate(other));
+ Expect.equals(43, Function.apply(new H(), [1], {#a: 42}));
}
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index d6a5423..bf41412 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -22,7 +22,6 @@
error_stack_trace_test/static: MissingCompileTimeError
[ $compiler == dartdevk ]
-apply3_test: RuntimeError
bigint_from_test: RuntimeError # Issue 32589
bool_from_environment2_test/03: Crash
int_modulo_arith_test/modPow: RuntimeError
@@ -39,7 +38,7 @@
regexp/pcre_test: Pass, Slow # Issue 22008
[ $runtime == flutter ]
-apply3_test: CompileTimeError # mirrors not supported
+apply3_test: RuntimeError
bool_from_environment_test: Fail # Flutter Issue 9111
format_exception_test: RuntimeError # Flutter Issue 9111
from_environment_const_type_test/01: Fail # Flutter Issue 9111
@@ -193,8 +192,8 @@
symbol_reserved_word_test/03: RuntimeError # Issue 19972, new Symbol('void') should be allowed.
[ $compiler == dart2js && $fast_startup ]
-apply3_test: Fail # mirrors not supported
-dynamic_nosuchmethod_test: Fail # mirrors not supported
+apply3_test: RuntimeError
+dynamic_nosuchmethod_test: RuntimeError
[ $compiler == dart2js && $fast_startup && $fasta && $strong ]
cast_test: RuntimeError
@@ -246,7 +245,6 @@
uri_test: RuntimeError
[ $compiler == dart2js && $fasta && $minified && $strong ]
-apply3_test: RuntimeError
cast_test: RuntimeError
dynamic_nosuchmethod_test: RuntimeError
error_stack_trace1_test: RuntimeError # Issue 12399
@@ -314,7 +312,6 @@
# ===== dartk + vm status lines =====
[ $compiler == dartk && $runtime == vm && $strong ]
-apply3_test: RuntimeError
apply_generic_function_test: RuntimeError
iterable_fold_test/02: RuntimeError
iterable_reduce_test/01: CompileTimeError # Issue 31533
@@ -413,7 +410,6 @@
typed_data_with_limited_ints_test: Skip # dart2js and dartdevc don't know about --limit-ints-to-64-bits
[ $runtime != none && ($compiler == dartdevc || $compiler == dartdevk) ]
-apply3_test: RuntimeError # Issue 29921
bigint_test: Pass, Slow
compare_to2_test: RuntimeError # Issue 30170
date_time10_test: RuntimeError # Issue 29921
@@ -594,13 +590,12 @@
from_environment_const_type_undefined_test/16: MissingCompileTimeError
iterable_to_set_test: RuntimeError # is-checks do not implement strong mode type system
-[ $compiler == dartkp || $compiler == precompiler ]
-apply3_test: SkipByDesign
-dynamic_nosuchmethod_test: SkipByDesign
-
[ $compiler == precompiler || $runtime == vm && !$checked && !$strong ]
int_parse_radix_test/badTypes: RuntimeError # wrong exception returned
+[ $compiler == precompiler || $runtime == vm && !$strong ]
+apply3_test: RuntimeError
+
[ $runtime == dart_precompiled || $runtime == flutter || $runtime == vm ]
regexp/global_test: Skip # Issue 21709
regexp/pcre_test: Pass, Slow, Timeout
diff --git a/tests/corelib_2/dynamic_nosuchmethod_test.dart b/tests/corelib_2/dynamic_nosuchmethod_test.dart
index 730cdbb..2577b48 100644
--- a/tests/corelib_2/dynamic_nosuchmethod_test.dart
+++ b/tests/corelib_2/dynamic_nosuchmethod_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
-import 'dart:mirrors';
// Test that noSuchMethod calls behave as expected for dynamic object invocations.
class BaseClass {
@@ -19,7 +18,9 @@
ReturnInvocationName(this._bar);
noSuchMethod(Invocation invocation) {
- return MirrorSystem.getName(invocation.memberName);
+ var name = invocation.memberName.toString();
+ var match = new RegExp(r'Symbol\("([^"]+)"\)').matchAsPrefix(name);
+ return match != null ? match.group(1) : name;
}
bar() {
diff --git a/tests/language_2/const_evaluation_test.dart b/tests/language_2/const_evaluation_test.dart
index e176c16..cd0353e 100644
--- a/tests/language_2/const_evaluation_test.dart
+++ b/tests/language_2/const_evaluation_test.dart
@@ -5,8 +5,6 @@
// Check that compile-time evaluation of constants is consistent with runtime
// evaluation.
-import 'dart:mirrors';
-
import 'package:expect/expect.dart';
const top_const = identical(-0.0, 0);
@@ -38,9 +36,6 @@
Expect.equals(instance_var, local_const);
Expect.equals(local_const, local_final);
Expect.equals(local_final, local_var);
- var metadata = reflectClass(C).metadata[0].reflectee; //# 01: ok
- Expect.equals(top_const, metadata); // //# 01: continued
- Expect.equals(local_var, metadata); // //# 01: continued
}
}
diff --git a/tests/language_2/field_increment_bailout_test.dart b/tests/language_2/field_increment_bailout_test.dart
index 7275f67..cddb38c 100644
--- a/tests/language_2/field_increment_bailout_test.dart
+++ b/tests/language_2/field_increment_bailout_test.dart
@@ -4,7 +4,6 @@
// dart2js regression test for issue 8781.
-import "dart:mirrors" show reflect;
import "package:expect/expect.dart";
class N {
@@ -37,17 +36,17 @@
}
}
-class L {
- final list;
- L(this.list);
- // Use noSuchMethod to defeat type inferencing.
- noSuchMethod(mirror) => reflect(list).delegate(mirror);
-}
-
main() {
- var o = new A(new N(new L([1]), new L([2])));
+ var o = new A(new N(confuse([1]), confuse([2])));
for (var i = 1; i <= 2; i++) Expect.equals(i, o.next());
Expect.equals(null, o.list);
}
+
+// Use confuse to defeat type inferencing.
+@NoInline()
+@AssumeDynamic()
+confuse(x) {
+ return x;
+}
diff --git a/tests/language_2/invocation_mirror2_test.dart b/tests/language_2/invocation_mirror2_test.dart
index c8264ec..6f62d6e 100644
--- a/tests/language_2/invocation_mirror2_test.dart
+++ b/tests/language_2/invocation_mirror2_test.dart
@@ -2,17 +2,10 @@
// 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 "dart:mirrors" show reflect;
import "package:expect/expect.dart";
-class GetName {
- set flif(_) => "flif=";
-}
-
-int getName(im) => reflect(new GetName()).delegate(im);
-
class C {
- var im;
+ Invocation im;
noSuchMethod(im) => this.im = im;
flif() {}
}
@@ -20,6 +13,6 @@
main() {
dynamic c = new C();
c.flif = 42;
- Expect.equals(42, getName(c.im));
+ Expect.equals(const Symbol("flif="), c.im.memberName);
Expect.equals(42, c.im.positionalArguments[0]);
}
diff --git a/tests/language_2/language_2.status b/tests/language_2/language_2.status
index 84e6d30..71aa79a 100644
--- a/tests/language_2/language_2.status
+++ b/tests/language_2/language_2.status
@@ -57,7 +57,6 @@
# errors aren't detected by fasta, but reported by back ends as compile-time
# errors.
[ $compiler != dart2js && $runtime != dart_precompiled && $runtime != vm && $fasta ]
-deferred_constraints_constants_test/default_argument2: MissingCompileTimeError
function_type_parameter2_negative_test: Fail
function_type_parameter_negative_test: Fail
implicit_creation/implicit_const_not_default_values_test/e12: MissingCompileTimeError
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 748abd0..6a6c78e 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -1167,6 +1167,7 @@
string_unicode3_negative_test: CompileTimeError
string_unicode4_negative_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
+super_call4_test/01: MissingCompileTimeError
super_setter_test: StaticWarning # Issue 28823
switch_case_test/none: CompileTimeError
syntax_test/60: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index ee3ad7d..2523fdf 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -12,7 +12,6 @@
issue23244_test: RuntimeError # Isolates - enum canonicalization - Issue 23244
library_env_test/has_mirror_support: RuntimeError, OK
library_env_test/has_no_html_support: RuntimeError, OK
-null_test/mirrors: SkipByDesign # Uses mirrors.
vm/*: SkipByDesign # Tests for the VM.
[ $compiler != dart2js ]
@@ -284,9 +283,6 @@
covariant_override/runtime_check_test: RuntimeError
covariant_subtyping_test: RuntimeError
cyclic_constructor_test/01: Crash # Stack Overflow
-deferred_constraints_constants_test/default_argument2: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
-deferred_constraints_constants_test/none: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
-deferred_constraints_constants_test/reference_after_load: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred_constraints_type_annotation_test/as_operation: MissingCompileTimeError
deferred_constraints_type_annotation_test/catch_check: MissingCompileTimeError
deferred_constraints_type_annotation_test/is_check: MissingCompileTimeError
@@ -469,8 +465,6 @@
not_enough_positional_arguments_test/05: MissingCompileTimeError
not_enough_positional_arguments_test/06: MissingCompileTimeError
not_enough_positional_arguments_test/07: MissingCompileTimeError
-null_test/mirrors: RuntimeError
-null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError, OK # non JS number semantics
override_field_method1_negative_test: Fail
@@ -561,31 +555,8 @@
issue31596_test: RuntimeError
[ $compiler == dart2js && $fast_startup ]
-const_evaluation_test/*: Fail # mirrors not supported
-deferred_constraints_constants_test: Pass # mirrors not supported, passes for the wrong reason
-deferred_constraints_constants_test/none: Fail # mirrors not supported
-deferred_constraints_constants_test/reference_after_load: Fail # mirrors not supported
-enum_mirror_test: Fail # mirrors not supported
-field_increment_bailout_test: Fail # mirrors not supported
-instance_creation_in_function_annotation_test: Fail # mirrors not supported
-invocation_mirror2_test: Fail # mirrors not supported
-invocation_mirror_invoke_on2_test: Fail # mirrors not supported
-invocation_mirror_invoke_on_test: Fail # mirrors not supported
-issue21079_test: Fail # mirrors not supported
library_env_test/has_mirror_support: Fail # mirrors not supported
library_env_test/has_no_mirror_support: Pass # fails for the wrong reason.
-many_overridden_no_such_method_test: Fail # mirrors not supported
-no_such_method_test: Fail # mirrors not supported
-null_test/0*: Pass # mirrors not supported, fails for the wrong reason
-null_test/none: Fail # mirrors not supported
-overridden_no_such_method_test: Fail # mirrors not supported
-redirecting_factory_reflection_test: Fail # mirrors not supported
-regress_13462_0_test: Fail # mirrors not supported
-regress_13462_1_test: Fail # mirrors not supported
-regress_18535_test: Fail # mirrors not supported
-regress_28255_test: Fail # mirrors not supported
-super_call4_test: Fail # mirrors not supported
-super_getter_setter_test: CompileTimeError
vm/reflect_core_vm_test: Fail # mirrors not supported
[ $compiler == dart2js && $fast_startup && $fasta && $strong ]
@@ -649,9 +620,6 @@
cyclic_type_test/04: RuntimeError
cyclic_typedef_test/10: Crash # Crash when compiling file:///usr/local/google/home/sra/Dart/sdk/out/ReleaseX64/generated_tests/language_2/cyclic_typedef_test_10.dart,
cyclic_typedef_test/11: Crash # Crash when compiling file:///usr/local/google/home/sra/Dart/sdk/out/ReleaseX64/generated_tests/language_2/cyclic_typedef_test_11.dart,
-deferred_constraints_constants_test/default_argument2: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
-deferred_constraints_constants_test/none: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
-deferred_constraints_constants_test/reference_after_load: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
@@ -676,7 +644,6 @@
f_bounded_quantification4_test: RuntimeError
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
-field_increment_bailout_test: RuntimeError
field_initialization_order_test/01: MissingCompileTimeError
field_initialization_order_test/none: RuntimeError
field_override3_test/00: MissingCompileTimeError
@@ -851,8 +818,6 @@
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
null_no_such_method_test: CompileTimeError
-null_test/mirrors: RuntimeError
-null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError, OK # non JS number semantics
overridden_no_such_method_test: RuntimeError
@@ -1073,8 +1038,6 @@
cyclic_typedef_test/11: Crash # Stack Overflow
default_factory2_test/01: MissingCompileTimeError
default_factory_test/01: MissingCompileTimeError
-deferred_constraints_constants_test/none: RuntimeError
-deferred_constraints_constants_test/reference_after_load: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
@@ -1104,7 +1067,6 @@
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
field3_test/01: MissingCompileTimeError
-field_increment_bailout_test: RuntimeError
field_initialization_order_test/01: MissingCompileTimeError
field_initialization_order_test/none: RuntimeError
field_override3_test/00: MissingCompileTimeError
@@ -1346,8 +1308,6 @@
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
null_no_such_method_test: CompileTimeError
-null_test/mirrors: RuntimeError
-null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError, OK # non JS number semantics
operator2_negative_test: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
@@ -1417,8 +1377,6 @@
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
super_no_such_method1_test: CompileTimeError
super_no_such_method2_test: CompileTimeError
super_no_such_method3_test: CompileTimeError
@@ -1654,8 +1612,6 @@
cyclic_typedef_test/11: Crash # Stack Overflow
default_factory2_test/01: MissingCompileTimeError
default_factory_test/01: MissingCompileTimeError
-deferred_constraints_constants_test/none: RuntimeError
-deferred_constraints_constants_test/reference_after_load: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
@@ -1685,7 +1641,6 @@
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
field3_test/01: MissingCompileTimeError
-field_increment_bailout_test: RuntimeError
field_initialization_order_test/01: MissingCompileTimeError
field_initialization_order_test/none: RuntimeError
field_override3_test/00: MissingCompileTimeError
@@ -1929,8 +1884,6 @@
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
null_no_such_method_test: CompileTimeError
-null_test/mirrors: RuntimeError
-null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError, OK # non JS number semantics
overridden_no_such_method_test: RuntimeError
@@ -1998,8 +1951,6 @@
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
super_no_such_method1_test: CompileTimeError
super_no_such_method2_test: CompileTimeError
super_no_such_method3_test: CompileTimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index b35d2ef..4e0d8bc 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -157,7 +157,7 @@
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
-super_call4_test: RuntimeError
+super_call4_test/01: MissingCompileTimeError
super_no_such_method1_test: RuntimeError
super_no_such_method2_test: RuntimeError
super_no_such_method3_test: RuntimeError
@@ -580,8 +580,6 @@
string_split_test: CompileTimeError # Issue 31616
string_supertype_checked_test: CompileTimeError # Issue 31616
super_bound_closure_test/none: CompileTimeError # Issue 31533
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
super_no_such_method1_test: CompileTimeError
super_no_such_method2_test: CompileTimeError
super_no_such_method3_test: CompileTimeError
@@ -683,7 +681,6 @@
expect_test: RuntimeError # Issue 29920; Expect.identical did not fail
f_bounded_quantification3_test: RuntimeError # Issue 29920; Uncaught Error: type arguments should not be null: (F1, F2) => {
field3_test/01: MissingCompileTimeError
-field_increment_bailout_test: RuntimeError # Issue 29920; UnimplementedError: JsInstanceMirror.delegate unimplemented
field_initialization_order_test/none: RuntimeError # Expect.equals(expected: <b.a.ai.bi.>, actual: <b.bi.a.ai.>) fails.
flatten_test/05: MissingRuntimeError # Issue 29920
flatten_test/08: MissingRuntimeError # Issue 29920
@@ -704,7 +701,6 @@
int64_literal_test/*: Skip # This is testing Dart 2.0 int64 semantics.
integer_division_by_zero_test: RuntimeError # Issue 29920; Expect.throws: Unexpected 'Unsupported operation: Infinity'
internal_library_test/02: Crash
-invocation_mirror2_test: RuntimeError # UnimplementedError: JsInstanceMirror.delegate unimplemented
invocation_mirror_invoke_on2_test: RuntimeError # UnimplementedError: JsInstanceMirror.delegate unimplemented
invocation_mirror_invoke_on_test: RuntimeError # UnimplementedError: JsInstanceMirror.delegate unimplemented
invocation_mirror_test: RuntimeError # Type 'NativeJavaScriptObject' is not a subtype of type 'int' in strong mode
@@ -717,7 +713,6 @@
local_function2_test/none: RuntimeError # ReferenceError: TToNull is not defined
local_function3_test/none: RuntimeError # Expect.equals(expected: <true>, actual: <false>) fails.
local_function_test/none: RuntimeError # Expect.equals(expected: <true>, actual: <false>) fails.
-many_overridden_no_such_method_test: RuntimeError # UnimplementedError: JsInstanceMirror.delegate unimplemented; UnimplementedError: JsInstanceMirror.delegate unimplemented
method_override7_test/03: MissingCompileTimeError # Issue 30514
mint_arithmetic_test: RuntimeError # Issue 29920; Expect.equals(expected: <4294967297>, actual: <1>) fails.
modulo_test: RuntimeError # Ints and doubles are unified.; Expect.throws fails: Did not throw
@@ -728,11 +723,9 @@
named_parameters_default_eq_test/none: RuntimeError # Expect.isTrue(false) fails.
nan_identical_test: RuntimeError # Issue 29920; Unsupported operation: Uint64 accessor not supported by dart2js.
nested_switch_label_test: RuntimeError # Issue 29920; UnimplementedError: node <ShadowContinueSwitchStatement> see https://github.com/dart-lang/sdk/issues/29352 `continue #L1;
-no_such_method_test: RuntimeError # UnimplementedError: JsInstanceMirror.delegate unimplemented
null_test/mirrors: RuntimeError # Uses mirrors.; ReferenceError: GenericOfT is not defined
number_identity2_test: RuntimeError # Issue 29920; Expect.isTrue(false) fails.
numbers_test: RuntimeError # Issue 29920; Expect.equals(expected: <false>, actual: <true>) fails.
-overridden_no_such_method_test: RuntimeError # UnimplementedError: JsInstanceMirror.delegate unimplemented; UnimplementedError: JsInstanceMirror.delegate unimplemented
override_field_test/03: MissingCompileTimeError
parser_quirks_test: CompileTimeError
regress_16640_test: RuntimeError # Issue 29920; Uncaught Error: type arguments should not be null: E => {
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index f53f4b5..55bdd8c 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -665,8 +665,6 @@
string_split_test: CompileTimeError # Issue 31616
string_supertype_checked_test: CompileTimeError # Issue 31616
super_bound_closure_test/none: CompileTimeError # Issue 31533
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
super_no_such_method1_test: CompileTimeError
super_no_such_method2_test: CompileTimeError
super_no_such_method3_test: CompileTimeError
@@ -894,10 +892,6 @@
deep_nesting1_negative_test: Skip # Issue 31158
deep_nesting2_negative_test: Skip # Issue 31158
deferred_call_empty_before_load_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_constants_test: SkipByDesign
-deferred_constraints_constants_test/default_argument2: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_constants_test/reference_after_load: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
deferred_load_constants_test/none: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
deferred_load_library_wrong_args_test/01: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 30273.
deferred_not_loaded_check_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
@@ -1057,8 +1051,6 @@
string_split_test: CompileTimeError # Issue 31616
string_supertype_checked_test: CompileTimeError # Issue 31616
super_bound_closure_test/none: CompileTimeError # Issue 31533
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
super_no_such_method1_test: CompileTimeError
super_no_such_method2_test: CompileTimeError
super_no_such_method3_test: CompileTimeError
@@ -1257,8 +1249,6 @@
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
super_no_such_method1_test: CompileTimeError
super_no_such_method2_test: CompileTimeError
super_no_such_method3_test: CompileTimeError
@@ -2020,6 +2010,7 @@
substring_test/01: MissingCompileTimeError
super_assign_test/01: MissingCompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
+super_call4_test/01: MissingCompileTimeError
super_operator_index_test/01: MissingCompileTimeError
super_operator_index_test/02: MissingCompileTimeError
super_operator_index_test/03: MissingCompileTimeError
diff --git a/tests/language_2/language_2_precompiled.status b/tests/language_2/language_2_precompiled.status
index 1855bda..58fc4e0 100644
--- a/tests/language_2/language_2_precompiled.status
+++ b/tests/language_2/language_2_precompiled.status
@@ -911,8 +911,6 @@
substring_test/01: MissingCompileTimeError
super_assign_test/01: MissingCompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
super_operator_index_test/01: MissingCompileTimeError
super_operator_index_test/02: MissingCompileTimeError
super_operator_index_test/03: MissingCompileTimeError
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index 9d7067e..eb0dd41 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -919,6 +919,7 @@
substring_test/01: MissingCompileTimeError
super_assign_test/01: MissingCompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
+super_call4_test/01: MissingCompileTimeError
super_operator_index_test/01: MissingCompileTimeError
super_operator_index_test/02: MissingCompileTimeError
super_operator_index_test/03: MissingCompileTimeError
diff --git a/tests/language_2/many_overridden_no_such_method_test.dart b/tests/language_2/many_overridden_no_such_method_test.dart
index a9eb62e..d1230e6 100644
--- a/tests/language_2/many_overridden_no_such_method_test.dart
+++ b/tests/language_2/many_overridden_no_such_method_test.dart
@@ -5,7 +5,6 @@
library OverriddenNoSuchMethodTest.dart;
-import "dart:mirrors" show reflect;
import "package:expect/expect.dart";
part "overridden_no_such_method.dart";
diff --git a/tests/language_2/no_such_method_test.dart b/tests/language_2/no_such_method_test.dart
index f9a52b1..f38285a 100644
--- a/tests/language_2/no_such_method_test.dart
+++ b/tests/language_2/no_such_method_test.dart
@@ -3,34 +3,22 @@
// BSD-style license that can be found in the LICENSE file.
// Dart test program testing that NoSuchMethod is properly called.
-import "dart:mirrors" show reflect;
import "package:expect/expect.dart";
-class GetName {
- foo({a, b}) => "foo";
- moo({b}) => "moo";
-}
-
-String getName(im) => reflect(new GetName()).delegate(im);
-
class NoSuchMethodTest {
foo({a: 10, b: 20}) {
return (10 * a) + b;
}
noSuchMethod(Invocation im) {
- Expect.equals("moo", getName(im));
+ Expect.equals(#moo, im.memberName);
Expect.equals(0, im.positionalArguments.length);
Expect.equals(1, im.namedArguments.length);
return foo(b: im.namedArguments[const Symbol("b")]);
}
-
- static testMain() {
- var obj = new NoSuchMethodTest() as dynamic;
- Expect.equals(199, obj.moo(b: 99)); // obj.NoSuchMethod called here.
- }
}
main() {
- NoSuchMethodTest.testMain();
+ var obj = new NoSuchMethodTest() as dynamic;
+ Expect.equals(199, obj.moo(b: 99)); // obj.NoSuchMethod called here.
}
diff --git a/tests/language_2/null_test.dart b/tests/language_2/null_test.dart
index ba3459d..10e37fa 100644
--- a/tests/language_2/null_test.dart
+++ b/tests/language_2/null_test.dart
@@ -5,7 +5,6 @@
// VMOptions=--optimization-counter-threshold=5
-import "dart:mirrors";
import "package:expect/expect.dart";
class BadInherit
@@ -171,18 +170,6 @@
Expect.isFalse(compareWithNull(val));
Expect.isTrue(compareWithNull(obj));
- ClassMirror cm = reflectClass(Null);
-
- InstanceMirror im1 = reflect(null);
- Expect.equals(cm, im1.type);
- Expect.isTrue(im1.invoke(const Symbol("=="), [null]).reflectee);//# mirrors: ok
- Expect.isFalse(im1.invoke(const Symbol("=="), [42]).reflectee); //# mirrors: ok
-
- InstanceMirror im2 = reflect(obj);
- Expect.equals(cm, im2.type);
- Expect.isTrue(im2.invoke(const Symbol("=="), [null]).reflectee);//# mirrors: ok
- Expect.isFalse(im2.invoke(const Symbol("=="), [42]).reflectee); //# mirrors: ok
-
// Method/value extraction. The runtimeType was checked above, and operator==
// cannot be extracted.
// Currently fails in VM.
diff --git a/tests/language_2/overridden_no_such_method.dart b/tests/language_2/overridden_no_such_method.dart
index c9a98bc..9e86672 100644
--- a/tests/language_2/overridden_no_such_method.dart
+++ b/tests/language_2/overridden_no_such_method.dart
@@ -5,17 +5,11 @@
part of OverriddenNoSuchMethodTest.dart;
-class GetName {
- foo(a, b) => "foo";
-}
-
-String getName(im) => reflect(new GetName()).delegate(im);
-
class OverriddenNoSuchMethod {
OverriddenNoSuchMethod() {}
noSuchMethod(Invocation mirror) {
- Expect.equals("foo", getName(mirror));
+ Expect.equals(#foo, mirror.memberName);
// 'foo' was called with two parameters (not counting receiver).
List args = mirror.positionalArguments;
Expect.equals(2, args.length);
diff --git a/tests/language_2/overridden_no_such_method_test.dart b/tests/language_2/overridden_no_such_method_test.dart
index 9c7fe12..3aa37be 100644
--- a/tests/language_2/overridden_no_such_method_test.dart
+++ b/tests/language_2/overridden_no_such_method_test.dart
@@ -5,7 +5,6 @@
library OverriddenNoSuchMethodTest.dart;
-import "dart:mirrors" show reflect;
import "package:expect/expect.dart";
part "overridden_no_such_method.dart";
diff --git a/tests/language_2/super_call4_test.dart b/tests/language_2/super_call4_test.dart
index 239339a..dbff2ea 100644
--- a/tests/language_2/super_call4_test.dart
+++ b/tests/language_2/super_call4_test.dart
@@ -2,7 +2,6 @@
// 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 "dart:mirrors" show reflect;
import "package:expect/expect.dart";
// Checks that noSuchMethod is resolved in the super class and not in the
@@ -16,50 +15,26 @@
bool baz({int b});
bool boz(int a, {int c});
- bool noSuchMethod(Invocation im) {
- if (im.memberName == const Symbol('foo')) {
- return im.positionalArguments.isEmpty &&
- im.namedArguments.isEmpty &&
- reflect(e).delegate(im);
- }
- if (im.memberName == const Symbol('bar')) {
- return im.positionalArguments.length == 1 &&
- im.namedArguments.isEmpty &&
- reflect(e).delegate(im);
- }
- if (im.memberName == const Symbol('baz')) {
- return im.positionalArguments.isEmpty &&
- im.namedArguments.length == 1 &&
- reflect(e).delegate(im);
- }
- if (im.memberName == const Symbol('boz')) {
- return im.positionalArguments.length == 1 &&
- im.namedArguments.length == 1 &&
- reflect(e).delegate(im);
- }
- return false;
- }
+ bool noSuchMethod(Invocation im) => true;
}
class D extends C {
- bool noSuchMethod(Invocation im) {
- return false;
- }
+ bool noSuchMethod(Invocation im) => false;
test1() {
- return super.foo();
+ return super.foo(); //# 01: compile-time error
}
test2() {
- return super.bar(1);
+ return super.bar(1); //# 01: compile-time error
}
test3() {
- return super.baz(b: 2);
+ return super.baz(b: 2); //# 01: compile-time error
}
test4() {
- return super.boz(1, c: 2);
+ return super.boz(1, c: 2); //# 01: compile-time error
}
}
@@ -72,8 +47,8 @@
main() {
var d = new D();
- Expect.isTrue(d.test1());
- Expect.isTrue(d.test2());
- Expect.isTrue(d.test3());
- Expect.isTrue(d.test4());
+ Expect.isNull(d.test1());
+ Expect.isNull(d.test2());
+ Expect.isNull(d.test3());
+ Expect.isNull(d.test4());
}
diff --git a/tests/language_2/super_getter_setter_test.dart b/tests/language_2/super_getter_setter_test.dart
deleted file mode 100644
index 736957a..0000000
--- a/tests/language_2/super_getter_setter_test.dart
+++ /dev/null
@@ -1,126 +0,0 @@
-// 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 'dart:mirrors';
-
-import "package:expect/expect.dart";
-
-class A {
- var missingSetterField;
- var missingGetterField;
- var getterInSuperClassField;
- var setterInSuperClassField;
- var getterSetterField;
- var missingAllField;
- var indexField = new List(2);
-
- set setterInSuperClass(a) {
- setterInSuperClassField = a;
- }
-
- get getterInSuperClass => getterInSuperClassField;
-}
-
-class B extends A {
- get missingSetter => missingSetterField;
- get setterInSuperClass => setterInSuperClassField;
-
- set missingGetter(a) {
- missingGetterField = a;
- }
-
- set getterInSuperClass(a) {
- getterInSuperClassField = a;
- }
-
- get getterSetter => getterSetterField;
- set getterSetter(a) {
- getterSetterField = a;
- }
-
- operator [](index) => indexField[index];
- operator []=(index, value) {
- indexField[index] = value;
- }
-
- set missingSetter(a);
- get missingGetter;
-
- set missingAll(a);
- get missingAll;
-
- noSuchMethod(Invocation im) {
- String name = MirrorSystem.getName(im.memberName);
- if (name.startsWith('missingSetter')) {
- Expect.isTrue(im.isSetter);
- missingSetterField = im.positionalArguments[0];
- } else if (name.startsWith('missingGetter')) {
- Expect.isTrue(im.isGetter);
- return missingGetterField;
- } else if (name.startsWith('missingAll') && im.isGetter) {
- return missingAllField;
- } else if (name.startsWith('missingAll') && im.isSetter) {
- missingAllField = im.positionalArguments[0];
- } else {
- Expect.fail('Should not reach here');
- }
- }
-}
-
-class C extends B {
- test() {
- Expect.equals(42, super.missingSetter = 42);
- Expect.equals(42, super.missingSetter);
- Expect.equals(43, super.missingSetter += 1);
- Expect.equals(43, super.missingSetter);
- Expect.equals(43, super.missingSetter++);
- Expect.equals(44, super.missingSetter);
-
- Expect.equals(42, super.missingGetter = 42);
- Expect.equals(42, super.missingGetter);
- Expect.equals(43, super.missingGetter += 1);
- Expect.equals(43, super.missingGetter);
- Expect.equals(43, super.missingGetter++);
- Expect.equals(44, super.missingGetter);
-
- Expect.equals(42, super.setterInSuperClass = 42);
- Expect.equals(42, super.setterInSuperClass);
- Expect.equals(43, super.setterInSuperClass += 1);
- Expect.equals(43, super.setterInSuperClass);
- Expect.equals(43, super.setterInSuperClass++);
- Expect.equals(44, super.setterInSuperClass);
-
- Expect.equals(42, super.getterInSuperClass = 42);
- Expect.equals(42, super.getterInSuperClass);
- Expect.equals(43, super.getterInSuperClass += 1);
- Expect.equals(43, super.getterInSuperClass);
- Expect.equals(43, super.getterInSuperClass++);
- Expect.equals(44, super.getterInSuperClass);
-
- Expect.equals(42, super.missingAll = 42);
- Expect.equals(42, super.missingAll);
- Expect.equals(43, super.missingAll += 1);
- Expect.equals(43, super.missingAll);
- Expect.equals(43, super.missingAll++);
- Expect.equals(44, super.missingAll);
-
- Expect.equals(42, super[0] = 42);
- Expect.equals(42, super[0]);
- Expect.equals(43, super[0] += 1);
- Expect.equals(43, super[0]);
- Expect.equals(43, super[0]++);
- Expect.equals(44, super[0]);
-
- Expect.equals(2, super[0] = 2);
- Expect.equals(2, super[0]);
- Expect.equals(3, super[0] += 1);
- Expect.equals(3, super[0]);
- Expect.equals(3, super[0]++);
- Expect.equals(4, super[0]);
- }
-}
-
-main() {
- new C().test();
-}
diff --git a/tests/lib_2/html/mirrors_js_typed_interop_test.dart b/tests/lib_2/html/mirrors_js_typed_interop_test.dart
index e877295..e4358a7 100644
--- a/tests/lib_2/html/mirrors_js_typed_interop_test.dart
+++ b/tests/lib_2/html/mirrors_js_typed_interop_test.dart
@@ -1,6 +1,10 @@
// Copyright (c) 2015, 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.
+// dartdevcOptions=--emit-metadata
+
+// TODO(jmesserly): delete this test file once `dart:mirrors` is fully diabled
+// in dart4web compilers.
@JS()
library tests.html.mirrors_js_typed_interop_test;
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index fbfe46a..e9c9f60 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -17,6 +17,7 @@
[ $fasta ]
isolate/compile_time_error_test/01: MissingCompileTimeError
+mirrors/deferred_constraints_constants_test/default_argument2: MissingCompileTimeError
mirrors/generic_bounded_by_type_parameter_test/02: MissingCompileTimeError
mirrors/generic_bounded_test/01: MissingCompileTimeError
mirrors/generic_bounded_test/02: MissingCompileTimeError
@@ -95,6 +96,7 @@
isolate/spawn_uri_nested_vm_test: Pass, Timeout
isolate/static_function_test: Skip # Times out. Issue 31855. CompileTimeError. Issue 31402
mirrors/abstract_class_test: RuntimeError
+mirrors/apply3_test: RuntimeError
mirrors/class_declarations_test/01: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/class_declarations_test/none: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/class_mirror_location_test: RuntimeError
@@ -218,6 +220,7 @@
isolate/stacktrace_message_test: RuntimeError
mirrors/constructor_optional_args_test: RuntimeError
mirrors/constructors_test: RuntimeError
+mirrors/deferred_constraints_constants_test/default_argument2: Pass
mirrors/fake_function_with_call_test: RuntimeError
mirrors/generic_superclass_test/01: RuntimeError
mirrors/generic_superclass_test/none: RuntimeError
@@ -235,6 +238,7 @@
mirrors/operator_test: RuntimeError
mirrors/redirecting_factory_different_type_test/02: MissingCompileTimeError
mirrors/redirecting_factory_different_type_test/none: RuntimeError
+mirrors/redirecting_factory_reflection_test: RuntimeError
mirrors/regress_16321_test/none: Crash
mirrors/top_level_accessors_test/01: MissingCompileTimeError
diff --git a/tests/lib_2/mirrors/apply3_test.dart b/tests/lib_2/mirrors/apply3_test.dart
new file mode 100644
index 0000000..d96fa0d
--- /dev/null
+++ b/tests/lib_2/mirrors/apply3_test.dart
@@ -0,0 +1,69 @@
+// 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.
+
+// Test [Function.apply] on user-defined classes that implement [noSuchMethod].
+
+import "package:expect/expect.dart";
+import 'dart:mirrors';
+
+class F {
+ call([p1]) => "call";
+ noSuchMethod(Invocation invocation) => "NSM";
+}
+
+class G {
+ call() => '42';
+ noSuchMethod(Invocation invocation) => invocation;
+}
+
+class H {
+ call(required, {a}) => required + a;
+}
+
+main() {
+ Expect.equals('call', Function.apply(new F(), []));
+ Expect.equals('call', Function.apply(new F(), [1]));
+ Expect.equals('NSM', Function.apply(new F(), [1, 2]));
+ Expect.equals('NSM', Function.apply(new F(), [1, 2, 3]));
+
+ var symbol = const Symbol('a');
+ var requiredParameters = [1];
+ var optionalParameters = new Map<Symbol, int>()..[symbol] = 42;
+ Invocation i =
+ Function.apply(new G(), requiredParameters, optionalParameters);
+
+ Expect.equals(const Symbol('call'), i.memberName);
+ Expect.listEquals(requiredParameters, i.positionalArguments);
+ Expect.mapEquals(optionalParameters, i.namedArguments);
+ Expect.isTrue(i.isMethod);
+ Expect.isFalse(i.isGetter);
+ Expect.isFalse(i.isSetter);
+ Expect.isFalse(i.isAccessor);
+
+ // Check that changing the passed list and map for parameters does
+ // not affect [i].
+ requiredParameters[0] = 42;
+ optionalParameters[symbol] = 12;
+ Expect.listEquals([1], i.positionalArguments);
+ Expect.mapEquals(new Map()..[symbol] = 42, i.namedArguments);
+
+ // Check that using [i] for invocation yields the same [Invocation]
+ // object.
+ var mirror = reflect(new G());
+ Invocation other = mirror.delegate(i);
+ Expect.equals(i.memberName, other.memberName);
+ Expect.listEquals(i.positionalArguments, other.positionalArguments);
+ Expect.mapEquals(i.namedArguments, other.namedArguments);
+ Expect.equals(i.isMethod, other.isMethod);
+ Expect.equals(i.isGetter, other.isGetter);
+ Expect.equals(i.isSetter, other.isSetter);
+ Expect.equals(i.isAccessor, other.isAccessor);
+
+ // Test that [i] can be used to hit an existing method.
+ Expect.equals(43, new H().call(1, a: 42));
+ Expect.equals(43, Function.apply(new H(), [1], new Map()..[symbol] = 42));
+ mirror = reflect(new H());
+ Expect.equals(43, mirror.delegate(i));
+ Expect.equals(43, mirror.delegate(other));
+}
diff --git a/tests/lib_2/mirrors/const_evaluation_test.dart b/tests/lib_2/mirrors/const_evaluation_test.dart
new file mode 100644
index 0000000..be27133
--- /dev/null
+++ b/tests/lib_2/mirrors/const_evaluation_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2014, 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.
+
+// Check that compile-time evaluation of constants is consistent with runtime
+// evaluation.
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+const top_const = identical(-0.0, 0);
+
+@top_const
+class C {}
+
+void main() {
+ var local_var = identical(-0.0, 0);
+ var metadata = reflectClass(C).metadata[0].reflectee;
+ Expect.equals(top_const, metadata);
+ Expect.equals(local_var, metadata);
+}
diff --git a/tests/language_2/deferred_constraints_constants_lib.dart b/tests/lib_2/mirrors/deferred_constraints_constants_lib.dart
similarity index 100%
rename from tests/language_2/deferred_constraints_constants_lib.dart
rename to tests/lib_2/mirrors/deferred_constraints_constants_lib.dart
diff --git a/tests/language_2/deferred_constraints_constants_test.dart b/tests/lib_2/mirrors/deferred_constraints_constants_test.dart
similarity index 91%
rename from tests/language_2/deferred_constraints_constants_test.dart
rename to tests/lib_2/mirrors/deferred_constraints_constants_test.dart
index c975f51..053bb81 100644
--- a/tests/language_2/deferred_constraints_constants_test.dart
+++ b/tests/lib_2/mirrors/deferred_constraints_constants_test.dart
@@ -61,9 +61,9 @@
var h3 = new H3();
// Need to access the metadata to trigger the expected compilation error.
- reflectClass(H1).metadata; // metadata1: continued
- reflectClass(H2).metadata; // metadata2: continued
- reflectClass(H3).metadata; // metadata3: continued
+ reflectClass(H1).metadata; //# metadata1: continued
+ reflectClass(H2).metadata; //# metadata2: continued
+ reflectClass(H3).metadata; //# metadata3: continued
asyncEnd();
});
diff --git a/tests/language_2/enum_mirror_test.dart b/tests/lib_2/mirrors/enum_mirror_test.dart
similarity index 100%
rename from tests/language_2/enum_mirror_test.dart
rename to tests/lib_2/mirrors/enum_mirror_test.dart
diff --git a/tests/language_2/instance_creation_in_function_annotation_test.dart b/tests/lib_2/mirrors/instance_creation_in_function_annotation_test.dart
similarity index 100%
rename from tests/language_2/instance_creation_in_function_annotation_test.dart
rename to tests/lib_2/mirrors/instance_creation_in_function_annotation_test.dart
diff --git a/tests/language_2/invocation_mirror_invoke_on2_test.dart b/tests/lib_2/mirrors/invocation_mirror_invoke_on2_test.dart
similarity index 100%
rename from tests/language_2/invocation_mirror_invoke_on2_test.dart
rename to tests/lib_2/mirrors/invocation_mirror_invoke_on2_test.dart
diff --git a/tests/language_2/invocation_mirror_invoke_on_test.dart b/tests/lib_2/mirrors/invocation_mirror_invoke_on_test.dart
similarity index 100%
rename from tests/language_2/invocation_mirror_invoke_on_test.dart
rename to tests/lib_2/mirrors/invocation_mirror_invoke_on_test.dart
diff --git a/tests/language_2/issue21079_test.dart b/tests/lib_2/mirrors/issue21079_test.dart
similarity index 100%
rename from tests/language_2/issue21079_test.dart
rename to tests/lib_2/mirrors/issue21079_test.dart
diff --git a/tests/lib_2/mirrors/null_test.dart b/tests/lib_2/mirrors/null_test.dart
index a194656..de6b459 100644
--- a/tests/lib_2/mirrors/null_test.dart
+++ b/tests/lib_2/mirrors/null_test.dart
@@ -2,13 +2,31 @@
// 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.
-library test.null_test;
+// VMOptions=--optimization-counter-threshold=5
-import 'dart:mirrors';
+import "dart:mirrors";
+import "package:expect/expect.dart";
-import 'package:expect/expect.dart';
+void main() {
+ for (int i = 0; i < 10; i++) {
+ test();
+ }
+}
-main() {
+void test() {
+ ClassMirror cm = reflectClass(Null);
+
+ InstanceMirror im1 = reflect(null);
+ Expect.equals(cm, im1.type);
+ Expect.isTrue(im1.invoke(const Symbol("=="), [null]).reflectee);
+ Expect.isFalse(im1.invoke(const Symbol("=="), [42]).reflectee);
+
+ var obj = confuse(null); // Null value that isn't known at compile-time.
+ InstanceMirror im2 = reflect(obj);
+ Expect.equals(cm, im2.type);
+ Expect.isTrue(im2.invoke(const Symbol("=="), [null]).reflectee);
+ Expect.isFalse(im2.invoke(const Symbol("=="), [42]).reflectee);
+
InstanceMirror nullMirror = reflect(null);
Expect.isTrue(nullMirror.getField(#hashCode).reflectee is int);
Expect.equals(null.hashCode, nullMirror.getField(#hashCode).reflectee);
@@ -16,8 +34,8 @@
Expect.isTrue(nullMirror.invoke(#==, [null]).reflectee);
Expect.isFalse(nullMirror.invoke(#==, [new Object()]).reflectee);
Expect.equals('null', nullMirror.invoke(#toString, []).reflectee);
- Expect.throwsNoSuchMethodError(() => nullMirror.invoke(#notDefined, []),
- 'noSuchMethod');
+ Expect.throwsNoSuchMethodError(
+ () => nullMirror.invoke(#notDefined, []), 'noSuchMethod');
ClassMirror NullMirror = nullMirror.type;
Expect.equals(reflectClass(Null), NullMirror);
@@ -38,3 +56,16 @@
}
Expect.equals(coreLibrary, NullMirror.owner);
}
+
+// Magic incantation to avoid the compiler recognizing the constant values
+// at compile time. If the result is computed at compile time, the dynamic code
+// will not be tested.
+confuse(x) {
+ try {
+ if (new DateTime.now().millisecondsSinceEpoch == 42) x = 42;
+ throw [x];
+ } on dynamic catch (e) {
+ return e[0];
+ }
+ return 42;
+}
diff --git a/tests/language_2/redirecting_factory_reflection_test.dart b/tests/lib_2/mirrors/redirecting_factory_reflection_test.dart
similarity index 100%
rename from tests/language_2/redirecting_factory_reflection_test.dart
rename to tests/lib_2/mirrors/redirecting_factory_reflection_test.dart
diff --git a/tests/language_2/regress_13462_0_test.dart b/tests/lib_2/mirrors/regress_13462_0_test.dart
similarity index 100%
rename from tests/language_2/regress_13462_0_test.dart
rename to tests/lib_2/mirrors/regress_13462_0_test.dart
diff --git a/tests/language_2/regress_13462_1_test.dart b/tests/lib_2/mirrors/regress_13462_1_test.dart
similarity index 100%
rename from tests/language_2/regress_13462_1_test.dart
rename to tests/lib_2/mirrors/regress_13462_1_test.dart
diff --git a/tests/language_2/regress_18535_test.dart b/tests/lib_2/mirrors/regress_18535_test.dart
similarity index 100%
rename from tests/language_2/regress_18535_test.dart
rename to tests/lib_2/mirrors/regress_18535_test.dart
diff --git a/tests/language_2/regress_28255_test.dart b/tests/lib_2/mirrors/regress_28255_test.dart
similarity index 100%
rename from tests/language_2/regress_28255_test.dart
rename to tests/lib_2/mirrors/regress_28255_test.dart
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 0b5b805..4bc4061 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -135,6 +135,7 @@
List<String> vmOptions,
List<String> sharedOptions,
List<String> dart2jsOptions,
+ List<String> ddcOptions,
List<String> args) {
return sharedOptions.toList()..addAll(args);
}
@@ -350,7 +351,7 @@
}
List<String> computeCompilerArguments(
- vmOptions, sharedOptions, dart2jsOptions, args) {
+ vmOptions, sharedOptions, dart2jsOptions, ddcOptions, args) {
// The result will be passed as an input to [extractArguments]
// (i.e. the arguments to the [PipelineCommand]).
return <String>[]..addAll(vmOptions)..addAll(sharedOptions)..addAll(args);
@@ -446,6 +447,7 @@
List<String> vmOptions,
List<String> sharedOptions,
List<String> dart2jsOptions,
+ List<String> ddcOptions,
List<String> args) {
return <String>[]
..addAll(sharedOptions)
@@ -493,8 +495,9 @@
List<String> vmOptions,
List<String> sharedOptions,
List<String> dart2jsOptions,
+ List<String> ddcOptions,
List<String> args) {
- var result = sharedOptions.toList();
+ var result = sharedOptions.toList()..addAll(ddcOptions);
// The file being compiled is the last argument.
result.add(args.last);
@@ -580,8 +583,9 @@
List<String> vmOptions,
List<String> sharedOptions,
List<String> dart2jsOptions,
+ List<String> ddcOptions,
List<String> args) {
- var result = sharedOptions.toList();
+ var result = sharedOptions.toList()..addAll(ddcOptions);
// The file being compiled is the last argument.
result.add(args.last);
@@ -863,7 +867,7 @@
}
List<String> computeCompilerArguments(
- vmOptions, sharedOptions, dart2jsOptions, originalArguments) {
+ vmOptions, sharedOptions, dart2jsOptions, ddcOptions, originalArguments) {
List<String> args = [];
if (_isChecked) {
args.add('--enable_asserts');
@@ -939,7 +943,7 @@
}
List<String> computeCompilerArguments(
- vmOptions, sharedOptions, dart2jsOptions, originalArguments) {
+ vmOptions, sharedOptions, dart2jsOptions, ddcOptions, originalArguments) {
var args = <String>[];
if (_isChecked) {
args.add('--enable_asserts');
@@ -1194,6 +1198,7 @@
List<String> vmOptions,
List<String> sharedOptions,
List<String> dart2jsOptions,
+ List<String> ddcOptions,
List<String> args) {
var arguments = <String>[];
for (var argument in args) {
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 479c94f..8260858 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -883,12 +883,13 @@
var compilerConfiguration = configuration.compilerConfiguration;
var sharedOptions = info.optionsFromFile['sharedOptions'] as List<String>;
var dart2jsOptions = info.optionsFromFile['dart2jsOptions'] as List<String>;
+ var ddcOptions = info.optionsFromFile['ddcOptions'] as List<String>;
var compileTimeArguments = <String>[];
String tempDir;
if (compilerConfiguration.hasCompiler) {
compileTimeArguments = compilerConfiguration.computeCompilerArguments(
- vmOptions, sharedOptions, dart2jsOptions, args);
+ vmOptions, sharedOptions, dart2jsOptions, ddcOptions, args);
// Avoid doing this for analyzer.
var path = info.filePath;
if (vmOptionsVariant != 0) {
@@ -1460,6 +1461,7 @@
List<String> dartOptions;
List<String> sharedOptions;
List<String> dart2jsOptions;
+ List<String> ddcOptions;
Map<String, String> environment;
String packageRoot;
String packages;
@@ -1489,6 +1491,7 @@
dartOptions = singleListOfOptions('DartOptions');
sharedOptions = singleListOfOptions('SharedOptions');
dart2jsOptions = singleListOfOptions('dart2jsOptions');
+ ddcOptions = singleListOfOptions('dartdevcOptions');
matches = environmentRegExp.allMatches(contents);
for (var match in matches) {
@@ -1587,6 +1590,7 @@
"vmOptions": result,
"sharedOptions": sharedOptions ?? <String>[],
"dart2jsOptions": dart2jsOptions ?? <String>[],
+ "ddcOptions": ddcOptions ?? <String>[],
"dartOptions": dartOptions,
"environment": environment,
"packageRoot": packageRoot,