diff --git a/tests/compiler/dart2js_extra/11673_test.dart b/tests/compiler/dart2js_extra/11673_test.dart index 1d7e6678d61..47aa4165e40 100644 --- a/tests/compiler/dart2js_extra/11673_test.dart +++ b/tests/compiler/dart2js_extra/11673_test.dart @@ -20,7 +20,7 @@ class I8 extends TD with M implements JSIB {} use(x) { if (x is JSIB) { // Should be able to find M.foo since I8 is a subtype of both JSIB and M. - Expect.equals(123, x.foo()); + Expect.equals(123, (x as dynamic).foo()); } } diff --git a/tests/compiler/dart2js_extra/19191_test.dart b/tests/compiler/dart2js_extra/19191_test.dart index 7e628fd990f..cf2bd24d433 100644 --- a/tests/compiler/dart2js_extra/19191_test.dart +++ b/tests/compiler/dart2js_extra/19191_test.dart @@ -21,20 +21,12 @@ class A { invocation.positionalArguments, invocation.namedArguments); } } - - init() { - closure_fails = (String str) { - return str.toUpperCase(); - }; - } - - run() { - print(closure_fails("Hello World")); - } } void main() { - var a = new A(); - a.init(); - a.run(); + dynamic a = new A(); + a.closure_fails = (String str) { + return str.toUpperCase(); + }; + print(a.closure_fails("Hello World")); } diff --git a/tests/compiler/dart2js_extra/21166_test.dart b/tests/compiler/dart2js_extra/21166_test.dart deleted file mode 100644 index b060c1fdb57..00000000000 --- a/tests/compiler/dart2js_extra/21166_test.dart +++ /dev/null @@ -1,24 +0,0 @@ -// 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. - -// Regression test for http://dartbug.com/21166/ -// Fails when compiling with --checked. - -var a = []; - -void doStuff() { - if (a.length) { - // This triggers a TypeConversion to bool in checked mode. - var element = a[0]; // This triggers a bounds check but a.length will have - a.remove(element); // type [empty]. - } -} - -main() { - a.add(1); - a.add(2); - try { - doStuff(); // This is expected to fail but not crash the compiler. - } catch (_) {} -} diff --git a/tests/compiler/dart2js_extra/21666_test.dart b/tests/compiler/dart2js_extra/21666_test.dart deleted file mode 100644 index 857b0e34cb2..00000000000 --- a/tests/compiler/dart2js_extra/21666_test.dart +++ /dev/null @@ -1,90 +0,0 @@ -// 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. - -// Regression test for issue 21666 - problems with method that has super calls. -// -// Use a method and getter with super calls in various ways. - -import 'package:expect/expect.dart'; - -@MirrorsUsed(targets: const [A, B, Object]) -import 'dart:mirrors'; - -class X { - const X(); -} - -class Y { - const Y(); -} - -typedef fInt(int x); -typedef fString(String x); - -class A { - @X() - foo(int x) => x + 1; - int get bar => A.g; - - static int g = 0; -} - -class B extends A { - @Y() - foo(int x) => 100 * super.foo(x); - int get bar => 1000 * super.bar; -} - -String dump(ClassMirror cm) { - var sb = new StringBuffer(); - sb.write('$cm\n'); - for (var mm in cm.declarations.values) { - sb.write(' $mm\n'); - // Walking declaration metadata triggers issue 21666. - for (var a in mm.metadata) { - sb.write(' $a\n'); - } - } - print(sb); - return '$sb'; -} - -main() { - var cmB = reflectClass(B); - var cmBdump = dump(cmB); - var cmAdump = dump(cmB.superclass); - - Expect.equals(dump(reflectClass(A)), cmAdump); - Expect.isTrue(cmAdump.contains("'foo'")); - Expect.isTrue(cmAdump.contains("'bar'")); - Expect.isTrue(cmBdump.contains("'foo'")); - Expect.isTrue(cmBdump.contains("'bar'")); - - A.g = 123; - var a = new A(); - var am = reflect(a); - var agfoo = am.getField(#foo); - var agbar = am.getField(#bar); - - Expect.equals(3, agfoo.reflectee(2)); - Expect.equals(4, am.invoke(#foo, [3]).reflectee); - Expect.equals(123, agbar.reflectee); - Expect.isTrue(a.foo is fInt); - Expect.isTrue(a.foo is! fString); - Expect.isTrue(agfoo.reflectee is fInt); - Expect.isTrue(agfoo.reflectee is! fString); - - var b = new B(); - var bm = reflect(b); - var bgfoo = bm.getField(#foo); - var bgbar = bm.getField(#bar); - - Expect.equals(300, bgfoo.reflectee(2)); - Expect.equals(400, bm.invoke(#foo, [3]).reflectee); - Expect.equals(123000, bgbar.reflectee); - Expect.isTrue(b.foo is fInt); - Expect.isTrue(b.foo is! fString); - Expect.isTrue(bgfoo.reflectee is fInt); - Expect.isTrue(bgfoo.reflectee is! fString); -} diff --git a/tests/compiler/dart2js_extra/21724_test.dart b/tests/compiler/dart2js_extra/21724_test.dart deleted file mode 100644 index eff9690b812..00000000000 --- a/tests/compiler/dart2js_extra/21724_test.dart +++ /dev/null @@ -1,12 +0,0 @@ -// 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. - -// Regression test for issue 21724 - invalid call to local closure - -main() { - foo(x) {} - try { - foo(); - } catch (_) {} -} diff --git a/tests/compiler/dart2js_extra/23056_test.dart b/tests/compiler/dart2js_extra/23056_test.dart deleted file mode 100644 index a30e4ee62bf..00000000000 --- a/tests/compiler/dart2js_extra/23056_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// 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. - -// Regression test for http://dartbug.com/23056/ -// Ensure that Mixin prototypes are initialized before first use. - -// Mirrors is the only way to have a getter be equipped with metadata. -@MirrorsUsed(targets: 'M', override: '*') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -class M { - @NoInline() - bool get foo => true; -} - -class A extends Object with M { - @NoInline() - bool get foo => super.foo; -} - -@AssumeDynamic() -@NoInline() -bool hide(bool x) => x; - -main() { - Expect.isTrue((hide(true) ? new A() : new M()).foo); -} diff --git a/tests/compiler/dart2js_extra/23432_test.dart b/tests/compiler/dart2js_extra/23432_test.dart index b0fc3d9141e..2333edb9d64 100644 --- a/tests/compiler/dart2js_extra/23432_test.dart +++ b/tests/compiler/dart2js_extra/23432_test.dart @@ -20,7 +20,7 @@ class N { get NEVER => false; main() { - var c = 12345; + dynamic c = 12345; if (NEVER) c = new N(); var e; try { diff --git a/tests/compiler/dart2js_extra/23804_test.dart b/tests/compiler/dart2js_extra/23804_test.dart index 2fad1d5aea7..fbcf96524da 100644 --- a/tests/compiler/dart2js_extra/23804_test.dart +++ b/tests/compiler/dart2js_extra/23804_test.dart @@ -9,7 +9,7 @@ import 'package:expect/expect.dart'; test(n) => n == 1; -run(f) => f(1); +bool run(f(dynamic)) => f(1); main() { Expect.equals([test].any(run), true); } diff --git a/tests/compiler/dart2js_extra/27199_test.dart b/tests/compiler/dart2js_extra/27199_test.dart index 485bf3ad7de..2c477fddd06 100644 --- a/tests/compiler/dart2js_extra/27199_test.dart +++ b/tests/compiler/dart2js_extra/27199_test.dart @@ -21,8 +21,8 @@ class C { confuse(x) => x; main() { - var c = new C(); - var a = 12; + dynamic c = new C(); + dynamic a = 12; if (confuse(true)) a = {}; c.f = a; } diff --git a/tests/compiler/dart2js_extra/28749_test.dart b/tests/compiler/dart2js_extra/28749_test.dart index b75dd271a37..ca4d3bf8bb2 100644 --- a/tests/compiler/dart2js_extra/28749_test.dart +++ b/tests/compiler/dart2js_extra/28749_test.dart @@ -2,6 +2,8 @@ // 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. +// dart2jsOptions=--strong + // Regression test for http://dartbug.com/28749. // // This would crash at compile time because inner typedefs remain after calling @@ -47,11 +49,11 @@ void main() { ); Expect.equals( - 'Wrap<(int) => ((dynamic) => void) => (dynamic) => void>', + 'Wrap<(int) => ((int) => void) => (int) => void>', '${foo(0)}', ); Expect.equals( - 'Wrap<(int) => ((dynamic) => void) => (dynamic) => void>', + 'Wrap<(int) => ((String) => void) => (String) => void>', '${foo(1)}', ); } diff --git a/tests/compiler/dart2js_extra/assert_with_message_test.dart b/tests/compiler/dart2js_extra/assert_with_message_test.dart index 9d2fa14862e..e860713aef4 100644 --- a/tests/compiler/dart2js_extra/assert_with_message_test.dart +++ b/tests/compiler/dart2js_extra/assert_with_message_test.dart @@ -26,23 +26,11 @@ test1() { } test2() { - testFalse('constant function', () { - assert(() => false, 'Mumble'); - }); -} - -test3() { testFalse('variable false', () { assert(confuse(false), 'Mumble'); }); } -test4() { - testFalse('variable function', () { - assert(confuse(() => false), 'Mumble'); - }); -} - testTypeErrors() { check(name, fault) { try { @@ -101,19 +89,17 @@ testMessageEffect3() { Expect.fail('Expected assert to throw'); } -bool get checkedMode { +bool get assertionsEnabled { bool b = false; assert((b = true)); return b; } main() { - if (!checkedMode) return; + if (!assertionsEnabled) return; test1(); test2(); - test3(); - test4(); testTypeErrors(); testMessageEffect1(); testMessageEffect2(); diff --git a/tests/compiler/dart2js_extra/async_stacktrace_test.dart b/tests/compiler/dart2js_extra/async_stacktrace_test.dart index 687222fd45e..947e2d6e5f4 100644 --- a/tests/compiler/dart2js_extra/async_stacktrace_test.dart +++ b/tests/compiler/dart2js_extra/async_stacktrace_test.dart @@ -26,7 +26,7 @@ class Tracer { } } -test1(Tracer tracer) { +Future test1(Tracer tracer) { foo() async* /// asyncStar: ok @@ -56,7 +56,7 @@ test1(Tracer tracer) { ; } -test2(Tracer tracer) { +Future test2(Tracer tracer) { var savedStackTrace; foo() async* @@ -83,7 +83,7 @@ test2(Tracer tracer) { }); } -test3(Tracer tracer) { +Future test3(Tracer tracer) { var savedStackTrace; foo() async* diff --git a/tests/compiler/dart2js_extra/basic_class_test.dart b/tests/compiler/dart2js_extra/basic_class_test.dart deleted file mode 100644 index bd6804a57d1..00000000000 --- a/tests/compiler/dart2js_extra/basic_class_test.dart +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2011, 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. - -class A {} - -class SubA extends A {} - -class B {} - -void main() { - A a; - SubA subA; - B b; - a = a; - a = subA; - a = b; //# 01: static type warning - subA = a; - subA = subA; - subA = b; //# 02: static type warning - b = a; //# 03: static type warning - b = subA; //# 04: static type warning - b = b; -} diff --git a/tests/compiler/dart2js_extra/checked_accessor_test.dart b/tests/compiler/dart2js_extra/checked_accessor_test.dart deleted file mode 100644 index b67f17ab8c1..00000000000 --- a/tests/compiler/dart2js_extra/checked_accessor_test.dart +++ /dev/null @@ -1,25 +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 "package:expect/expect.dart"; - -class E { - missingType field; -} - -class WithGetter { - String field; -} - -void main() { - f(x) { - x.field = true; - } - - Expect.throws(() { - [new E(), new WithGetter()].forEach(f); - new missingType(); - new E().field = 'a string'; - }); -} diff --git a/tests/compiler/dart2js_extra/closure_type_reflection2_test.dart b/tests/compiler/dart2js_extra/closure_type_reflection2_test.dart deleted file mode 100644 index 398dab51784..00000000000 --- a/tests/compiler/dart2js_extra/closure_type_reflection2_test.dart +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -// Test that classes referenced from a signature of a tear-off closure -// are emitted. - -@MirrorsUsed(targets: 'C') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -class A {} - -class C { - A foo() {} -} - -main() { - Expect.isFalse( - reflect(new C().foo).function.returnType.toString().contains('dynamic')); -} diff --git a/tests/compiler/dart2js_extra/closure_type_reflection_test.dart b/tests/compiler/dart2js_extra/closure_type_reflection_test.dart deleted file mode 100644 index 8acb4c01e47..00000000000 --- a/tests/compiler/dart2js_extra/closure_type_reflection_test.dart +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -// Test that classes referenced from a signature of a tear-off closure -// are emitted. - -@MirrorsUsed(targets: 'C', symbols: 'A') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -class A {} - -class C { - A foo() {} -} - -main() { - Expect.equals("ClassMirror on 'A'", - reflect(new C().foo).function.returnType.toString()); -} diff --git a/tests/compiler/dart2js_extra/consistent_add_error_test.dart b/tests/compiler/dart2js_extra/consistent_add_error_test.dart index 07960858e3d..79f18f9ccca 100644 --- a/tests/compiler/dart2js_extra/consistent_add_error_test.dart +++ b/tests/compiler/dart2js_extra/consistent_add_error_test.dart @@ -126,21 +126,8 @@ class IntPlusString { return (confuse(1) as int) + confuse('a'); } - static f5() { - return (confuse(1) as int) + 'a'; - } - - static f6() { - var a = confuse(true) ? 1 : 2; // Small int with unknown value. - return a + 'a'; - } - - static f7() { - return 1 + 'a'; - } - static test() { - check('IntPlusString', f1, f2, f3, f4, f5, f6, f7); + check('IntPlusString', f1, f2, f3, f4); } } @@ -158,25 +145,12 @@ class StringPlusInt { } static f4() { - return (confuse('a') as String) + 1; - } - - static f5() { var a = confuse(true) ? 'a' : 'bc'; return a + confuse(1); } - static f6() { - var a = confuse(true) ? 'a' : 'bc'; - return a + 1; - } - - static f7() { - return 'a' + 1; - } - static test() { - check('StringPlusInt', f1, f2, f3, f4, f5, f6, f7); + check('StringPlusInt', f1, f2, f3, f4); } } diff --git a/tests/compiler/dart2js_extra/consistent_codeUnitAt_error_test.dart b/tests/compiler/dart2js_extra/consistent_codeUnitAt_error_test.dart index 0787ab34d43..d76bd71f42e 100644 --- a/tests/compiler/dart2js_extra/consistent_codeUnitAt_error_test.dart +++ b/tests/compiler/dart2js_extra/consistent_codeUnitAt_error_test.dart @@ -116,7 +116,7 @@ class BadType { static f3() { var a = confuse(true) ? 'AB' : 'ABCDE'; // String with unknown length. - return a.codeUnitAt('a'); + return a.codeUnitAt(('a' as dynamic)); } static test() { diff --git a/tests/compiler/dart2js_extra/consistent_subtract_error_test.dart b/tests/compiler/dart2js_extra/consistent_subtract_error_test.dart index ed396916ae3..2c839f7991c 100644 --- a/tests/compiler/dart2js_extra/consistent_subtract_error_test.dart +++ b/tests/compiler/dart2js_extra/consistent_subtract_error_test.dart @@ -2,6 +2,8 @@ // 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. +/// dart2jsOptions=--omit-implicit-checks + import "package:expect/expect.dart"; // Test that optimized '-' and slow path '-' produce the same error. @@ -90,21 +92,8 @@ class IntMinusString { return (confuse(1) as int) - confuse('a'); } - static f5() { - return (confuse(1) as int) - 'a'; - } - - static f6() { - var a = confuse(true) ? 1 : 2; // Small int with unknown value. - return a - 'a'; - } - - static f7() { - return 1 - 'a'; - } - static test() { - check('IntMinusString', f1, f2, f3, f4, f5, f6, f7); + check('IntMinusString', f1, f2, f3, f4); } } diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status index 0328d9ebca1..f270ced358c 100644 --- a/tests/compiler/dart2js_extra/dart2js_extra.status +++ b/tests/compiler/dart2js_extra/dart2js_extra.status @@ -8,8 +8,6 @@ bounds_check4b_test: RuntimeError # Issue 32741 class_test: Fail constant_javascript_semantics4_test: Fail, OK generic_class_is_test: Fail # Issue 32004 -mirror_printer_test: Pass, Slow # Issue 25940, 16473 -mirrors_used_closure_test: Fail # Issue 17939 no_such_method_test: Fail # Wrong Invocation.memberName. statements_test: Fail typed_locals_test: Pass, Fail @@ -40,9 +38,6 @@ deferred_split_test: Pass, Slow # Issue 25940 [ $compiler == dart2js && $runtime == chrome && $csp ] deferred/load_in_correct_order_test: SkipByDesign # Purposely uses `eval` -[ $compiler == dart2js && $runtime == chromeOnAndroid ] -no_such_method_mirrors_test: Pass, Slow # TODO(kasperl): Please triage. - [ $compiler == dart2js && $runtime == d8 && $fasta ] deferred_fail_and_retry_test: RuntimeError # Uses XHR in dart:html deferred_with_csp_nonce_test: RuntimeError # Uses dart:html @@ -54,21 +49,10 @@ consistent_index_error_string_test: Pass, Slow # Issue 25940 [ $compiler == dart2js && $runtime == none ] *: Fail, Pass # TODO(ahe): Triage these tests. -[ $compiler == dart2js && $checked ] -variable_type_test/01: Fail, OK -variable_type_test/03: Fail, OK - [ $compiler == dart2js && $checked && $fasta ] -deferred/deferred_mirrors1_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary -deferred/deferred_mirrors2_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary -deferred/reflect_multiple_annotations_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary -deferred/reflect_multiple_default_arg_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary dummy_compiler_test: Crash local_signature_test: Crash minus_zero_test/01: MissingCompileTimeError -mirrors_used_warning2_test: Crash -mirrors_used_warning_test/minif: Crash -mirrors_used_warning_test/none: Crash [ $compiler == dart2js && $csp ] deferred_custom_loader_test: SkipByDesign # Issue 25683 @@ -76,94 +60,18 @@ deferred_fail_and_retry_test: SkipByDesign # Uses eval to simulate failed loadin js_interop_optional_arg_test: RuntimeError # Issue 31082 js_interop_test: RuntimeError # Issue 31082 -[ $compiler == dart2js && $fast_startup ] -21666_test: Fail # mirrors not supported -23056_test: Fail # mirrors not supported -closure_type_reflection2_test: Fail # mirrors not supported -closure_type_reflection_test: Fail # mirrors not supported -deferred/deferred_mirrors1_lib: Fail # mirrors not supported -deferred/deferred_mirrors1_test: Fail # mirrors not supported -deferred/deferred_mirrors2_lazy: Fail # mirrors not supported -deferred/deferred_mirrors2_lib3: Fail # mirrors not supported -deferred/deferred_mirrors2_test: Fail # mirrors not supported -deferred/reflect_multiple_annotations_test: CompileTimeError # mirrors not supported -deferred/reflect_multiple_default_arg_test: CompileTimeError # mirrors not supported -inference_nsm_mirrors_test: Fail # mirrors not supported -invalid_annotation2_test/01: Pass # mirrors not supported, passes for the wrong reason -invalid_annotation2_test/none: Fail # mirrors not supported -mirror_enqueuer_regression_test: Fail # mirrors not supported -mirror_invalid_field_access2_test: Fail # mirrors not supported -mirror_invalid_field_access3_test: Fail # mirrors not supported -mirror_invalid_field_access4_test: Fail # mirrors not supported -mirror_invalid_field_access_test: Fail # mirrors not supported -mirror_invalid_invoke2_test: Fail # mirrors not supported -mirror_invalid_invoke3_test: Fail # mirrors not supported -mirror_invalid_invoke_test: Fail # mirrors not supported -mirror_printer_test: Fail # mirrors not supported -mirror_test: Fail # mirrors not supported -mirror_type_inference_field2_test: Fail # mirrors not supported -mirror_type_inference_field_test: Fail # mirrors not supported -mirror_type_inference_function_test: Fail # mirrors not supported -mirrors_declarations_filtering_test: Fail # mirrors not supported -mirrors_used_closure_test: SkipByDesign -mirrors_used_metatargets_test: Fail # mirrors not supported -mirrors_used_native_test: Fail # mirrors not supported -mirrors_used_warning2_test: Fail # mirrors not supported -mirrors_used_warning_test: Fail # mirrors not supported -no_such_method_mirrors_test: Fail # mirrors not supported -reflect_native_types_test: Fail # mirrors not supported - -[ $compiler == dart2js && $fast_startup && $fasta ] -23056_test: Pass -deferred/deferred_mirrors1_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary -deferred/deferred_mirrors2_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary -deferred/reflect_multiple_annotations_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary -deferred/reflect_multiple_default_arg_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary -mirror_enqueuer_regression_test: Pass - [ $compiler == dart2js && $fasta ] -21666_test: RuntimeError 23264_test: RuntimeError closure_capture2_test: RuntimeError -closure_type_reflection2_test: RuntimeError -closure_type_reflection_test: RuntimeError constant_javascript_semantics_test/03: CompileTimeError constant_javascript_semantics_test/04: CompileTimeError constant_javascript_semantics_test/none: CompileTimeError -deferred/deferred_mirrors1_test: SkipByDesign -deferred/deferred_mirrors2_test: RuntimeError -deferred/reflect_multiple_annotations_test: RuntimeError -deferred/reflect_multiple_default_arg_test: RuntimeError -inference_nsm_mirrors_test: SkipByDesign -invalid_annotation2_test/none: RuntimeError -mirror_invalid_field_access2_test: RuntimeError -mirror_invalid_field_access3_test: RuntimeError -mirror_invalid_field_access4_test: RuntimeError -mirror_invalid_field_access_test: RuntimeError -mirror_invalid_invoke2_test: RuntimeError -mirror_invalid_invoke3_test: RuntimeError -mirror_invalid_invoke_test: RuntimeError -mirror_printer_test/01: RuntimeError -mirror_printer_test/none: RuntimeError -mirror_test: RuntimeError -mirror_type_inference_field2_test: RuntimeError -mirror_type_inference_field_test: RuntimeError -mirror_type_inference_function_test: RuntimeError -mirrors_declarations_filtering_test: RuntimeError -mirrors_used_closure_test: SkipByDesign -mirrors_used_metatargets_test: RuntimeError -mirrors_used_native_test: RuntimeError -mirrors_used_warning2_test: RuntimeError -mirrors_used_warning_test/minif: RuntimeError -mirrors_used_warning_test/none: RuntimeError -no_such_method_mirrors_test: SkipByDesign private_symbol_literal_test/01: MissingCompileTimeError private_symbol_literal_test/02: MissingCompileTimeError private_symbol_literal_test/03: MissingCompileTimeError private_symbol_literal_test/04: MissingCompileTimeError private_symbol_literal_test/05: MissingCompileTimeError private_symbol_literal_test/06: MissingCompileTimeError -reflect_native_types_test: RuntimeError regress/4562_test/none: CompileTimeError round_constant_folding_test: CompileTimeError type_constant_switch_test/01: MissingCompileTimeError @@ -198,7 +106,10 @@ extract_type_arguments_3_test: RuntimeError # Uses function type variables generic_method_dynamic_is_test: RuntimeError # Test against function type variables is only supported in strong mode. generic_method_dynamic_type_test: SkipByDesign # Requires strong mode support for function type variables. generic_method_static_is_test: RuntimeError # Test against function type variables is only supported in strong mode. +int_index_test/01: MissingCompileTimeError +int_index_test/02: MissingCompileTimeError local_signature_test: RuntimeError # Test against function type variables is only supported in strong mode. +switch_test/00: MissingCompileTimeError [ $compiler == dart2js && ($runtime == chrome || $runtime == chromeOnAndroid || $runtime == drt || $runtime == ff || $runtime == safari) ] isolate2_test/01: Fail # Issue 14458. diff --git a/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart index 22ab8ba5ffb..eb6c8368dff 100644 --- a/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart +++ b/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart @@ -9,7 +9,7 @@ import 'dart:async'; import 'deferred_class_library.dart' deferred as lib; -isError(e) => e is Error; +bool isError(e) => e is Error; main() { var x; diff --git a/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart index 27d780acfc4..88fcbaf6690 100644 --- a/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart +++ b/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart @@ -10,7 +10,7 @@ import 'package:expect/expect.dart'; import 'deferred_function_library.dart' deferred as lib; -isError(e) => e is Error; +bool isError(e) => e is Error; readFoo() { return lib.foo; diff --git a/tests/compiler/dart2js_extra/deferred/deferred_mirrors1_lib.dart b/tests/compiler/dart2js_extra/deferred/deferred_mirrors1_lib.dart deleted file mode 100644 index 92b9ede660c..00000000000 --- a/tests/compiler/dart2js_extra/deferred/deferred_mirrors1_lib.dart +++ /dev/null @@ -1,11 +0,0 @@ -// 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. - -import 'dart:typed_data'; -import 'dart:mirrors'; - -foo() { - var m = reflect(499); - return m.reflectee; -} diff --git a/tests/compiler/dart2js_extra/deferred/deferred_mirrors1_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_mirrors1_test.dart deleted file mode 100644 index 10ed593e24e..00000000000 --- a/tests/compiler/dart2js_extra/deferred/deferred_mirrors1_test.dart +++ /dev/null @@ -1,28 +0,0 @@ -// 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. - -import 'package:async_helper/async_helper.dart'; -import 'package:expect/expect.dart'; - -@MirrorsUsed(override: '*') -import 'dart:mirrors'; - -import 'deferred_mirrors1_lib.dart' deferred as lazy; - -main() { - asyncStart(); - - // The deferred library uses mirrors and has an unused import of typed_data. - // Dart2js must not crash on this test. - // - // Dart2js used to crash because: - // - the NativeInt8List was dragged in. - // - but not its constructors and the constructors' dependencies. - // - one of the dependencies (a local function "_ensureNativeList") was - // not handled by the deferred-loader. - lazy.loadLibrary().then((_) { - Expect.equals(499, lazy.foo()); - asyncEnd(); - }); -} diff --git a/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_lazy.dart b/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_lazy.dart deleted file mode 100644 index 9bfdee8b54e..00000000000 --- a/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_lazy.dart +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -library lazy; - -import 'deferred_mirrors2_lib3.dart'; - -@MirrorsUsed(metaTargets: const [Reflectable], override: 'lazy') -import 'dart:mirrors'; - -class Reflectable { - const Reflectable(); -} diff --git a/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_lib3.dart b/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_lib3.dart deleted file mode 100644 index abbd6d07d11..00000000000 --- a/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_lib3.dart +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -library lib3; - -import 'deferred_mirrors2_lib4.dart'; - -@MirrorsUsed(targets: const ['lib3']) -import 'dart:mirrors'; - -class R { - void bind(Type type) { - ClassMirror classMirror = _reflectClass(type); - MethodMirror ctor = classMirror.declarations[classMirror.simpleName]; - int length = ctor.parameters.length; - Function create = classMirror.newInstance; - } -} diff --git a/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_test.dart deleted file mode 100644 index 195c8264f79..00000000000 --- a/tests/compiler/dart2js_extra/deferred/deferred_mirrors2_test.dart +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -import 'package:async_helper/async_helper.dart'; -import 'package:expect/expect.dart'; - -@MirrorsUsed(override: '*') -import 'dart:mirrors'; - -import 'deferred_mirrors2_lib2.dart'; - -foo() { - ClassMirror classMirror = reflectType(int); - Expect.isTrue(classMirror.isTopLevel); -} - -// This is a minimal test extracted from a bug-report we got. -main() { - foo(); -} diff --git a/tests/compiler/dart2js_extra/deferred/multiple_default_arg_test.dart b/tests/compiler/dart2js_extra/deferred/multiple_default_arg_test.dart index 8d6060007bd..37681b98998 100644 --- a/tests/compiler/dart2js_extra/deferred/multiple_default_arg_test.dart +++ b/tests/compiler/dart2js_extra/deferred/multiple_default_arg_test.dart @@ -7,12 +7,8 @@ /// fragments is kept separate, but that when they are loaded (and the metadata /// array is merged) all accesses to the metadata array is done correctly. /// -/// This kind of metadata is generated either when using Function.apply (to -/// store default values and parameter names) or when using dart:mirrors -/// (annotations and unmangled names also need to be stored). -/// -/// This test covers uses of default values and parameter names via -/// Function.apply. +/// This kind of metadata is generated when using Function.apply to +/// store default values and parameter names. import 'multiple_default_arg_lib1.dart' deferred as lib1; import 'multiple_default_arg_lib2.dart' deferred as lib2; import 'multiple_default_arg_lib3.dart' deferred as lib3; @@ -35,8 +31,8 @@ main() { await lib3.loadLibrary(); Expect.equals( - Function - .apply(lib3.myFunction3, ["x", "y"], {#argumentName4: () => "C"}), + Function.apply( + lib3.myFunction3, ["x", "y"], {#argumentName4: () => "C"}), "x y 3b - C"); Expect.equals( @@ -48,8 +44,8 @@ main() { lib3.myFunction4, ["x", "y"], {#argumentName5: new lib3.X(4)}), 4); Expect.equals( - Function - .apply(lib3.myFunction4, ["x", "y"], {#argumentName5: lib3.value3}), + Function.apply( + lib3.myFunction4, ["x", "y"], {#argumentName5: lib3.value3}), 3); }); } diff --git a/tests/compiler/dart2js_extra/deferred/reflect_multiple_annotations_test.dart b/tests/compiler/dart2js_extra/deferred/reflect_multiple_annotations_test.dart deleted file mode 100644 index 8a832d5b0b2..00000000000 --- a/tests/compiler/dart2js_extra/deferred/reflect_multiple_annotations_test.dart +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2017, 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. - -/// This test is indirectly testing invariants of the generated code of dart2js. -/// It ensures that indices to metadata information from **multiple** deferred -/// fragments is kept separate, but that when they are loaded (and the metadata -/// array is merged) all accesses to the metadata array is done correctly. -/// -/// This kind of metadata is generated either when using Function.apply (to -/// store default values and parameter names) or when using dart:mirrors -/// (annotations and unmangled names also need to be stored). -/// -/// This test file covers uses of annotations through dart:mirrors. -@MirrorsUsed(override: '*') -import 'dart:mirrors'; -import 'reflect_multiple_annotations_lib1.dart' deferred as lib1; -import 'reflect_multiple_annotations_lib2.dart' deferred as lib2; -import 'package:expect/expect.dart'; -import 'package:async_helper/async_helper.dart'; - -main() { - asyncTest(() async { - await lib1.loadLibrary(); - await lib2.loadLibrary(); - - MethodMirror m1 = - findTopLevel('multiple_annotations_lib1.dart', #myFunction1); - Expect.equals(m1.metadata.length, 2); - - Expect.equals(m1.parameters.length, 1); - Expect.equals(m1.parameters[0].simpleName, #f1); - Expect.isFalse(m1.parameters[0].hasDefaultValue); - Expect.equals(m1.parameters[0].metadata.length, 1); - - // Note: currently m1.metadata[*].reflectee is null, even though this works - // when not using deferred libraries. - // TODO(sigmund): fix if we do not move forward with Issue #30538. - //Expect.isTrue(lib1.MetaA.isCheck(m1.metadata[0].reflectee)); - //Expect.isTrue(lib1.MetaA.isCheck(m1.metadata[1].reflectee)); - //Expect.equals(m1.metadata[0].reflectee.value, "one"); - //Expect.equals(m1.metadata[1].reflectee.value, lib1.topLevelF); - //Expect.isTrue(lib1.MetaA.isCheck(m1.parameters[0].metadata[0].reflectee)); - //Expect.equals(m1.parameters[0].metadata[0].reflectee.value, "param"); - - LibraryMirror l2 = findLibrary('multiple_annotations_lib2.dart'); - Expect.equals(l2.metadata.length, 1); - print(l2.metadata[0].reflectee); - Expect.equals(l2.metadata[0].reflectee.value, "lib"); - - ClassMirror c2 = findClass('multiple_annotations_lib2.dart', #A); - Expect.equals(c2.simpleName, #A); - Expect.equals(c2.metadata.length, 1); - print(c2.metadata[0].reflectee); - Expect.equals(c2.metadata[0].reflectee.value, "class"); - }); -} - -MethodMirror findTopLevel(String uriSuffix, Symbol name) { - MethodMirror method; - currentMirrorSystem().libraries.forEach((uri, lib) { - if (uri.path.endsWith(uriSuffix)) method = lib.declarations[name]; - }); - return method; -} - -ClassMirror findClass(String uriSuffix, Symbol name) { - ClassMirror cls; - currentMirrorSystem().libraries.forEach((uri, lib) { - if (uri.path.endsWith(uriSuffix)) cls = lib.declarations[name]; - }); - return cls; -} - -LibraryMirror findLibrary(String uriSuffix) { - LibraryMirror lib; - currentMirrorSystem().libraries.forEach((uri, l) { - if (uri.path.endsWith(uriSuffix)) lib = l; - }); - return lib; -} diff --git a/tests/compiler/dart2js_extra/deferred/reflect_multiple_default_arg_test.dart b/tests/compiler/dart2js_extra/deferred/reflect_multiple_default_arg_test.dart deleted file mode 100644 index d82a02bde88..00000000000 --- a/tests/compiler/dart2js_extra/deferred/reflect_multiple_default_arg_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2017, 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. - -/// This test is indirectly testing invariants of the generated code of dart2js. -/// It ensures that indices to metadata information from **multiple** deferred -/// fragments is kept separate, but that when they are loaded (and the metadata -/// array is merged) all accesses to the metadata array is done correctly. -/// -/// This kind of metadata is generated either when using Function.apply (to -/// store default values and parameter names) or when using dart:mirrors -/// (annotations and unmangled names also need to be stored). -/// -/// This test file covers uses of parameter names and default values through -/// dart:mirrors. -@MirrorsUsed(override: '*') -import 'dart:mirrors'; -import 'reflect_multiple_default_arg_lib1.dart' deferred as lib1; -import 'reflect_multiple_default_arg_lib2.dart' deferred as lib2; -import 'package:expect/expect.dart'; -import 'package:async_helper/async_helper.dart'; - -main() { - asyncTest(() async { - await lib1.loadLibrary(); - await lib2.loadLibrary(); - - Expect.equals(Function.apply(lib1.myFunction1, []), 1); - Expect.equals(Function.apply(lib2.myFunction2, []), 2); - - MethodMirror m1 = - findTopLevel('multiple_default_arg_lib1.dart', #myFunction1); - Expect.equals(m1.parameters.length, 1); - Expect.equals(m1.parameters[0].simpleName, #argumentName1); - Expect.isTrue(m1.parameters[0].hasDefaultValue); - Expect.equals((m1.parameters[0].defaultValue.reflectee)(), 1); - - MethodMirror m2 = - findTopLevel('multiple_default_arg_lib2.dart', #myFunction2); - Expect.equals(m2.parameters.length, 1); - Expect.equals(m2.parameters[0].simpleName, #argumentName2); - Expect.isTrue(m2.parameters[0].hasDefaultValue); - Expect.equals((m2.parameters[0].defaultValue.reflectee)(), 2); - }); -} - -MethodMirror findTopLevel(String uriSuffix, Symbol name) { - MethodMirror method; - currentMirrorSystem().libraries.forEach((uri, lib) { - if (uri.path.endsWith(uriSuffix)) method = lib.declarations[name]; - }); - print(method); - return method; -} diff --git a/tests/compiler/dart2js_extra/equals_test.dart b/tests/compiler/dart2js_extra/equals_test.dart index 55cbc75a732..c4a530983a0 100644 --- a/tests/compiler/dart2js_extra/equals_test.dart +++ b/tests/compiler/dart2js_extra/equals_test.dart @@ -9,7 +9,7 @@ void main() { } else { throw "x != x with x == 3"; } - var y = x; + dynamic y = x; if (true) { y = 10; } diff --git a/tests/compiler/dart2js_extra/expression_loop_call_test.dart b/tests/compiler/dart2js_extra/expression_loop_call_test.dart deleted file mode 100644 index 2c33b97d1ad..00000000000 --- a/tests/compiler/dart2js_extra/expression_loop_call_test.dart +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2017, 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. - -/// Regression test for [ClosureCallSiteTypeInformation] in loops. - -class Class { - method() { - for (var a in []) { - (T)(); //# 01: ok - (Object)(); //# 02: ok - (this)(); //# 03: ok - (1)(); //# 04: ok - } - } -} - -main() { - new Class().method(); -} diff --git a/tests/compiler/dart2js_extra/for_in_test.dart b/tests/compiler/dart2js_extra/for_in_test.dart index 46093d8d423..8f0eb155348 100644 --- a/tests/compiler/dart2js_extra/for_in_test.dart +++ b/tests/compiler/dart2js_extra/for_in_test.dart @@ -29,8 +29,8 @@ testIterator(List expect, Iterable input) { class MyIterable extends IterableBase { final List values; MyIterable(List values) : this.values = values; - Iterator get iterator { - return new MyListIterator(values); + Iterator get iterator { + return new MyListIterator(values); } } diff --git a/tests/compiler/dart2js_extra/if_null_test.dart b/tests/compiler/dart2js_extra/if_null_test.dart index 2b25f435617..ed3f23a594f 100644 --- a/tests/compiler/dart2js_extra/if_null_test.dart +++ b/tests/compiler/dart2js_extra/if_null_test.dart @@ -9,12 +9,12 @@ import "package:expect/expect.dart"; confuse(x) => x; main(args) { - var x = new A(); + dynamic x = new A(); var y; // Checks that inference doesn't incorrectly treat this as a normal // assignment (where only B is a possible value after the assignment). - var c = x ??= new B(); + dynamic c = x ??= new B(); var z = x; Expect.equals('a', x.m()); Expect.equals('a', z.m()); diff --git a/tests/compiler/dart2js_extra/inference_nsm_mirrors_test.dart b/tests/compiler/dart2js_extra/inference_nsm_mirrors_test.dart deleted file mode 100644 index 424f7ca7559..00000000000 --- a/tests/compiler/dart2js_extra/inference_nsm_mirrors_test.dart +++ /dev/null @@ -1,29 +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. - -// Regression test for dart2js that did type inferencing on parameters -// whose type may change at runtime due to an invocation through -// [InstanceMirror.delegate]. - -@MirrorsUsed(targets: 'A') -import 'dart:mirrors'; -import 'package:expect/expect.dart'; - -class A { - noSuchMethod(im) { - reflect(new B()).delegate(im); - } -} - -class B { - foo(a) => a + 42; -} - -main() { - Expect.equals(42, new B().foo(0)); - // In checked mode we should get a type error. In unchecked mode it should be - // an argument error. - Expect.throws( - () => new A().foo('foo'), (e) => e is ArgumentError || e is TypeError); -} diff --git a/tests/compiler/dart2js_extra/inference_super_set_call_test.dart b/tests/compiler/dart2js_extra/inference_super_set_call_test.dart index 5038ad7bda9..4258546527a 100644 --- a/tests/compiler/dart2js_extra/inference_super_set_call_test.dart +++ b/tests/compiler/dart2js_extra/inference_super_set_call_test.dart @@ -17,7 +17,7 @@ abstract class A { class S extends A { var _x; // was bad: inferred as null, than [null | int] - var _y = ''; // was bad: inferred as String, rather than [String | int] + dynamic _y = ''; // was bad: inferred as String, rather than [String | int] var _z; // was ok : inferred as [null | int] set x(v) { diff --git a/tests/compiler/dart2js_extra/int_index_test.dart b/tests/compiler/dart2js_extra/int_index_test.dart index 269124ceb5b..629338bfbd3 100644 --- a/tests/compiler/dart2js_extra/int_index_test.dart +++ b/tests/compiler/dart2js_extra/int_index_test.dart @@ -4,9 +4,9 @@ main() { var a = [0, 1]; - a[1.2]; // //# 01: runtime error - a[1.2] = 4; // //# 02: runtime error - checkIndex(a, 1.4); //# 03: runtime error + a[1.2]; // //# 01: compile-time error + a[1.2] = 4; // //# 02: compile-time error + checkIndex(a, 1.4); //# 03: runtime error checkIndexedAssignment(a, 1.4); //# 04: runtime error checkIndex(a, 0); checkIndexedAssignment(a, 0); diff --git a/tests/compiler/dart2js_extra/invalid_annotation2_test.dart b/tests/compiler/dart2js_extra/invalid_annotation2_test.dart deleted file mode 100644 index f8238c3c272..00000000000 --- a/tests/compiler/dart2js_extra/invalid_annotation2_test.dart +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -// Regression test for http://dartbug.com/23893/ -// -// Because annotations are parsed lazily, dart2js used to crash when an -// annotation had a syntax error. -// This checks the same behavior as invalid_annotation_test.dart, except that we -// use mirrors to trigger the error in the vm. This also triggers the error in -// dart2js differently. - -@MirrorsUsed(targets: const [A]) -import 'dart:mirrors'; - -@Deprecated("m" -,, // //# 01: compile-time error - ) -class A {} - -main() { - reflectClass(A).metadata; -} diff --git a/tests/compiler/dart2js_extra/locals_test.dart b/tests/compiler/dart2js_extra/locals_test.dart index 36fd7ca4f06..3169124dbd5 100644 --- a/tests/compiler/dart2js_extra/locals_test.dart +++ b/tests/compiler/dart2js_extra/locals_test.dart @@ -3,9 +3,9 @@ // BSD-style license that can be found in the LICENSE file. void main() { - var hello = 'Hello'; - var world = 'world'; - var s = 0; + dynamic hello = 'Hello'; + dynamic world = 'world'; + dynamic s = 0; s = world; hello = 'Greetings'; print("$hello, $world!"); diff --git a/tests/compiler/dart2js_extra/locate_single_element_1_test.dart b/tests/compiler/dart2js_extra/locate_single_element_1_test.dart deleted file mode 100644 index 4291fe0629b..00000000000 --- a/tests/compiler/dart2js_extra/locate_single_element_1_test.dart +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -// Test for locateSingleElement bug. - -import 'package:expect/expect.dart'; - -class T { - foo() => 'T.foo'; // This is the single element. -} - -class C implements T { - // There is a warning that C does not implement 'foo'. -} - -@NoInline() -@AssumeDynamic() -assumeT(x) { - // returns inferred subtype(T). - if (x is T) return x; - throw "Not T"; -} - -var log = []; -demo() { - log.add(new T()); // T is created. - var a = assumeT(new C()); // C is created. - - // The call "a.foo()" should be a NoSuchMethodError, but a bug in - // locateSingleElement used to lead to T.foo being inlined. There is a single - // method. T.foo, that matches subtype(T), but it should be rejected because - // not all instantiated classes that are subtype(T) have that method. - log.add(a.foo()); -} - -main() { - Expect.throws(demo); -} diff --git a/tests/compiler/dart2js_extra/many_constants_test.dart b/tests/compiler/dart2js_extra/many_constants_test.dart index 3c8a6636848..f28e2ff96a9 100644 --- a/tests/compiler/dart2js_extra/many_constants_test.dart +++ b/tests/compiler/dart2js_extra/many_constants_test.dart @@ -29,14 +29,14 @@ const ll2 = const [1, 8, 3, 4, 5, 6, 7]; const ll3 = const [1, 2, 8, 4, 5, 6, 7]; const ll4 = const [1, 2, 3, 4, 8, 6, 7]; -const m1 = const {1: 1, 2: 2}; -const m2 = const {1: 2, 2: 1}; -const m3 = const {1: 1, 2: 1}; -const m4 = const {1: 2, 2: 2}; -const m5 = const {2: 1, 1: 2}; -const m6 = const {2: 2, 1: 1}; -const m7 = const {2: 1, 1: 1}; -const m8 = const {2: 2, 1: 2}; +const m1 = const {1: 1, 2: 2}; +const m2 = const {1: 2, 2: 1}; +const m3 = const {1: 1, 2: 1}; +const m4 = const {1: 2, 2: 2}; +const m5 = const {2: 1, 1: 2}; +const m6 = const {2: 2, 1: 1}; +const m7 = const {2: 1, 1: 1}; +const m8 = const {2: 2, 1: 2}; const m9 = const {1: 1, 2: 2}; const mA = const {1: 2, 2: 1}; const mB = const {1: 1, 2: 1}; diff --git a/tests/compiler/dart2js_extra/minus_zero2_test.dart b/tests/compiler/dart2js_extra/minus_zero2_test.dart index 622678a6b83..02cf9f0ee45 100644 --- a/tests/compiler/dart2js_extra/minus_zero2_test.dart +++ b/tests/compiler/dart2js_extra/minus_zero2_test.dart @@ -12,7 +12,7 @@ void main() { var list = [1, 2, 3]; if (new DateTime.now().millisecondsSinceEpoch == 42) list[1] = 4; int sum = 0; - for (int i = -0.0; i < list.length; i++) { + for (num i = -0.0; i < list.length; i++) { sum += list[i]; } Expect.equals(6, sum); diff --git a/tests/compiler/dart2js_extra/minus_zero_test.dart b/tests/compiler/dart2js_extra/minus_zero_test.dart index 987d7a27313..3b52434031b 100644 --- a/tests/compiler/dart2js_extra/minus_zero_test.dart +++ b/tests/compiler/dart2js_extra/minus_zero_test.dart @@ -6,13 +6,14 @@ import "package:expect/expect.dart"; -const double MINUS_ZERO = -0; //# 01: static type warning, checked mode compile-time error +@NoInline() +num minusZero() => -0; void main() { // Dart2js must not infer that the type-intersection of int and -0.0 is empty. // It must get an interceptor for the addition (`i += 3`), or use the native // JS + operation. - int i = MINUS_ZERO; // //# 01: continued - i += 3; // //# 01: continued - Expect.equals(3, i); // //# 01: continued + int i = minusZero(); + i += 3; + Expect.equals(3, i); } diff --git a/tests/compiler/dart2js_extra/mirror_enqueuer_regression_test.dart b/tests/compiler/dart2js_extra/mirror_enqueuer_regression_test.dart deleted file mode 100644 index 5fd7b428a8c..00000000000 --- a/tests/compiler/dart2js_extra/mirror_enqueuer_regression_test.dart +++ /dev/null @@ -1,14 +0,0 @@ -// 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. - -// Regression test for 'staged' reflection. MirrorsUsed pulls in static -// functions, that pulls in more reflection. This used to trigger a bug in -// Enqueuer where the second set of pulled in definitions were unresolved. - -@MirrorsUsed(targets: const ["foo"]) -import 'dart:mirrors'; - -final foo = reflect(reflect(9)).getField(#getField); - -void main() {} diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access2_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access2_test.dart deleted file mode 100644 index 0110cfbc39e..00000000000 --- a/tests/compiler/dart2js_extra/mirror_invalid_field_access2_test.dart +++ /dev/null @@ -1,33 +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. - -// Test that we cannot reflect on elements not covered by the `MirrorsUsed` -// annotation. - -library test; - -@MirrorsUsed(targets: 'C.foo') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -class C { - var foo; - var bar; -} - -main() { - var c = new C(); - - c.bar = 1; - var local = c.bar; - - var mirror = reflect(c); - Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee); - Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee); - Expect.throws(() => mirror.setField(const Symbol('bar'), 2), - (e) => e is NoSuchMethodError); - Expect.throws(() => mirror.getField(const Symbol('bar')), - (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart deleted file mode 100644 index 40d235f5111..00000000000 --- a/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart +++ /dev/null @@ -1,30 +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. - -// Test that we cannot reflect on elements not covered by the `MirrorsUsed` -// annotation. - -library test; - -@MirrorsUsed(targets: 'C.foo') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -class C { - static var foo; - static var bar; -} - -main() { - C.bar = 1; - var local = C.bar; - var mirror = reflect(new C()).type; // Workaround bug 12799. - Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee); - Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee); - Expect.throws(() => mirror.setField(const Symbol('bar'), 2), - (e) => e is NoSuchMethodError); - Expect.throws(() => mirror.getField(const Symbol('bar')), - (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access4_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access4_test.dart deleted file mode 100644 index ba3b190401d..00000000000 --- a/tests/compiler/dart2js_extra/mirror_invalid_field_access4_test.dart +++ /dev/null @@ -1,40 +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. - -// Test that we cannot reflect on elements not covered by the `MirrorsUsed` -// annotation. - -library test; - -@MirrorsUsed(targets: 'C.foo') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -class C { - var foo; - var bar; -} - -class D { - get bar {} - set bar(x) {} -} - -int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1)); - -main() { - var c = inscrutable(1) == 1 ? new C() : new D(); - - c.bar = 1; - var local = c.bar; - - var mirror = reflect(c); - Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee); - Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee); - Expect.throws(() => mirror.setField(const Symbol('bar'), 2), - (e) => e is NoSuchMethodError); - Expect.throws(() => mirror.getField(const Symbol('bar')), - (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access_test.dart deleted file mode 100644 index 15e7099682a..00000000000 --- a/tests/compiler/dart2js_extra/mirror_invalid_field_access_test.dart +++ /dev/null @@ -1,29 +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. - -// Test that we cannot reflect on elements not covered by the `MirrorsUsed` -// annotation. - -library test; - -@MirrorsUsed(targets: 'foo') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -var foo; -var bar; - -main() { - bar = 1; - var local = bar; - - var mirror = currentMirrorSystem().findLibrary(const Symbol('test')); - Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee); - Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee); - Expect.throws(() => mirror.setField(const Symbol('bar'), 2), - (e) => e is NoSuchMethodError); - Expect.throws(() => mirror.getField(const Symbol('bar')), - (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/mirror_invalid_invoke2_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_invoke2_test.dart deleted file mode 100644 index 774c7280160..00000000000 --- a/tests/compiler/dart2js_extra/mirror_invalid_invoke2_test.dart +++ /dev/null @@ -1,33 +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. - -// Test that we cannot reflect on elements not covered by the `MirrorsUsed` -// annotation. - -library test; - -@MirrorsUsed(targets: 'C.foo') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -import '../../language/compiler_annotations.dart'; - -class C { - foo() => 1; - - @NoInline() - // Use a closure to prevent inlining until the annotation is implemented. - bar() => () => 2; -} - -main() { - var c = new C(); - c.bar(); // Call bar, so it is included in the program. - - var mirror = reflect(c); - Expect.equals(1, mirror.invoke(const Symbol('foo'), []).reflectee); - Expect.throws(() => mirror.invoke(const Symbol('bar'), []), - (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/mirror_invalid_invoke3_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_invoke3_test.dart deleted file mode 100644 index 9ddd4e553ae..00000000000 --- a/tests/compiler/dart2js_extra/mirror_invalid_invoke3_test.dart +++ /dev/null @@ -1,32 +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. - -// Test that we cannot reflect on elements not covered by the `MirrorsUsed` -// annotation. - -library test; - -@MirrorsUsed(targets: 'C.foo') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -import '../../language/compiler_annotations.dart'; - -class C { - static foo() => 1; - - @NoInline() - // Use a closure to prevent inlining until the annotation is implemented. - static bar() => () => 2; -} - -main() { - C.bar(); // Call bar, so it is included in the program. - - var mirror = reflect(new C()).type; // Workaround bug 12799. - Expect.equals(1, mirror.invoke(const Symbol('foo'), []).reflectee); - Expect.throws(() => mirror.invoke(const Symbol('bar'), []), - (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/mirror_invalid_invoke_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_invoke_test.dart deleted file mode 100644 index ea65a1e57f9..00000000000 --- a/tests/compiler/dart2js_extra/mirror_invalid_invoke_test.dart +++ /dev/null @@ -1,29 +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. - -// Test that we cannot reflect on elements not covered by the `MirrorsUsed` -// annotation. - -library test; - -@MirrorsUsed(targets: 'foo') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -import '../../language/compiler_annotations.dart'; - -foo() => 1; - -@NoInline() -// Use a closure to prevent inlining until the annotation is implemented. -bar() => () => 2; - -main() { - bar(); // Call bar, so it is included in the program. - - var lm = currentMirrorSystem().findLibrary(const Symbol('test')); - Expect.equals(1, lm.invoke(const Symbol('foo'), []).reflectee); - Expect.throws(() => lm.invoke(const Symbol('bar'), [])); -} diff --git a/tests/compiler/dart2js_extra/mirror_printer_test.dart b/tests/compiler/dart2js_extra/mirror_printer_test.dart deleted file mode 100644 index 9f5d5b7d3c0..00000000000 --- a/tests/compiler/dart2js_extra/mirror_printer_test.dart +++ /dev/null @@ -1,189 +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. - -/// Prints all information about all mirrors. This tests that it is possible to -/// enumerate all reflective information without crashing. - -// Note: Adding imports below is fine for regression tests. For example, -// 'crash_library_metadata.dart' is imported to ensure the compiler doesn't -// crash. - -// TODO(ahe): This test should be extended until we are sure all data is -// printed. - -library test.mirror_printer_test; - -@MirrorsUsed(targets: '*') -import 'dart:mirrors'; - -import 'crash_library_metadata.dart'; // This would crash dart2js. - -// Importing dart:html to make things interesting. -import 'dart:html'; //# 01: ok - -class MirrorPrinter { - final StringBuffer buffer; - final TypeMirror dynamicType = currentMirrorSystem().dynamicType; - - int indentationLevel = 0; - - MirrorPrinter(this.buffer); - - void w(object) { - buffer.write(object); - } - - n(Symbol symbol) => MirrorSystem.getName(symbol); - - void indented(action) { - indentationLevel++; - action(); - indentationLevel--; - } - - get indent { - for (int i = 0; i < indentationLevel; i++) { - w(' '); - } - } - - String stringifyInstance(InstanceMirror mirror) { - var reflectee = mirror.reflectee; - if (reflectee is String) return '"${reflectee}"'; - if (reflectee is Null || - reflectee is bool || - reflectee is num || - reflectee is List || - reflectee is Map) { - return '$reflectee'; - } - StringBuffer buffer = new StringBuffer(); - Map declarations = mirror.type.declarations; - buffer..write(n(mirror.type.simpleName))..write('('); - bool first = true; - declarations.forEach((Symbol name, DeclarationMirror declaration) { - if (declaration is! VariableMirror) return; - VariableMirror variable = declaration; - if (variable.isStatic) return; - // TODO(ahe): Include superclasses. - if (first) { - first = false; - } else { - buffer.write(', '); - } - buffer - ..write(n(name)) - ..write(': ') - ..write(stringifyInstance(mirror.getField(name))); - }); - buffer.write(')'); - return buffer.toString(); - } - - String stringifyMetadata(InstanceMirror mirror) { - return '@${stringifyInstance(mirror)}'; - } - - bool writeType(TypeMirror mirror) { - if (mirror == null || mirror == dynamicType) return false; - w('${n(mirror.simpleName)} '); - return true; - } - - writeVariable(VariableMirror mirror) { - bool needsVar = true; - if (mirror.isStatic) w('static '); - // TODO(ahe): What about const? - if (mirror.isFinal) { - w('final '); - needsVar = false; - } - - if (writeType(mirror.type)) needsVar = false; - - if (needsVar) { - w('var '); - } - w('${n(mirror.simpleName)};'); - } - - writeMethod(MethodMirror mirror) { - writeType(mirror.returnType); - if (mirror.isOperator) { - w('operator '); - } - if (mirror.isGetter) { - w('get '); - } - if (mirror.isSetter) { - w('set '); - } - w('${n(mirror.simpleName)}'); - if (!mirror.isGetter) { - w('()'); - } - w(';'); - } - - writeClass(ClassMirror mirror) { - // TODO(ahe): Write 'abstract' if [mirror] is abstract. - w('class ${n(mirror.simpleName)}'); - // TODO(ahe): Write superclass and interfaces. - w(' {'); - bool first = true; - indented(() { - for (DeclarationMirror declaration in mirror.declarations.values) { - if (first) { - first = false; - } else { - w('\n'); - } - writeDeclaration(declaration); - } - }); - w('\n}\n'); - } - - writeDeclaration(DeclarationMirror declaration) { - w('\n'); - var metadata = declaration.metadata; - if (!metadata.isEmpty) { - indent; - buffer.writeAll(metadata.map(stringifyMetadata), ' '); - w('\n'); - } - indent; - if (declaration is ClassMirror) { - writeClass(declaration); - } else if (declaration is VariableMirror) { - writeVariable(declaration); - } else if (declaration is MethodMirror) { - writeMethod(declaration); - } else { - // TODO(ahe): Test other subclasses of DeclarationMirror. - w('$declaration'); - } - } - - writeLibrary(LibraryMirror library) { - w('library ${n(library.simpleName)};\n\n'); - library.declarations.values - .where((d) => d is! TypeMirror) - .forEach(writeDeclaration); - w('\n'); - } - - static StringBuffer stringify(Map libraries) { - StringBuffer buffer = new StringBuffer(); - libraries.values.forEach(new MirrorPrinter(buffer).writeLibrary); - return buffer; - } -} - -main() { - print(MirrorPrinter.stringify(currentMirrorSystem().libraries)); - // Clear the nodes to avoid confusing the fine test framework (by "fine" I - // mean something else) -- ahe. - document.body.nodes.clear(); //# 01: continued -} diff --git a/tests/compiler/dart2js_extra/mirror_test.dart b/tests/compiler/dart2js_extra/mirror_test.dart deleted file mode 100644 index 5c4e452e106..00000000000 --- a/tests/compiler/dart2js_extra/mirror_test.dart +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2012, 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"; -import 'dart:mirrors'; - -void main() { - var now = new DateTime.now(); - InstanceMirror mirror = reflect(now); - print('now: ${now}'); - print('mirror.type: ${mirror.type}'); - print('now.toUtc(): ${now.toUtc()}'); - - var value = mirror.invoke(const Symbol("toUtc"), []); - print('mirror.invoke("toUtc", []): $value'); - Expect.isTrue(value.hasReflectee); - Expect.equals(now.toUtc(), value.reflectee); -} diff --git a/tests/compiler/dart2js_extra/mirror_type_inference_field2_test.dart b/tests/compiler/dart2js_extra/mirror_type_inference_field2_test.dart deleted file mode 100644 index ee6b26f8b47..00000000000 --- a/tests/compiler/dart2js_extra/mirror_type_inference_field2_test.dart +++ /dev/null @@ -1,23 +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. - -// Test that type inference sees the possible modification of `fisk` from -// the mirror system and not infers the value to be an integer, or any -// other elements that use `fisk` like `otherFisk` to be of type integer. -library test; - -@MirrorsUsed(targets: 'fisk', override: '*') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -var fisk = 1; -var otherFisk = 42; - -main() { - var lm = currentMirrorSystem().findLibrary(const Symbol('test')); - lm.setField(const Symbol('fisk'), 'hest'); - otherFisk = fisk; - Expect.isTrue(otherFisk is String); -} diff --git a/tests/compiler/dart2js_extra/mirror_type_inference_field_test.dart b/tests/compiler/dart2js_extra/mirror_type_inference_field_test.dart deleted file mode 100644 index fcf06413cb8..00000000000 --- a/tests/compiler/dart2js_extra/mirror_type_inference_field_test.dart +++ /dev/null @@ -1,20 +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. - -// Test that type inference sees the possible modification of `fisk` from -// the mirror system and not infers the value to be an integer. -library test; - -@MirrorsUsed(targets: 'fisk', override: '*') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -var fisk = 1; - -main() { - var lm = currentMirrorSystem().findLibrary(const Symbol('test')); - lm.setField(const Symbol('fisk'), 'hest'); - Expect.isTrue(fisk is String); -} diff --git a/tests/compiler/dart2js_extra/mirror_type_inference_function_test.dart b/tests/compiler/dart2js_extra/mirror_type_inference_function_test.dart deleted file mode 100644 index c7488f40060..00000000000 --- a/tests/compiler/dart2js_extra/mirror_type_inference_function_test.dart +++ /dev/null @@ -1,20 +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. - -// Test that type inference sees the call to `fisk` from the mirror system -// and not infers the argument to be an integer. -library test; - -@MirrorsUsed(targets: 'fisk', override: '*') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -bool fisk(a) => a is int; - -main() { - Expect.isTrue(fisk(1)); - var lm = currentMirrorSystem().findLibrary(const Symbol('test')); - Expect.isFalse(lm.invoke(const Symbol('fisk'), ['hest']).reflectee); -} diff --git a/tests/compiler/dart2js_extra/mirrors_declarations_filtering_test.dart b/tests/compiler/dart2js_extra/mirrors_declarations_filtering_test.dart deleted file mode 100644 index 08ec7a208c2..00000000000 --- a/tests/compiler/dart2js_extra/mirrors_declarations_filtering_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -// 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. - -// Regression test for the dart2js mirrors implementation that triggers the -// generation of the declarations of a class in the presence of call stubs -// and non-reflectable methods. For neither of the latter an instance mirror -// should be constructed and they should not be contained in declarations. -@MirrorsUsed(metaTargets: "Meta") -import "dart:mirrors"; -import "package:expect/expect.dart"; - -class Meta { - const Meta(); -} - -class A { - @Meta() - reflectableThing(int a, [int b = 9, int c = 42]) => a + b + c; - nonReflectableThing(int a, [int b = 4, int c = 21]) => a + b + c; -} - -tryCall(object, symbol, values, expected) { - var mirror = reflect(object); - var result = mirror.invoke(symbol, values).reflectee; - Expect.equals(result, expected); -} - -@NoInline() -@AssumeDynamic() -hide(x) => x; - -main() { - var a = hide(new A()); - // Make sure we statically have some calls to reflectableThing with 1, 2 and - // 3 arguments so that stubs are generated. - Expect.equals(1 + 9 + 42, a.reflectableThing(1)); - Expect.equals(1 + 5 + 42, a.reflectableThing(1, 5)); - Expect.equals(1 + 22 + 3, a.reflectableThing(1, 22, 3)); - // Try calling methods through reflection. - tryCall(a, #reflectableThing, [1], 1 + 9 + 42); - tryCall(a, #reflectableThing, [1, 5], 1 + 5 + 42); - tryCall(a, #reflectableThing, [1, 22, 3], 1 + 22 + 3); - Expect.throws(() => tryCall(a, #nonReflectableThing, [1], 1 + 4 + 21)); - Expect.throws(() => tryCall(a, #nonReflectableThing, [1, 5], 1 + 5 + 21)); - Expect.throws(() => tryCall(a, #nonReflectableThing, [1, 13, 7], 1 + 13 + 7)); - // Trigger generation of all declarations and check they only contain a - // a single entry. - var declarations = reflect(a).type.declarations; - Expect.equals(1, declarations.keys.length); - Expect.equals(#reflectableThing, declarations.keys.first); -} diff --git a/tests/compiler/dart2js_extra/mirrors_used_closure_test.dart b/tests/compiler/dart2js_extra/mirrors_used_closure_test.dart deleted file mode 100644 index 8f5dc8e7ee8..00000000000 --- a/tests/compiler/dart2js_extra/mirrors_used_closure_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -library MirrorsTest; - -import 'package:expect/expect.dart'; - -@MirrorsUsed(targets: const ['A.foo', 'B.bar']) -import 'dart:mirrors'; - -class A { - foo() => 42; - bar() => 499; -} - -class B { - bar() => 33; -} - -@NoInline() -@AssumeDynamic() -confuse(x) => x; - -main() { - var f = [new A(), new B()][confuse(0)].bar; - Expect.throws( - () => reflect(f).invoke(#call, [], {}), (e) => e is UnsupportedError); -} diff --git a/tests/compiler/dart2js_extra/mirrors_used_metatargets_test.dart b/tests/compiler/dart2js_extra/mirrors_used_metatargets_test.dart deleted file mode 100644 index 54513d9eb25..00000000000 --- a/tests/compiler/dart2js_extra/mirrors_used_metatargets_test.dart +++ /dev/null @@ -1,40 +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. - -@MirrorsUsed(metaTargets: 'X') -import 'dart:mirrors'; - -const x = const X(); - -class X { - const X(); -} - -@x -class Y { - foo() => 42; -} - -class Z { - foo() => 99; - - @X() - bar() => 87; -} - -main() { - var y = new Y(); - var z = new Z(); - - if (reflect(y).invoke(#foo, []).reflectee != 42) throw 'Wrong Y.foo'; - if (reflect(z).invoke(#bar, []).reflectee != 87) throw 'Wrong Z.bar'; - - bool caught = false; - try { - reflect(z).invoke(#foo, []); - } on UnsupportedError catch (e) { - caught = true; - } - if (!caught) throw 'Wrong Z.foo'; -} diff --git a/tests/compiler/dart2js_extra/mirrors_used_native_test.dart b/tests/compiler/dart2js_extra/mirrors_used_native_test.dart deleted file mode 100644 index 85dbb3581c2..00000000000 --- a/tests/compiler/dart2js_extra/mirrors_used_native_test.dart +++ /dev/null @@ -1,14 +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. - -@MirrorsUsed(targets: 'List') -import 'dart:mirrors'; - -import 'package:expect/expect.dart'; - -main() { - Expect.equals(3, reflect([1, 2, 3]).getField(#length).reflectee); - Expect.throws(() => reflect({"hest": 42}).getField(#length), - (e) => e is UnsupportedError); -} diff --git a/tests/compiler/dart2js_extra/mirrors_used_warning2_test.dart b/tests/compiler/dart2js_extra/mirrors_used_warning2_test.dart deleted file mode 100644 index 699595aed0e..00000000000 --- a/tests/compiler/dart2js_extra/mirrors_used_warning2_test.dart +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -import 'dart:mirrors'; -import 'dart:async'; - -import 'package:expect/expect.dart'; - -class A { - noSuchMethod(Invocation invocation) { - return MirrorSystem.getName(invocation.memberName); - } -} - -var lines = []; -capturePrint(Zone self, ZoneDelegate parent, Zone origin, line) { - lines.add(line); -} - -runTests() { - // No MirrorsUsed annotation anywhere. - // Dart2js should retain all symbols. - Expect.equals("foo", new A().foo); - Expect.isTrue(lines.isEmpty); - var barResult = new A().bar; - Expect.equals("bar", barResult); - Expect.isTrue(lines.isEmpty); -} - -main() { - runZoned(runTests, - zoneSpecification: new ZoneSpecification(print: capturePrint)); -} diff --git a/tests/compiler/dart2js_extra/mirrors_used_warning_test.dart b/tests/compiler/dart2js_extra/mirrors_used_warning_test.dart deleted file mode 100644 index 626c0dffd4d..00000000000 --- a/tests/compiler/dart2js_extra/mirrors_used_warning_test.dart +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -@MirrorsUsed(symbols: 'foo') -import 'dart:mirrors'; -import 'dart:async'; - -import 'package:expect/expect.dart'; - -class A { - noSuchMethod(Invocation invocation) { - return MirrorSystem.getName(invocation.memberName); - } -} - -var lines = []; -capturePrint(Zone self, ZoneDelegate parent, Zone origin, line) { - lines.add(line); -} - -runTests() { - // "foo" is in MirrorsUsed and should therefore always work. - Expect.equals("foo", new A().foo); - Expect.isTrue(lines.isEmpty); - var barResult = new A().bar; - Expect.equals("bar", barResult); // //# minif: ok - - Expect.isTrue(lines.length == 1); - var line = lines.first; - Expect.isTrue(line.contains("Warning") && - line.contains("bar") && // //# minif: continued - line.contains("minif")); -} - -main() { - runZoned(runTests, - zoneSpecification: new ZoneSpecification(print: capturePrint)); -} diff --git a/tests/compiler/dart2js_extra/no_such_method_mirrors_test.dart b/tests/compiler/dart2js_extra/no_such_method_mirrors_test.dart deleted file mode 100644 index 77199741d0d..00000000000 --- a/tests/compiler/dart2js_extra/no_such_method_mirrors_test.dart +++ /dev/null @@ -1,21 +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 { - noSuchMethod(im) { - reflect(new B()).delegate(im); - } -} - -class B {} - -main() { - // Test with an intercepted selector. - Expect.throws(() => new A().startsWith(42), (e) => e is NoSuchMethodError); - // Test with a non-intercepted selector. - Expect.throws(() => new A().foobar(), (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/operator2_test.dart b/tests/compiler/dart2js_extra/operator2_test.dart index 4adff2d0c93..7d43fb08b57 100644 --- a/tests/compiler/dart2js_extra/operator2_test.dart +++ b/tests/compiler/dart2js_extra/operator2_test.dart @@ -93,7 +93,7 @@ void mulTest() { void divTest() { var m1 = 0.0 - 1.0; var m2 = 0 - 2; - var x = two(); + num x = two(); x /= 2; Expect.equals(1.0, x); x /= 2; diff --git a/tests/compiler/dart2js_extra/operator_equals_test.dart b/tests/compiler/dart2js_extra/operator_equals_test.dart index becbdd352e6..6d733098f41 100644 --- a/tests/compiler/dart2js_extra/operator_equals_test.dart +++ b/tests/compiler/dart2js_extra/operator_equals_test.dart @@ -13,7 +13,7 @@ class AlwaysFalse { } main() { - var a = new AlwaysTrue(); + dynamic a = new AlwaysTrue(); Expect.isTrue(a == 2); Expect.isFalse(a == null); Expect.isFalse(a != 2); diff --git a/tests/compiler/dart2js_extra/optional_parameter_test.dart b/tests/compiler/dart2js_extra/optional_parameter_test.dart index bb9ac6f2f7f..48418fb75fa 100644 --- a/tests/compiler/dart2js_extra/optional_parameter_test.dart +++ b/tests/compiler/dart2js_extra/optional_parameter_test.dart @@ -24,7 +24,7 @@ main() { Expect.equals(null, a.foo()); Expect.equals(null, a.bar(42)); Expect.equals(42, a.bar(null, 42)); - Expect.equals(0, a.foo(1, 2)); - Expect.equals(0, a.bar()); - Expect.equals(0, a.bar(1, 2, 3)); + Expect.equals(0, (a as dynamic).foo(1, 2)); + Expect.equals(0, (a as dynamic).bar()); + Expect.equals(0, (a as dynamic).bar(1, 2, 3)); } diff --git a/tests/compiler/dart2js_extra/reflect_native_types_test.dart b/tests/compiler/dart2js_extra/reflect_native_types_test.dart deleted file mode 100644 index eb2cb355003..00000000000 --- a/tests/compiler/dart2js_extra/reflect_native_types_test.dart +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -// Test that reflection works on intercepted types. - -import 'dart:mirrors'; -import 'package:expect/expect.dart'; - -main() { - // Make sure that reflecting on values of intercepted/native classes does - // not crash. - var intMembers = reflect(123).type.instanceMembers; - Expect.isTrue(intMembers.containsKey(#compareTo)); - Expect.isTrue(intMembers.length > 15); - var listMembers = reflect([]).type.instanceMembers; - Expect.isTrue(listMembers.containsKey(#join)); - Expect.isTrue(listMembers.length > 15); - var stringMembers = reflect('hest').type.instanceMembers; - Expect.isTrue(stringMembers.containsKey(#contains)); - Expect.isTrue(stringMembers.length > 15); -} diff --git a/tests/compiler/dart2js_extra/regress/4740_library.dart b/tests/compiler/dart2js_extra/regress/4740_library.dart deleted file mode 100644 index 709991f0d6d..00000000000 --- a/tests/compiler/dart2js_extra/regress/4740_library.dart +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2012, 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. - -library _4740_library; - -class Foo { - Foo._internal(); -} diff --git a/tests/compiler/dart2js_extra/regress/4740_test.dart b/tests/compiler/dart2js_extra/regress/4740_test.dart deleted file mode 100644 index a32a7b95dea..00000000000 --- a/tests/compiler/dart2js_extra/regress/4740_test.dart +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2012, 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"; - -import '4740_library.dart'; - -main() { - Expect.throws(() => new Foo._internal(), (e) => e is NoSuchMethodError); -} diff --git a/tests/compiler/dart2js_extra/regress_32069_test.dart b/tests/compiler/dart2js_extra/regress_32069_test.dart index 4f13dfc108d..23a0aff320e 100644 --- a/tests/compiler/dart2js_extra/regress_32069_test.dart +++ b/tests/compiler/dart2js_extra/regress_32069_test.dart @@ -6,8 +6,8 @@ import 'package:expect/expect.dart'; main() { var m1 = { - 'hello': ['hi', 'howdy'], - 'bye': [] + 'hello': ['hi', 'howdy'], + 'bye': [] }; var m = new Map>.unmodifiable(m1); print(m); diff --git a/tests/compiler/dart2js_extra/switch_test.dart b/tests/compiler/dart2js_extra/switch_test.dart index 03a55e12396..7fbc9d02629 100644 --- a/tests/compiler/dart2js_extra/switch_test.dart +++ b/tests/compiler/dart2js_extra/switch_test.dart @@ -75,8 +75,10 @@ switcher4(val) { switch (val) { case 1: return 100; - case 2: + case 2: _throw(); //# 00: compile-time error + case 3: _throw(); + break; default: return 300; } diff --git a/tests/compiler/dart2js_extra/type_error_message_test.dart b/tests/compiler/dart2js_extra/type_error_message_test.dart index e3f3f90f546..d0975777f62 100644 --- a/tests/compiler/dart2js_extra/type_error_message_test.dart +++ b/tests/compiler/dart2js_extra/type_error_message_test.dart @@ -9,9 +9,9 @@ import 'package:expect/expect.dart'; class C {} -bool inCheckedMode() { +bool inComplianceMode() { try { - int i = 'hest'; + int i = ('hest' as dynamic); } catch (e) { return true; } @@ -19,10 +19,10 @@ bool inCheckedMode() { } main() { - if (inCheckedMode()) { + if (inComplianceMode()) { bool caught = false; try { - C x = new C, String>(); + C x = (new C, String>()) as dynamic; } catch (e) { String nameOfC = (C).toString(); String nameOfInt = (int).toString(); diff --git a/tests/compiler/dart2js_extra/variable_type_test.dart b/tests/compiler/dart2js_extra/variable_type_test.dart deleted file mode 100644 index 500a70b5577..00000000000 --- a/tests/compiler/dart2js_extra/variable_type_test.dart +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2011, 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. - -int foo(int i) { - i = 'fisk'; // //# 01: static type warning - return 'kat'; // //# 02: static type warning, dynamic type error -} - -main() { - foo(42); - foo('hest'); // //# 03: static type warning -} diff --git a/tests/compiler/dart2js_native/compute_this_script_test.dart b/tests/compiler/dart2js_native/compute_this_script_test.dart index fcf45391c0c..8519bc4e8f1 100644 --- a/tests/compiler/dart2js_native/compute_this_script_test.dart +++ b/tests/compiler/dart2js_native/compute_this_script_test.dart @@ -11,6 +11,6 @@ main() { // of our test runner, but I can think of no other way to test this. // -- ahe if (!thisScript.endsWith('/out.js')) { - throw 'Unexpected script: "$thiscript"'; + throw 'Unexpected script: "$thisScript"'; } } diff --git a/tests/compiler/dart2js_native/core_type_check_native_test.dart b/tests/compiler/dart2js_native/core_type_check_native_test.dart index c1411b610a1..63561929013 100644 --- a/tests/compiler/dart2js_native/core_type_check_native_test.dart +++ b/tests/compiler/dart2js_native/core_type_check_native_test.dart @@ -8,13 +8,19 @@ import "native_testing.dart"; class A {} @Native("B") -class B implements Comparable {} +class B implements Comparable { + noSuchMethod(m) => super.noSuchMethod(m); +} @Native("C") -class C implements Pattern {} +class C implements Pattern { + noSuchMethod(m) => super.noSuchMethod(m); +} @Native("D") -class D implements Pattern, Comparable {} +class D implements Pattern, Comparable { + noSuchMethod(m) => super.noSuchMethod(m); +} makeA() native; makeB() native; diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/compiler/dart2js_native/dart2js_native.status index 56edcef17e1..8ad400d486d 100644 --- a/tests/compiler/dart2js_native/dart2js_native.status +++ b/tests/compiler/dart2js_native/dart2js_native.status @@ -5,17 +5,13 @@ [ $compiler == dart2js ] bound_closure_super_test: RuntimeError fake_thing_test: RuntimeError # Issue 13010 -mirror_intercepted_field_test: SkipByDesign # mirrors not supported -native_mirror_test: SkipByDesign # mirrors not supported -native_no_such_method_exception3_frog_test: SkipByDesign # mirrors not supported -native_no_such_method_exception4_frog_test: SkipByDesign # mirrors not supported -native_no_such_method_exception5_frog_test: SkipByDesign # mirrors not supported [ $browser ] *: Skip -[ $compiler == dart2js && $checked ] +[ $compiler == dart2js && $checked && !$strong ] error_safeToString_test: RuntimeError # Fix for Issue 33627 disabled native class sharing +native_method_inlining_test: RuntimeError [ $compiler == dart2js && $fasta ] native_library_same_name_used_frog_test: CompileTimeError @@ -26,3 +22,7 @@ subclassing_super_field_2_test: RuntimeError [ $compiler == dart2js && $minified ] optimization_hints_test: RuntimeError, OK # Test relies on unminified names. + +[ $compiler == dart2js && $strong ] +error_safeToString_test: RuntimeError # Fix for Issue 33627 disabled native class sharing +native_checked_fields_frog_test: RuntimeError diff --git a/tests/compiler/dart2js_native/downcast_test.dart b/tests/compiler/dart2js_native/downcast_test.dart index 0727b1ba476..ab74f5f27ef 100644 --- a/tests/compiler/dart2js_native/downcast_test.dart +++ b/tests/compiler/dart2js_native/downcast_test.dart @@ -10,7 +10,7 @@ abstract class J {} abstract class I extends J { I read(); - write(I x); + write(covariant I x); } // Native implementation. diff --git a/tests/compiler/dart2js_native/fake_thing_test.dart b/tests/compiler/dart2js_native/fake_thing_test.dart index 2761a904979..01318211c4b 100644 --- a/tests/compiler/dart2js_native/fake_thing_test.dart +++ b/tests/compiler/dart2js_native/fake_thing_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import "package:expect/expect.dart"; +import "dart:_foreign_helper" show JS; // Test that native objects cannot accidentally or maliciously be mistaken for // Dart objects. @@ -20,7 +21,7 @@ void setup() { (function(){ function A() {} A.prototype.$isThing = true; - make1 = function(){return new A;}; + make1 = function(){return new A();}; make2 = function(){return {$isThing: true}}; })()"""); } diff --git a/tests/compiler/dart2js_native/inference_of_helper_methods_test.dart b/tests/compiler/dart2js_native/inference_of_helper_methods_test.dart index ef299518468..3185f058eba 100644 --- a/tests/compiler/dart2js_native/inference_of_helper_methods_test.dart +++ b/tests/compiler/dart2js_native/inference_of_helper_methods_test.dart @@ -5,9 +5,9 @@ import 'native_testing.dart'; import 'dart:_js_helper' show intTypeCheck; -bool get inCheckedMode { +bool get inComplianceMode { try { - String a = 42; + String a = (42 as dynamic); } on TypeError catch (e) { return true; } @@ -25,7 +25,7 @@ main() { // implementing checked mode semantics (like in the check below), // the check won't fail at runtime. intTypeCheck(42); - if (inCheckedMode) { + if (inComplianceMode) { int value; Expect.throws(() => value = a[1], (e) => e is TypeError); } diff --git a/tests/compiler/dart2js_native/mirror_intercepted_field_test.dart b/tests/compiler/dart2js_native/mirror_intercepted_field_test.dart deleted file mode 100644 index 4a3b3378599..00000000000 --- a/tests/compiler/dart2js_native/mirror_intercepted_field_test.dart +++ /dev/null @@ -1,31 +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 'native_testing.dart'; - -@Native("B") -class B { - // Having this field in a native class will generate accessors with - // the interceptor calling convention. - var f; -} - -class A { - int f; -} - -const symF = const Symbol('f'); - -main() { - JS('B', '(null)'); // B appears to be created. - var a = new A(); - - InstanceMirror mirror = reflect(a); - mirror.setField(symF, 42); - Expect.equals(42, a.f); - - mirror = mirror.getField(symF); - Expect.equals(42, mirror.reflectee); -} diff --git a/tests/compiler/dart2js_native/native_call_arity1_frog_test.dart b/tests/compiler/dart2js_native/native_call_arity1_frog_test.dart index 09db0f26a26..f590001d6db 100644 --- a/tests/compiler/dart2js_native/native_call_arity1_frog_test.dart +++ b/tests/compiler/dart2js_native/native_call_arity1_frog_test.dart @@ -66,17 +66,17 @@ testStaticContext() { A a = makeA(); B b = makeB(); - Expect.throws(() => a.foo()); + Expect.throws(() => (a as dynamic).foo()); Expect.equals(1, a.foo(10)); - Expect.throws(() => a.foo(10, 20)); - Expect.throws(() => a.foo(10, 20, 30)); + Expect.throws(() => (a as dynamic).foo(10, 20)); + Expect.throws(() => (a as dynamic).foo(10, 20, 30)); Expect.equals(0, b.foo()); Expect.equals(1, b.foo(10)); Expect.equals(2, b.foo(10, 20)); Expect.equals(3, b.foo(10, 20, 30)); - Expect.throws(() => b.foo(10, 20, 30, 40)); + Expect.throws(() => (b as dynamic).foo(10, 20, 30, 40)); } main() { diff --git a/tests/compiler/dart2js_native/native_call_arity2_frog_test.dart b/tests/compiler/dart2js_native/native_call_arity2_frog_test.dart index f1289ffce39..16468090bfe 100644 --- a/tests/compiler/dart2js_native/native_call_arity2_frog_test.dart +++ b/tests/compiler/dart2js_native/native_call_arity2_frog_test.dart @@ -78,20 +78,16 @@ testStaticContext() { Expect.equals(0, a.foo()); Expect.equals(1, a.foo(10)); Expect.equals(2, a.foo(10, 20)); - Expect.throws(() => a.foo(10, 20, 30)); Expect.equals(1, a.foo(10)); Expect.equals(2, a.foo(null, 20)); - Expect.throws(() => a.foo(10, 20, 30)); Expect.equals(0, b.foo()); Expect.equals(1, b.foo(10)); Expect.equals(2, b.foo(10, 20)); - Expect.throws(() => b.foo(10, 20, 30)); Expect.equals(1, b.foo(10)); Expect.equals(2, b.foo(null, 20)); - Expect.throws(() => b.foo(10, 20, 30)); } main() { diff --git a/tests/compiler/dart2js_native/native_call_arity3_frog_test.dart b/tests/compiler/dart2js_native/native_call_arity3_frog_test.dart index cd7996bee27..3be458567a4 100644 --- a/tests/compiler/dart2js_native/native_call_arity3_frog_test.dart +++ b/tests/compiler/dart2js_native/native_call_arity3_frog_test.dart @@ -65,10 +65,7 @@ testStaticContext() { A a = makeA(); B b = makeB(); - Expect.throws(() => a.foo()); Expect.equals(1, a.foo(10)); - Expect.throws(() => a.foo(10, 20)); - Expect.throws(() => a.foo(10, 20, 30)); Expect.equals(0, b.foo()); Expect.equals(1, b.foo(10)); @@ -78,7 +75,6 @@ testStaticContext() { Expect.equals(1, b.foo(10)); Expect.equals(2, b.foo(null, 20)); Expect.equals(3, b.foo(null, null, 30)); - Expect.throws(() => b.foo(10, 20, 30, 40)); } main() { diff --git a/tests/compiler/dart2js_native/native_checked_arguments1_frog_test.dart b/tests/compiler/dart2js_native/native_checked_arguments1_frog_test.dart index ef2d077dc11..ddce60e8ebb 100644 --- a/tests/compiler/dart2js_native/native_checked_arguments1_frog_test.dart +++ b/tests/compiler/dart2js_native/native_checked_arguments1_frog_test.dart @@ -50,8 +50,8 @@ expectThrows(action()) { Expect.isTrue(threw); } -checkedModeTest() { - var things = [makeA(), makeB()]; +complianceModeTest() { + var things = [makeA(), makeB()]; var a = things[0]; var b = things[1]; @@ -68,28 +68,10 @@ checkedModeTest() { Expect.equals(1, b.cmp(b)); expectThrows(() => b.cmp(a)); expectThrows(() => b.cmp(5)); - - // Check that we throw the same errors when the locals are typed. - A aa = things[0]; - B bb = things[1]; - - Expect.equals(124, aa.foo(123)); - expectThrows(() => aa.foo('xxx')); - - Expect.equals('helloha!', bb.foo('hello')); - expectThrows(() => bb.foo(123)); - - Expect.equals(0, aa.cmp(aa)); - expectThrows(() => aa.cmp(bb)); - expectThrows(() => aa.cmp(5)); - - Expect.equals(1, bb.cmp(bb)); - expectThrows(() => bb.cmp(aa)); - expectThrows(() => bb.cmp(5)); } -uncheckedModeTest() { - var things = [makeA(), makeB()]; +omitImplicitChecksModeTest() { + var things = [makeA(), makeB()]; var a = things[0]; var b = things[1]; @@ -106,30 +88,12 @@ uncheckedModeTest() { Expect.equals(1, b.cmp(b)); Expect.equals(1, b.cmp(a)); Expect.equals(1, b.cmp(5)); - - // Check that we do not throw errors when the locals are typed. - A aa = things[0]; - B bb = things[1]; - - Expect.equals(124, aa.foo(123)); - Expect.equals('xxx1', aa.foo('xxx')); - - Expect.equals('helloha!', bb.foo('hello')); - Expect.equals('123ha!', bb.foo(123)); - - Expect.equals(0, aa.cmp(aa)); - Expect.equals(0, aa.cmp(bb)); - Expect.equals(0, aa.cmp(5)); - - Expect.equals(1, bb.cmp(bb)); - Expect.equals(1, bb.cmp(aa)); - Expect.equals(1, bb.cmp(5)); } -bool isCheckedMode() { - var stuff = [1, 'string']; - var a = stuff[0]; - // Checked-mode detection. +bool isComplianceMode() { + var stuff = [1, 'string']; + dynamic a = stuff[0]; + // compliance-mode detection. try { String s = a; return false; @@ -143,9 +107,9 @@ main() { nativeTesting(); setup(); - if (isCheckedMode()) { - checkedModeTest(); + if (isComplianceMode()) { + complianceModeTest(); } else { - uncheckedModeTest(); + omitImplicitChecksModeTest(); } } diff --git a/tests/compiler/dart2js_native/native_checked_fields_frog_test.dart b/tests/compiler/dart2js_native/native_checked_fields_frog_test.dart index ffc9d387041..f9fdece8b44 100644 --- a/tests/compiler/dart2js_native/native_checked_fields_frog_test.dart +++ b/tests/compiler/dart2js_native/native_checked_fields_frog_test.dart @@ -44,8 +44,8 @@ expectThrows(action()) { Expect.isTrue(threw); } -checkedModeTest() { - var things = [makeA(), makeB()]; +complianceModeTest() { + var things = [makeA(), makeB()]; var a = things[0]; var b = things[1]; @@ -56,22 +56,10 @@ checkedModeTest() { b.foo = 'hello'; expectThrows(() => b.foo = 123); Expect.equals('hello', b.foo); - - // Check that we throw the same errors when the locals are typed. - A aa = things[0]; - B bb = things[1]; - - aa.foo = 124; - expectThrows(() => aa.foo = 'xxx'); - Expect.equals(124, aa.foo); - - bb.foo = 'hello'; - expectThrows(() => bb.foo = 124); - Expect.equals('hello', bb.foo); } -uncheckedModeTest() { - var things = [makeA(), makeB()]; +omitImplicitChecksTest() { + var things = [makeA(), makeB()]; var a = things[0]; var b = things[1]; @@ -84,26 +72,12 @@ uncheckedModeTest() { Expect.equals('hello', b.foo); b.foo = 123; Expect.equals(b.foo, 123); - - // Check that we do not throw errors when the locals are typed. - A aa = things[0]; - B bb = things[1]; - - aa.foo = 124; - Expect.equals(124, aa.foo); - a.foo = 'yyy'; - Expect.equals('yyy', a.foo); - - b.foo = 'hello'; - Expect.equals('hello', b.foo); - b.foo = 124; - Expect.equals(b.foo, 124); } -bool isCheckedMode() { +bool isComplianceMode() { var stuff = [1, 'string']; var a = stuff[0]; - // Checked-mode detection. + // Detect whether we are using --omit-implicit-checks. try { String s = a; return false; @@ -117,9 +91,9 @@ main() { nativeTesting(); setup(); - if (isCheckedMode()) { - checkedModeTest(); + if (isComplianceMode()) { + complianceModeTest(); } else { - uncheckedModeTest(); + omitImplicitChecksTest(); } } diff --git a/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart b/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart index 3691959a334..322dcba9633 100644 --- a/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart +++ b/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart @@ -104,7 +104,7 @@ main() { caught = false; try { - var x = 123; + dynamic x = 123; x.foo(20); } catch (ex) { caught = true; diff --git a/tests/compiler/dart2js_native/native_class_inheritance4_frog_test.dart b/tests/compiler/dart2js_native/native_class_inheritance4_frog_test.dart index 6a2fff5c1ed..25f8fcdb284 100644 --- a/tests/compiler/dart2js_native/native_class_inheritance4_frog_test.dart +++ b/tests/compiler/dart2js_native/native_class_inheritance4_frog_test.dart @@ -111,7 +111,7 @@ testBasicB_typed() { testAB_dynamic() { setup(); // Fresh constructors. - var things = [makeA(), makeB()]; + var things = [makeA(), makeB()]; var a = things[0]; var b = things[1]; diff --git a/tests/compiler/dart2js_native/native_class_is_check1_frog_test.dart b/tests/compiler/dart2js_native/native_class_is_check1_frog_test.dart index 5034e0e6155..6b8bb3798c0 100644 --- a/tests/compiler/dart2js_native/native_class_is_check1_frog_test.dart +++ b/tests/compiler/dart2js_native/native_class_is_check1_frog_test.dart @@ -8,7 +8,7 @@ import "native_testing.dart"; abstract class I { I read(); - write(I x); + write(covariant I x); } // Native implementation. diff --git a/tests/compiler/dart2js_native/native_class_is_check3_frog_test.dart b/tests/compiler/dart2js_native/native_class_is_check3_frog_test.dart index 850f25d8005..98cbf91aa84 100644 --- a/tests/compiler/dart2js_native/native_class_is_check3_frog_test.dart +++ b/tests/compiler/dart2js_native/native_class_is_check3_frog_test.dart @@ -10,7 +10,7 @@ abstract class J {} abstract class I extends J { I read(); - write(I x); + write(covariant I x); } // Native implementation. diff --git a/tests/compiler/dart2js_native/native_constructor_name_test.dart b/tests/compiler/dart2js_native/native_constructor_name_test.dart index dbe9984a53b..9d60a40d85b 100644 --- a/tests/compiler/dart2js_native/native_constructor_name_test.dart +++ b/tests/compiler/dart2js_native/native_constructor_name_test.dart @@ -32,7 +32,7 @@ main() { nativeTesting(); setup(); - var a = new A(); + dynamic a = new A(); var z = makeZ(); Expect.equals(100, z.foo()); diff --git a/tests/compiler/dart2js_native/native_method_inlining_test.dart b/tests/compiler/dart2js_native/native_method_inlining_test.dart index ac3be9598f3..ec5e1ad4ccd 100644 --- a/tests/compiler/dart2js_native/native_method_inlining_test.dart +++ b/tests/compiler/dart2js_native/native_method_inlining_test.dart @@ -77,16 +77,6 @@ void setup() { })()"""); } -bool get isCheckedMode { - int i = 0; - try { - i = 'a'; - } catch (e) { - return true; - } - return false; -} - void match(String s, String pattern1) { var pattern2 = pattern1.replaceAll(' ', ''); Expect.isTrue(s.contains(pattern1) || s.contains(pattern2), @@ -103,19 +93,11 @@ test1() { String method1 = findMethodTextContaining(new B(), '(Method1Tag)'); Expect.isNotNull(method1, 'No method found containing "(Method1Tag)"'); - if (isCheckedMode) { - match(method1, r'foo()'); - // TODO: inlining in checked mode. - nomatch(method1, r'foo(1)'); - // t1.foo$3(x, 3, 10, 30) or y.EL(z,3,10,30) - match(method1, r', 3, 10, 30)'); - } else { - // Direct (inlined) calls don't have $3 or minified names. - match(method1, r'.foo()'); - match(method1, r'.foo(1)'); - match(method1, r'.foo(2, 10)'); - match(method1, r'.foo(3, 10, 30)'); - } + // Direct (inlined) calls don't have $3 or minified names. + match(method1, r'.foo()'); + match(method1, r'.foo(1)'); + match(method1, r'.foo(2, 10)'); + match(method1, r'.foo(3, 10, 30)'); // Ensure the methods are compiled by calling them. var a = makeA(); diff --git a/tests/compiler/dart2js_native/native_mirror_test.dart b/tests/compiler/dart2js_native/native_mirror_test.dart deleted file mode 100644 index 99551c6104d..00000000000 --- a/tests/compiler/dart2js_native/native_mirror_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2011, 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. - -// Intercepted members need to be accessed in a different way than normal -// members. In this test the native class A (thus being intercepted) has a -// member "foo", that is final. Therefore only the getter needs to be -// intercepted. Dart2js had a bug where it used the intercepted -// calling-convention for parts of the compiler, and the non-intercepted -// convention for others, making this fail. - -import 'native_testing.dart'; -import 'dart:_js_helper'; -import 'dart:mirrors'; - -@Native("A") -class A { - final foo; -} - -class B { - String foo; -} - -main() { - var b = new B(); - reflect(b).setField(new Symbol("foo"), "bar"); - Expect.equals("bar", b.foo); -} diff --git a/tests/compiler/dart2js_native/native_missing_method1_frog_test.dart b/tests/compiler/dart2js_native/native_missing_method1_frog_test.dart index 7cc54be8250..d0595f65355 100644 --- a/tests/compiler/dart2js_native/native_missing_method1_frog_test.dart +++ b/tests/compiler/dart2js_native/native_missing_method1_frog_test.dart @@ -33,7 +33,7 @@ class B { typedContext() { confuse(new B()).foo(); - A a = makeA(); + dynamic a = makeA(); Expect.throws(() => a.foo(), (e) => e is NoSuchMethodError); Expect.throws(() => a.foo, (e) => e is NoSuchMethodError); Expect.throws(() => a.foo = 4, (e) => e is NoSuchMethodError); diff --git a/tests/compiler/dart2js_native/native_missing_method2_frog_test.dart b/tests/compiler/dart2js_native/native_missing_method2_frog_test.dart index 13efaa9c61e..ae5799f3929 100644 --- a/tests/compiler/dart2js_native/native_missing_method2_frog_test.dart +++ b/tests/compiler/dart2js_native/native_missing_method2_frog_test.dart @@ -33,8 +33,8 @@ class C { } } -typedContext() { - A a = makeA(); +inferredContext() { + dynamic a = makeA(); Expect.throws(() => a.foo(), (e) => e is NoSuchMethodError); Expect.throws(() => a.foo, (e) => e is NoSuchMethodError); Expect.throws(() => a.foo = 4, (e) => e is NoSuchMethodError); @@ -52,6 +52,6 @@ main() { setup(); confuse(new B()).foo(); confuse(new C()).foo(1); - typedContext(); + inferredContext(); untypedContext(); } diff --git a/tests/compiler/dart2js_native/native_mixin_field_test.dart b/tests/compiler/dart2js_native/native_mixin_field_test.dart index 1b6d9d96818..7f1aebb1d6c 100644 --- a/tests/compiler/dart2js_native/native_mixin_field_test.dart +++ b/tests/compiler/dart2js_native/native_mixin_field_test.dart @@ -47,9 +47,9 @@ main() { setup(); A a = makeA(); Expect.equals("A-foo", a.foo); - Expect.throws(() => a.bar, (e) => e is NoSuchMethodError); - Expect.throws(() => a.baz, (e) => e is NoSuchMethodError); - Expect.throws(() => a.buz, (e) => e is NoSuchMethodError); + Expect.throws(() => (a as dynamic).bar, (e) => e is NoSuchMethodError); + Expect.throws(() => (a as dynamic).baz, (e) => e is NoSuchMethodError); + Expect.throws(() => (a as dynamic).buz, (e) => e is NoSuchMethodError); B b = makeB(); Expect.equals("A-foo", b.foo); @@ -59,14 +59,14 @@ main() { Expect.isNull(b.buz); M1 m1 = new M1(); - Expect.throws(() => m1.foo, (e) => e is NoSuchMethodError); - Expect.throws(() => m1.bar, (e) => e is NoSuchMethodError); + Expect.throws(() => (m1 as dynamic).foo, (e) => e is NoSuchMethodError); + Expect.throws(() => (m1 as dynamic).bar, (e) => e is NoSuchMethodError); Expect.isNull(m1.baz); - Expect.throws(() => m1.buz, (e) => e is NoSuchMethodError); + Expect.throws(() => (m1 as dynamic).buz, (e) => e is NoSuchMethodError); M2 m2 = new M2(); - Expect.throws(() => m2.foo, (e) => e is NoSuchMethodError); + Expect.throws(() => (m2 as dynamic).foo, (e) => e is NoSuchMethodError); Expect.isNull(m2.bar); - Expect.throws(() => m2.baz, (e) => e is NoSuchMethodError); + Expect.throws(() => (m2 as dynamic).baz, (e) => e is NoSuchMethodError); Expect.isNull(m2.buz); } diff --git a/tests/compiler/dart2js_native/native_mixin_multiple_test.dart b/tests/compiler/dart2js_native/native_mixin_multiple_test.dart index 2cbbb24a11a..310d75b8468 100644 --- a/tests/compiler/dart2js_native/native_mixin_multiple_test.dart +++ b/tests/compiler/dart2js_native/native_mixin_multiple_test.dart @@ -47,7 +47,8 @@ main() { setup(); A a = makeA(); Expect.equals("A-foo", a.foo()); - Expect.throws(() => a.bar(), (error) => error is NoSuchMethodError); + Expect.throws( + () => (a as dynamic).bar(), (error) => error is NoSuchMethodError); Expect.equals("A-baz", a.baz()); Expect.isTrue(a is A); Expect.isFalse(a is B); @@ -65,7 +66,8 @@ main() { M1 m1 = new M1(); Expect.equals("M1-foo", m1.foo()); - Expect.throws(() => m1.bar(), (error) => error is NoSuchMethodError); + Expect.throws( + () => (m1 as dynamic).bar(), (error) => error is NoSuchMethodError); Expect.equals("M1-baz", m1.baz()); Expect.isFalse(m1 is A); Expect.isFalse(m1 is B); @@ -74,8 +76,10 @@ main() { M2 m2 = new M2(); Expect.equals("M2-foo", m2.foo()); - Expect.throws(() => m2.bar(), (error) => error is NoSuchMethodError); - Expect.throws(() => m2.baz(), (error) => error is NoSuchMethodError); + Expect.throws( + () => (m2 as dynamic).bar(), (error) => error is NoSuchMethodError); + Expect.throws( + () => (m2 as dynamic).baz(), (error) => error is NoSuchMethodError); Expect.isFalse(m2 is A); Expect.isFalse(m2 is B); Expect.isFalse(m2 is M1); diff --git a/tests/compiler/dart2js_native/native_mixin_test.dart b/tests/compiler/dart2js_native/native_mixin_test.dart index e214185905f..64bd3e43118 100644 --- a/tests/compiler/dart2js_native/native_mixin_test.dart +++ b/tests/compiler/dart2js_native/native_mixin_test.dart @@ -43,7 +43,8 @@ main() { setup(); A a = makeA(); Expect.equals("A-foo", a.foo()); - Expect.throws(() => a.bar(), (error) => error is NoSuchMethodError); + Expect.throws( + () => (a as dynamic).bar(), (error) => error is NoSuchMethodError); Expect.equals("A-baz", a.baz()); Expect.isTrue(a is A); Expect.isFalse(a is B); @@ -60,7 +61,8 @@ main() { M m = new M(); Expect.equals("M-foo", m.foo()); Expect.equals("M-bar", m.bar()); - Expect.throws(() => m.baz(), (error) => error is NoSuchMethodError); + Expect.throws( + () => (m as dynamic).baz(), (error) => error is NoSuchMethodError); Expect.isFalse(m is A); Expect.isFalse(m is B); Expect.isTrue(m is M); diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test.dart b/tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test.dart deleted file mode 100644 index 04597032899..00000000000 --- a/tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test.dart +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2012, 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" show reflect; -import "native_testing.dart"; - -class GetName { - foo(x, y, [z]) => "foo"; -} - -String getName(im) => reflect(new GetName()).delegate(im); - -@Native("A") -class A { - bar() => 42; -} - -@Native("B") -class B { - foo() => 42; -} - -class C { - static create() => new C(); - noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; -} - -makeA() native; - -setup() { - JS('', r""" -(function(){ - function A() {} - makeA = function() { return new A(); }; - - self.nativeConstructor(A); -})()"""); -} - -main() { - nativeTesting(); - setup(); - var a = makeA(); - a.bar(); - var exception; - try { - a.foo(); - } on NoSuchMethodError catch (e) { - exception = e; - } - Expect.isNotNull(exception); - var c = C.create(); - Expect.equals("foo:[1, 2]", c.foo(1, 2)); - Expect.equals("foo:[3, 4, 5]", c.foo(3, 4, 5)); -} diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test.dart b/tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test.dart deleted file mode 100644 index ad77c896919..00000000000 --- a/tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test.dart +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2012, 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" show reflect; -import "native_testing.dart"; - -class GetName { - foo(x, y) => "foo"; - baz(x, y, z) => "baz"; -} - -String getName(im) => reflect(new GetName()).delegate(im); - -@Native("A") -class A { - bar() => 42; - noSuchMethod(x) => "native(${getName(x)}:${x.positionalArguments})"; -} - -@Native("B") -class B { - baz() => 42; -} - -makeA() native; - -setup() { - JS('', r""" -(function(){ - function A() {} - makeA = function() { return new A(); }; - self.nativeConstructor(A); -})()"""); -} - -main() { - nativeTesting(); - setup(); - var a = makeA(); - a.bar(); - Expect.equals("native(foo:[1, 2])", a.foo(1, 2)); - Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5)); -} diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test.dart b/tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test.dart deleted file mode 100644 index 2a2fd6b28c6..00000000000 --- a/tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test.dart +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2012, 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" show reflect; -import "native_testing.dart"; - -class GetName { - foo(x, [y]) => "foo"; - baz(x, y, z) => "baz"; -} - -String getName(im) => reflect(new GetName()).delegate(im); - -@Native("A") -class A { - bar() => 42; - noSuchMethod(x) => "native(${getName(x)}:${x.positionalArguments})"; -} - -@Native("B") -class B { - baz() => 42; -} - -class C { - static create() => new C(); - noSuchMethod(x) => "${getName(x)}:${x.positionalArguments}"; -} - -makeA() native; - -setup() { - JS('', r""" -(function(){ - function A() {} - makeA = function() { return new A(); }; - self.nativeConstructor(A); -})()"""); -} - -main() { - nativeTesting(); - setup(); - var a = makeA(); - a.bar(); - Expect.equals("native(foo:[1, 2])", a.foo(1, 2)); - Expect.equals("native(baz:[3, 4, 5])", a.baz(3, 4, 5)); - var c = C.create(); - Expect.equals("foo:[6]", c.foo(6)); -} diff --git a/tests/compiler/dart2js_native/native_window1_frog_test.dart b/tests/compiler/dart2js_native/native_window1_frog_test.dart index fd186416bad..f47b66d4fd2 100644 --- a/tests/compiler/dart2js_native/native_window1_frog_test.dart +++ b/tests/compiler/dart2js_native/native_window1_frog_test.dart @@ -15,7 +15,9 @@ class _DOMWindowJs implements Window { final int document; } -class Win implements Window {} +class Win implements Window { + noSuchMethod(m) => super.noSuchMethod(m); +} main() { nativeTesting(); diff --git a/tests/compiler/dart2js_native/native_window2_frog_test.dart b/tests/compiler/dart2js_native/native_window2_frog_test.dart index 77846c3470e..143c1e6a5b0 100644 --- a/tests/compiler/dart2js_native/native_window2_frog_test.dart +++ b/tests/compiler/dart2js_native/native_window2_frog_test.dart @@ -15,12 +15,14 @@ class _DOMWindowJs implements Window { final int document; } -class Win implements Window {} +class Win implements Window { + noSuchMethod(m) => super.noSuchMethod(m); +} main() { nativeTesting(); // By not typing the variable, Frog does not try to optimize calls // on it. - var win = new Win(); + dynamic win = new Win(); Expect.throws(() => win.document, (e) => e is NoSuchMethodError); } diff --git a/tests/compiler/dart2js_native/rti_only_native_test.dart b/tests/compiler/dart2js_native/rti_only_native_test.dart index 172d0baacf7..ec2fa52516e 100644 --- a/tests/compiler/dart2js_native/rti_only_native_test.dart +++ b/tests/compiler/dart2js_native/rti_only_native_test.dart @@ -19,7 +19,7 @@ typedef fisk(); main() { void foo(A x) {} - var map = {'a': 0, 'b': main}; + var map = {'a': 0, 'b': main}; try { map.values.forEach((x) => x.rti_only_native_test_field); } finally { diff --git a/tests/compiler/dart2js_native/static_methods_test.dart b/tests/compiler/dart2js_native/static_methods_test.dart index d8badecbf66..d356c2580bc 100644 --- a/tests/compiler/dart2js_native/static_methods_test.dart +++ b/tests/compiler/dart2js_native/static_methods_test.dart @@ -57,19 +57,14 @@ main() { nativeTesting(); setup(); - // TODO(sra): Investigate why this line is necessary to get a correctly - // compiled convertDartClosureToJS. Without this line, the compiler crashes. - convertDartClosureToJS(main, 1); - Expect.equals(5, AA.foo("Hello")); - Expect.equals(3, AA.bar((s) => s.length)); - Expect.equals(3, AA.baz((s) => s.length)); + Expect.equals(3, AA.bar((String s) => s.length)); + Expect.equals(3, AA.baz((String s) => s.length)); - Expect.equals(6, AA.lepton((s) => s.length)); - Expect.equals(6, AA.electron((s) => s.length)); + Expect.equals(6, AA.lepton((String s) => s.length)); + Expect.equals(6, AA.electron((String s) => s.length)); - Expect.equals(12, AA._baryon((s) => s.length)); - Expect.equals(12, AA.proton((s) => s.length)); - Expect.throws(() => AA.baryon((s) => s.length)); // Not defined on AA. + Expect.equals(12, AA._baryon((String s) => s.length)); + Expect.equals(12, AA.proton((String s) => s.length)); } diff --git a/tests/compiler/dart2js_native/type_error_decode_test.dart b/tests/compiler/dart2js_native/type_error_decode_test.dart index 1c37f03964a..ba972102b89 100644 --- a/tests/compiler/dart2js_native/type_error_decode_test.dart +++ b/tests/compiler/dart2js_native/type_error_decode_test.dart @@ -34,18 +34,18 @@ expectThrows(f, check) { } main() { - var x = null; - var z = new Object(); - var v = new List(1)[0]; - var s = "Cannot call method 'foo' of null"; - var nul = null; - var f = new Foo(); + dynamic x = null; + dynamic z = new Object(); + dynamic v = new List(1)[0]; + dynamic s = "Cannot call method 'foo' of null"; + dynamic nul = null; + dynamic f = new Foo(); expectThrows(() => x.fisk(), isNullError); expectThrows(() => v.fisk(), isNullError); expectThrows(() => z.fisk(), isJsNoSuchMethodError); expectThrows(() => s.fisk(), isJsNoSuchMethodError); - expectThrows(() => null(), isNullError); + expectThrows(() => (null as dynamic)(), isNullError); expectThrows(() => f.field(), isNullError); expectThrows(() => confuse(x).fisk(), isNullError);