Revert "migrate function type tests"
This reverts commit ca6bec3414d21c883b86a7d30c52393fda70a737.
R=whesse@google.com
Change-Id: I57195534c4c32e0fcf0cd88f5171984b126be26e
Reviewed-on: https://dart-review.googlesource.com/6466
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Karl Klose <karlklose@google.com>
diff --git a/tests/language_2/function_subtype_bound_closure7_test.dart b/tests/language_2/function_subtype_bound_closure7_test.dart
deleted file mode 100644
index 2e16207..0000000
--- a/tests/language_2/function_subtype_bound_closure7_test.dart
+++ /dev/null
@@ -1,35 +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.
-// Dart test program for constructors and initializers.
-
-// Check function subtyping for bound closures.
-
-import 'package:expect/expect.dart';
-
-typedef Foo<T>(T t);
-
-class Class<T> {
- foo(Foo<T> o) => o is Foo<T>;
-}
-
-bar(int i) {}
-
-baz<T>(Foo<T> o) => o is Foo<T>;
-
-void main() {
- dynamic f = new Class<int>().foo;
- Expect.isTrue(f(bar));
- Expect.isTrue(f is Foo<Foo<int>>);
- Expect.isFalse(f is Foo<int>);
- Expect.isFalse(f is Foo<Object>);
- Expect.throwsTypeError(() => f(f));
- Expect.throwsTypeError(() => f(42));
-
- Foo<Foo<int>> bazInt = baz; // implicit instantiation baz<int>
- f = bazInt;
- Expect.isTrue(f(bar));
- Expect.isFalse(f is Foo<int>);
- Expect.throwsTypeError(() => f(f));
- Expect.throwsTypeError(() => f(42));
-}
diff --git a/tests/language_2/function_subtype_typearg5_test.dart b/tests/language_2/function_subtype_typearg5_test.dart
deleted file mode 100644
index 763e187..0000000
--- a/tests/language_2/function_subtype_typearg5_test.dart
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Check function subtyping of type arguments. These cases use typedefs as type
-// arguments, and the typedefs have type parameters that are used more than
-// once.
-
-import 'package:expect/expect.dart';
-
-typedef A F<A>(A arg1, A arg2);
-typedef B G<A, B>(B arg1, B arg2);
-
-typedef Set<A> FS<A>(Set<A> arg1, Set<A> arg2);
-
-@NoInline()
-@AssumeDynamic()
-dyn(x) => x;
-
-class CheckEnv<X, Y> {
- test(bool intX) {
- Expect.isTrue(<F<X>>[] is List<F>);
- Expect.isTrue(<F<X>>[] is List<F<X>>);
- Expect.isTrue(<F<X>>[] is List<G<Y, X>>);
-
- Expect.isTrue(dyn(<F<X>>[]) is List<F>);
- Expect.isTrue(dyn(<F<X>>[]) is List<F<X>>);
- Expect.isTrue(dyn(<F<X>>[]) is List<G<Y, X>>);
-
- Expect.isFalse(<F<X>>[] is List<F<Y>>);
- Expect.isFalse(<F<X>>[] is List<G<X, Y>>);
-
- Expect.isFalse(dyn(<F<X>>[]) is List<F<Y>>);
- Expect.isFalse(dyn(<F<X>>[]) is List<G<X, Y>>);
-
- Expect.isFalse(dyn(<FS<X>>[]) is List<FS>);
- Expect.isFalse(dyn(<FS<X>>[]) is List<FS<Null>>);
- Expect.isTrue(dyn(<FS<X>>[]) is List<FS<X>>);
- if (intX) {
- Expect.isTrue(dyn(<FS<X>>[]) is List<FS<int>>);
- Expect.isTrue(dyn(<FS<int>>[]) is List<FS<X>>);
- Expect.isFalse(dyn(<FS<Y>>[]) is List<FS<int>>);
- Expect.isFalse(dyn(<FS<int>>[]) is List<FS<Y>>);
- }
- }
-}
-
-main() {
- Expect.isTrue(<F<int>>[] is List<F<int>>);
- Expect.isTrue(dyn(<F<int>>[]) is List<F<int>>);
- Expect.isTrue(<F<int>>[] is List<G<bool, int>>);
- Expect.isTrue(dyn(<F<int>>[]) is List<G<bool, int>>);
-
- new CheckEnv<int, String>().test(true);
- new CheckEnv<String, int>().test(false);
-}
diff --git a/tests/language_2/function_type2_test.dart b/tests/language_2/function_type2_test.dart
deleted file mode 100644
index 42ca6ff..0000000
--- a/tests/language_2/function_type2_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.
-
-import "package:expect/expect.dart";
-
-class A<T> {
- A(f) {
- f(42);
- }
-}
-
-class B<T> extends A<T> {
- B() : super((T param) => 42);
-}
-
-main() {
- var t = new B<int>();
- Expect.throwsTypeError(() => new B<String>());
-}
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index d9d4bcc..7186b7f 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -273,29 +273,6 @@
many_generic_instanceof_test: RuntimeError
[ $compiler == dart2js && $runtime != none && !$checked && !$dart2js_with_kernel ]
-function_subtype_bound_closure3_test: RuntimeError
-function_subtype_bound_closure4_test: RuntimeError
-function_subtype_bound_closure7_test: RuntimeError
-function_subtype_call1_test: RuntimeError
-function_subtype_call2_test: RuntimeError
-function_subtype_cast1_test: RuntimeError
-function_subtype_checked0_test: RuntimeError
-function_subtype_closure0_test: RuntimeError
-function_subtype_closure1_test: RuntimeError
-function_subtype_factory1_test: RuntimeError
-function_subtype_inline1_test: RuntimeError
-function_subtype_named1_test: RuntimeError
-function_subtype_named2_test: RuntimeError
-function_subtype_not1_test: RuntimeError
-function_subtype_optional1_test: RuntimeError
-function_subtype_optional2_test: RuntimeError
-function_subtype_regression_ddc_588_test: RuntimeError
-function_subtype_setter0_test: RuntimeError
-function_subtype_typearg2_test: RuntimeError
-function_subtype_typearg3_test: RuntimeError
-function_subtype_typearg5_test: RuntimeError
-function_type2_test: RuntimeError
-function_type_alias2_test: RuntimeError
generic_field_mixin6_test/none: RuntimeError
generic_list_checked_test: RuntimeError
getters_setters2_test/01: RuntimeError
@@ -513,21 +490,6 @@
function_type/function_type90_test: RuntimeError # Issue 30476
function_type/function_type96_test: RuntimeError # Issue 30476
function_type/function_type9_test: RuntimeError # Issue 30476
-function_subtype_bound_closure3_test: RuntimeError
-function_subtype_bound_closure4_test: RuntimeError
-function_subtype_bound_closure7_test: RuntimeError
-function_subtype_call1_test: RuntimeError
-function_subtype_call2_test: RuntimeError
-function_subtype_cast1_test: RuntimeError
-function_subtype_named1_test: RuntimeError
-function_subtype_named2_test: RuntimeError
-function_subtype_not1_test: RuntimeError
-function_subtype_optional1_test: RuntimeError
-function_subtype_optional2_test: RuntimeError
-function_subtype_typearg2_test: RuntimeError
-function_subtype_typearg3_test: RuntimeError
-function_subtype_typearg5_test: RuntimeError
-function_type_alias2_test: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
assert_message_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
@@ -703,17 +665,6 @@
deferred_load_library_wrong_args_test/none: CompileTimeError
deferred_mixin_test: CompileTimeError
deferred_no_prefix_test/01: MissingCompileTimeError
-function_subtype_cast2_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#)) for j:closure_call(Class_test_closure.call).
-function_subtype_cast3_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#local)) for j:closure_call(Class_test_closure.call).
-function_subtype_closure0_test: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
-function_subtype_inline0_test: RuntimeError
-function_subtype_local3_test: RuntimeError
-function_subtype_local4_test: RuntimeError
-function_subtype_not3_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#local)) for j:closure_call(Class_test_closure.call).
-function_subtype_typearg2_test: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
-function_subtype_typearg3_test: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
-function_syntax_test/none: RuntimeError
-function_test: RuntimeError
generalized_void_syntax_test: CompileTimeError
generic_async_star_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
generic_async_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
@@ -957,17 +908,6 @@
deferred_load_library_wrong_args_test/none: CompileTimeError
deferred_mixin_test: CompileTimeError
deferred_no_prefix_test/01: MissingCompileTimeError
-function_subtype_cast2_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#)) for j:closure_call(Class_test_closure.call).
-function_subtype_cast3_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#local)) for j:closure_call(Class_test_closure.call).
-function_subtype_closure0_test: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
-function_subtype_inline0_test: RuntimeError
-function_subtype_local3_test: RuntimeError
-function_subtype_local4_test: RuntimeError
-function_subtype_not3_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#local)) for j:closure_call(Class_test_closure.call).
-function_subtype_typearg2_test: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
-function_subtype_typearg3_test: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
-function_syntax_test/none: RuntimeError
-function_test: RuntimeError
generalized_void_syntax_test: CompileTimeError
generic_async_star_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
generic_async_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 2e3b960..4d8648ce 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -61,12 +61,6 @@
deferred_load_inval_code_test: RuntimeError
deferred_load_library_wrong_args_test/none: RuntimeError
deferred_mixin_test: RuntimeError
-function_subtype_bound_closure3_test: RuntimeError
-function_subtype_bound_closure4_test: RuntimeError
-function_subtype_cast1_test: RuntimeError
-function_subtype_not1_test: RuntimeError
-function_subtype_regression_ddc_588_test: RuntimeError
-function_type_alias2_test: RuntimeError
generic_function_dcall_test: CompileTimeError
generic_methods_bounds_test/01: MissingCompileTimeError
generic_methods_dynamic_test/01: MissingCompileTimeError
@@ -205,7 +199,6 @@
assert_initializer_test/none: RuntimeError # KernelVM bug: Constant evaluation.
compile_time_constant_checked_test/02: MissingCompileTimeError
default_factory2_test/01: Fail
-function_type2_test: RuntimeError
[ $compiler == dartk || $compiler == dartkp ]
cha_deopt1_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
diff --git a/tests/language_2/language_2_precompiled.status b/tests/language_2/language_2_precompiled.status
index 2fba1ce..0a17c48 100644
--- a/tests/language_2/language_2_precompiled.status
+++ b/tests/language_2/language_2_precompiled.status
@@ -283,29 +283,6 @@
generic_constructor_mixin3_test/01: MissingCompileTimeError
generic_methods_recursive_bound_test/02: MissingCompileTimeError
typevariable_substitution2_test/02: RuntimeError
-function_subtype_bound_closure3_test: RuntimeError
-function_subtype_bound_closure4_test: RuntimeError
-function_subtype_bound_closure7_test: RuntimeError
-function_subtype_call1_test: RuntimeError
-function_subtype_call2_test: RuntimeError
-function_subtype_cast1_test: RuntimeError
-function_subtype_checked0_test: RuntimeError
-function_subtype_closure0_test: RuntimeError
-function_subtype_closure1_test: RuntimeError
-function_subtype_factory1_test: RuntimeError
-function_subtype_inline1_test: RuntimeError
-function_subtype_named1_test: RuntimeError
-function_subtype_named2_test: RuntimeError
-function_subtype_not1_test: RuntimeError
-function_subtype_optional1_test: RuntimeError
-function_subtype_optional2_test: RuntimeError
-function_subtype_regression_ddc_588_test: RuntimeError
-function_subtype_setter0_test: RuntimeError
-function_subtype_typearg2_test: RuntimeError
-function_subtype_typearg3_test: RuntimeError
-function_subtype_typearg5_test: RuntimeError
-function_type2_test: RuntimeError
-function_type_alias2_test: RuntimeError
[ $compiler == precompiler && $runtime == dart_precompiled && $checked ]
assertion_initializer_const_error2_test/cc01: Pass
@@ -319,14 +296,6 @@
assertion_initializer_const_error2_test/cc10: Pass
assertion_initializer_const_error2_test/cc11: Pass
assertion_initializer_const_error2_test/none: CompileTimeError
-function_subtype_checked0_test: Pass
-function_subtype_closure0_test: Pass
-function_subtype_closure1_test: Pass
-function_subtype_factory1_test: Pass
-function_subtype_inline1_test: Pass
-function_subtype_inline2_test: Pass
-function_subtype_regression_ddc_588_test: Pass
-function_subtype_setter0_test: Pass
[ $compiler == precompiler && $runtime == dart_precompiled && !$checked ]
assertion_initializer_const_error2_test/cc01: Pass, OK
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index bc97c0d..b0f7caa 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -400,21 +400,6 @@
function_type/function_type90_test: RuntimeError # Issue 30475
function_type/function_type96_test: RuntimeError # Issue 30475
function_type/function_type9_test: RuntimeError # Issue 30475
-function_subtype_bound_closure3_test: RuntimeError
-function_subtype_bound_closure4_test: RuntimeError
-function_subtype_bound_closure7_test: RuntimeError
-function_subtype_call1_test: RuntimeError
-function_subtype_call2_test: RuntimeError
-function_subtype_cast1_test: RuntimeError
-function_subtype_named1_test: RuntimeError
-function_subtype_named2_test: RuntimeError
-function_subtype_not1_test: RuntimeError
-function_subtype_optional1_test: RuntimeError
-function_subtype_optional2_test: RuntimeError
-function_subtype_typearg2_test: RuntimeError
-function_subtype_typearg3_test: RuntimeError
-function_subtype_typearg5_test: RuntimeError
-function_type_alias2_test: RuntimeError
# The VM and does not implement the Dart 2.0 runtime checks yet unless
# --checked is explicitly passed).
@@ -429,29 +414,6 @@
if_null_precedence_test/none: RuntimeError
inferrer_synthesized_constructor_test: RuntimeError
typevariable_substitution2_test/02: RuntimeError
-function_subtype_bound_closure3_test: RuntimeError
-function_subtype_bound_closure4_test: RuntimeError
-function_subtype_bound_closure7_test: RuntimeError
-function_subtype_call1_test: RuntimeError
-function_subtype_call2_test: RuntimeError
-function_subtype_cast1_test: RuntimeError
-function_subtype_checked0_test: RuntimeError
-function_subtype_closure0_test: RuntimeError
-function_subtype_closure1_test: RuntimeError
-function_subtype_factory1_test: RuntimeError
-function_subtype_inline1_test: RuntimeError
-function_subtype_named1_test: RuntimeError
-function_subtype_named2_test: RuntimeError
-function_subtype_not1_test: RuntimeError
-function_subtype_optional1_test: RuntimeError
-function_subtype_optional2_test: RuntimeError
-function_subtype_regression_ddc_588_test: RuntimeError
-function_subtype_setter0_test: RuntimeError
-function_subtype_typearg2_test: RuntimeError
-function_subtype_typearg3_test: RuntimeError
-function_subtype_typearg5_test: RuntimeError
-function_type2_test: RuntimeError
-function_type_alias2_test: RuntimeError
# The VM doesn't enforce that potentially const expressions are actually
# const expressions when the constructor is called with `const`.
diff --git a/tests/language_2/function_subtype2_test.dart b/tests/language_strong/function_subtype2_test.dart
similarity index 100%
rename from tests/language_2/function_subtype2_test.dart
rename to tests/language_strong/function_subtype2_test.dart
diff --git a/tests/language_2/function_subtype3_test.dart b/tests/language_strong/function_subtype3_test.dart
similarity index 100%
rename from tests/language_2/function_subtype3_test.dart
rename to tests/language_strong/function_subtype3_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure0_test.dart b/tests/language_strong/function_subtype_bound_closure0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure0_test.dart
rename to tests/language_strong/function_subtype_bound_closure0_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure1_test.dart b/tests/language_strong/function_subtype_bound_closure1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure1_test.dart
rename to tests/language_strong/function_subtype_bound_closure1_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure2_test.dart b/tests/language_strong/function_subtype_bound_closure2_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure2_test.dart
rename to tests/language_strong/function_subtype_bound_closure2_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure3_test.dart b/tests/language_strong/function_subtype_bound_closure3_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure3_test.dart
rename to tests/language_strong/function_subtype_bound_closure3_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure4_test.dart b/tests/language_strong/function_subtype_bound_closure4_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure4_test.dart
rename to tests/language_strong/function_subtype_bound_closure4_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure5_test.dart b/tests/language_strong/function_subtype_bound_closure5_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure5_test.dart
rename to tests/language_strong/function_subtype_bound_closure5_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure5a_test.dart b/tests/language_strong/function_subtype_bound_closure5a_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure5a_test.dart
rename to tests/language_strong/function_subtype_bound_closure5a_test.dart
diff --git a/tests/language_2/function_subtype_bound_closure6_test.dart b/tests/language_strong/function_subtype_bound_closure6_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_bound_closure6_test.dart
rename to tests/language_strong/function_subtype_bound_closure6_test.dart
diff --git a/tests/language_strong/function_subtype_bound_closure7_test.dart b/tests/language_strong/function_subtype_bound_closure7_test.dart
new file mode 100644
index 0000000..4f975ac
--- /dev/null
+++ b/tests/language_strong/function_subtype_bound_closure7_test.dart
@@ -0,0 +1,33 @@
+// 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.
+// Dart test program for constructors and initializers.
+
+// Check function subtyping for bound closures.
+
+import 'package:expect/expect.dart';
+
+typedef void Foo<T>(T t);
+
+class Class<T> {
+ foo(Foo<T> o) => o is Foo<T>;
+}
+
+void bar(int i) {}
+
+void main() {
+ bool inCheckedMode = false;
+ try {
+ String a = 42;
+ } catch (e) {
+ inCheckedMode = true;
+ }
+
+ var f = new Class<int>().foo;
+ Expect.isTrue(f(bar));
+ if (inCheckedMode) {
+ Expect.throws(() => f(f), (e) => true);
+ } else {
+ Expect.isFalse(f(f));
+ }
+}
diff --git a/tests/language_2/function_subtype_call0_test.dart b/tests/language_strong/function_subtype_call0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_call0_test.dart
rename to tests/language_strong/function_subtype_call0_test.dart
diff --git a/tests/language_2/function_subtype_call1_test.dart b/tests/language_strong/function_subtype_call1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_call1_test.dart
rename to tests/language_strong/function_subtype_call1_test.dart
diff --git a/tests/language_2/function_subtype_call2_test.dart b/tests/language_strong/function_subtype_call2_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_call2_test.dart
rename to tests/language_strong/function_subtype_call2_test.dart
diff --git a/tests/language_2/function_subtype_cast0_test.dart b/tests/language_strong/function_subtype_cast0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_cast0_test.dart
rename to tests/language_strong/function_subtype_cast0_test.dart
diff --git a/tests/language_2/function_subtype_cast1_test.dart b/tests/language_strong/function_subtype_cast1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_cast1_test.dart
rename to tests/language_strong/function_subtype_cast1_test.dart
diff --git a/tests/language_2/function_subtype_cast2_test.dart b/tests/language_strong/function_subtype_cast2_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_cast2_test.dart
rename to tests/language_strong/function_subtype_cast2_test.dart
diff --git a/tests/language_2/function_subtype_cast3_test.dart b/tests/language_strong/function_subtype_cast3_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_cast3_test.dart
rename to tests/language_strong/function_subtype_cast3_test.dart
diff --git a/tests/language_2/function_subtype_checked0_test.dart b/tests/language_strong/function_subtype_checked0_test.dart
similarity index 85%
rename from tests/language_2/function_subtype_checked0_test.dart
rename to tests/language_strong/function_subtype_checked0_test.dart
index c5e4e004..ee293d6 100644
--- a/tests/language_2/function_subtype_checked0_test.dart
+++ b/tests/language_strong/function_subtype_checked0_test.dart
@@ -12,9 +12,9 @@
typedef int Baz<T>(T a, {String b});
typedef int Boz<T>(T a);
-int fooF(bool a, [String b]) => null;
-int bazF(bool a, {String b}) => null;
-int bozF(bool a, {int b}) => null;
+int foo(bool a, [String b]) => null;
+int baz(bool a, {String b}) => null;
+int boz(bool a, {int b}) => null;
class C<T> {
void test1a(Foo<T> f) {}
@@ -29,15 +29,13 @@
void test(String nameOfT, bool expectedResult) {
check(bool expectedResult, f()) {
- if (!expectedResult) {
- Expect.throwsTypeError(f);
+ if (inCheckedMode() && !expectedResult) {
+ Expect.throws(f, (e) => true);
} else {
f();
}
}
- dynamic foo = fooF, baz = bazF, boz = bozF;
-
check(expectedResult, () => test1a(foo));
check(expectedResult, () => test1b(foo));
check(expectedResult, () => test1b(foo));
@@ -69,3 +67,13 @@
new C<int>().test('int', false);
new C().test('dynamic', true);
}
+
+bool inCheckedMode() {
+ try {
+ var x = 42;
+ String a = x;
+ } catch (e) {
+ return true;
+ }
+ return false;
+}
diff --git a/tests/language_2/function_subtype_closure0_test.dart b/tests/language_strong/function_subtype_closure0_test.dart
similarity index 73%
rename from tests/language_2/function_subtype_closure0_test.dart
rename to tests/language_strong/function_subtype_closure0_test.dart
index 42125a2..47ace66 100644
--- a/tests/language_2/function_subtype_closure0_test.dart
+++ b/tests/language_strong/function_subtype_closure0_test.dart
@@ -22,6 +22,15 @@
class J<T> extends I<int> {}
main() {
+ bool inCheckedMode = false;
+ try {
+ String a = 42;
+ } catch (e) {
+ inCheckedMode = true;
+ }
+
new C<int>(X.f1);
- Expect.throwsTypeError(() => new C<bool>(X.f1 as dynamic));
+ if (inCheckedMode) {
+ Expect.throws(() => new C<bool>(X.f1), (e) => true);
+ }
}
diff --git a/tests/language_2/function_subtype_closure1_test.dart b/tests/language_strong/function_subtype_closure1_test.dart
similarity index 73%
rename from tests/language_2/function_subtype_closure1_test.dart
rename to tests/language_strong/function_subtype_closure1_test.dart
index 098f4f5..aeb31b3 100644
--- a/tests/language_2/function_subtype_closure1_test.dart
+++ b/tests/language_strong/function_subtype_closure1_test.dart
@@ -22,6 +22,15 @@
class J<T> extends I<int> {}
main() {
+ bool inCheckedMode = false;
+ try {
+ String a = 42;
+ } catch (e) {
+ inCheckedMode = true;
+ }
+
new C<int>(new X().f1);
- Expect.throwsTypeError(() => new C<bool>(new X().f1 as dynamic));
+ if (inCheckedMode) {
+ Expect.throws(() => new C<bool>(new X().f1), (e) => true);
+ }
}
diff --git a/tests/language_2/function_subtype_factory0_test.dart b/tests/language_strong/function_subtype_factory0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_factory0_test.dart
rename to tests/language_strong/function_subtype_factory0_test.dart
diff --git a/tests/language_2/function_subtype_factory1_test.dart b/tests/language_strong/function_subtype_factory1_test.dart
similarity index 69%
rename from tests/language_2/function_subtype_factory1_test.dart
rename to tests/language_strong/function_subtype_factory1_test.dart
index dd7022a..4fb8ab0 100644
--- a/tests/language_2/function_subtype_factory1_test.dart
+++ b/tests/language_strong/function_subtype_factory1_test.dart
@@ -16,5 +16,20 @@
void main() {
Expect.isNotNull(new C<String>(method));
- Expect.throwsTypeError(() => new C<bool>(method as dynamic));
+ try {
+ new C<bool>(method);
+ Expect.isFalse(isCheckedMode());
+ } catch (e) {
+ Expect.isTrue(isCheckedMode());
+ }
+}
+
+isCheckedMode() {
+ try {
+ var i = 1;
+ String s = i;
+ return false;
+ } catch (e) {
+ return true;
+ }
}
diff --git a/tests/language_2/function_subtype_inline0_test.dart b/tests/language_strong/function_subtype_inline0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_inline0_test.dart
rename to tests/language_strong/function_subtype_inline0_test.dart
diff --git a/tests/language_2/function_subtype_inline1_test.dart b/tests/language_strong/function_subtype_inline1_test.dart
similarity index 69%
rename from tests/language_2/function_subtype_inline1_test.dart
rename to tests/language_strong/function_subtype_inline1_test.dart
index 487c63d..90103d5 100644
--- a/tests/language_2/function_subtype_inline1_test.dart
+++ b/tests/language_strong/function_subtype_inline1_test.dart
@@ -21,5 +21,20 @@
Class<B, C> c = new Class<B, C>();
c.forEach((A a, A b) {});
c.forEach((B a, C b) {});
- Expect.throwsTypeError(() => c.forEach((A a, B b) {} as dynamic));
+ try {
+ c.forEach((A a, B b) {});
+ Expect.isFalse(isCheckedMode());
+ } catch (e) {
+ Expect.isTrue(isCheckedMode());
+ }
+}
+
+isCheckedMode() {
+ try {
+ var i = 1;
+ String s = i;
+ return false;
+ } catch (e) {
+ return true;
+ }
}
diff --git a/tests/language_2/function_subtype_local0_test.dart b/tests/language_strong/function_subtype_local0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_local0_test.dart
rename to tests/language_strong/function_subtype_local0_test.dart
diff --git a/tests/language_2/function_subtype_local1_test.dart b/tests/language_strong/function_subtype_local1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_local1_test.dart
rename to tests/language_strong/function_subtype_local1_test.dart
diff --git a/tests/language_2/function_subtype_local2_test.dart b/tests/language_strong/function_subtype_local2_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_local2_test.dart
rename to tests/language_strong/function_subtype_local2_test.dart
diff --git a/tests/language_2/function_subtype_local3_test.dart b/tests/language_strong/function_subtype_local3_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_local3_test.dart
rename to tests/language_strong/function_subtype_local3_test.dart
diff --git a/tests/language_2/function_subtype_local4_test.dart b/tests/language_strong/function_subtype_local4_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_local4_test.dart
rename to tests/language_strong/function_subtype_local4_test.dart
diff --git a/tests/language_2/function_subtype_local5_test.dart b/tests/language_strong/function_subtype_local5_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_local5_test.dart
rename to tests/language_strong/function_subtype_local5_test.dart
diff --git a/tests/language_2/function_subtype_local6_test.dart b/tests/language_strong/function_subtype_local6_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_local6_test.dart
rename to tests/language_strong/function_subtype_local6_test.dart
diff --git a/tests/language_2/function_subtype_named1_test.dart b/tests/language_strong/function_subtype_named1_test.dart
similarity index 97%
rename from tests/language_2/function_subtype_named1_test.dart
rename to tests/language_strong/function_subtype_named1_test.dart
index 917d3c8..ed3c9d5 100644
--- a/tests/language_2/function_subtype_named1_test.dart
+++ b/tests/language_strong/function_subtype_named1_test.dart
@@ -51,7 +51,7 @@
// Test ({Object a})->void <: ({int a})->void.
Expect.isTrue(void___a_Object is t_void___a_int);
// Test ({int a})->void <: ({Object a})->void.
- Expect.isFalse(void___a_int is t_void___a_Object);
+ Expect.isTrue(void___a_int is t_void___a_Object);
// Test (int,{int a})->void <: (int,{int a})->void.
Expect.isTrue(void__int__a_int is t_void__int__a_int2);
// Test ({int a})->void <: ({double a})->void.
diff --git a/tests/language_2/function_subtype_named2_test.dart b/tests/language_strong/function_subtype_named2_test.dart
similarity index 97%
rename from tests/language_2/function_subtype_named2_test.dart
rename to tests/language_strong/function_subtype_named2_test.dart
index c74a4d4..324f9bd 100644
--- a/tests/language_2/function_subtype_named2_test.dart
+++ b/tests/language_strong/function_subtype_named2_test.dart
@@ -38,7 +38,7 @@
// Test ({Object a})->void <: ({int a})->void.
Expect.isTrue(new C<void___a_Object>() is C<void___a_int>);
// Test ({int a})->void <: ({Object a})->void.
- Expect.isFalse(new C<void___a_int>() is C<void___a_Object>);
+ Expect.isTrue(new C<void___a_int>() is C<void___a_Object>);
// Test (int,{int a})->void <: (int,{int a})->void.
Expect.isTrue(new C<void__int__a_int>() is C<void__int__a_int2>);
// Test ({int a})->void <: ({double a})->void.
diff --git a/tests/language_2/function_subtype_not0_test.dart b/tests/language_strong/function_subtype_not0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_not0_test.dart
rename to tests/language_strong/function_subtype_not0_test.dart
diff --git a/tests/language_2/function_subtype_not1_test.dart b/tests/language_strong/function_subtype_not1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_not1_test.dart
rename to tests/language_strong/function_subtype_not1_test.dart
diff --git a/tests/language_2/function_subtype_not2_test.dart b/tests/language_strong/function_subtype_not2_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_not2_test.dart
rename to tests/language_strong/function_subtype_not2_test.dart
diff --git a/tests/language_2/function_subtype_not3_test.dart b/tests/language_strong/function_subtype_not3_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_not3_test.dart
rename to tests/language_strong/function_subtype_not3_test.dart
diff --git a/tests/language_2/function_subtype_null.dart b/tests/language_strong/function_subtype_null.dart
similarity index 100%
rename from tests/language_2/function_subtype_null.dart
rename to tests/language_strong/function_subtype_null.dart
diff --git a/tests/language_2/function_subtype_optional1_test.dart b/tests/language_strong/function_subtype_optional1_test.dart
similarity index 98%
rename from tests/language_2/function_subtype_optional1_test.dart
rename to tests/language_strong/function_subtype_optional1_test.dart
index be14976..5cc84af 100644
--- a/tests/language_2/function_subtype_optional1_test.dart
+++ b/tests/language_strong/function_subtype_optional1_test.dart
@@ -45,7 +45,7 @@
// Test ([Object])->void <: ([int])->void.
Expect.isTrue(void___Object is t_void___int);
// Test ([int])->void <: ([Object])->void.
- Expect.isFalse(void___int is t_void___Object);
+ Expect.isTrue(void___int is t_void___Object);
// Test (int,[int])->void <: (int)->void.
Expect.isTrue(void__int__int is t_void__int);
// Test (int,[int])->void <: (int,[int])->void.
diff --git a/tests/language_2/function_subtype_optional2_test.dart b/tests/language_strong/function_subtype_optional2_test.dart
similarity index 97%
rename from tests/language_2/function_subtype_optional2_test.dart
rename to tests/language_strong/function_subtype_optional2_test.dart
index 197dc0c..5e2ca86 100644
--- a/tests/language_2/function_subtype_optional2_test.dart
+++ b/tests/language_strong/function_subtype_optional2_test.dart
@@ -34,7 +34,7 @@
// Test ([Object])->void <: ([int])->void.
Expect.isTrue(new C<void___Object>() is C<void___int>);
// Test ([int])->void <: ([Object])->void.
- Expect.isFalse(new C<void___int>() is C<void___Object>);
+ Expect.isTrue(new C<void___int>() is C<void___Object>);
// Test (int,[int])->void <: (int)->void.
Expect.isTrue(new C<void__int__int>() is C<void__int>);
// Test (int,[int])->void <: (int,[int])->void.
diff --git a/tests/language_2/function_subtype_regression_ddc_588_test.dart b/tests/language_strong/function_subtype_regression_ddc_588_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_regression_ddc_588_test.dart
rename to tests/language_strong/function_subtype_regression_ddc_588_test.dart
diff --git a/tests/language_2/function_subtype_setter0_test.dart b/tests/language_strong/function_subtype_setter0_test.dart
similarity index 70%
rename from tests/language_2/function_subtype_setter0_test.dart
rename to tests/language_strong/function_subtype_setter0_test.dart
index fcc848b..322a8cb 100644
--- a/tests/language_2/function_subtype_setter0_test.dart
+++ b/tests/language_strong/function_subtype_setter0_test.dart
@@ -21,8 +21,18 @@
A<int> bar;
}
-test(c) {
- Expect.throwsTypeError(() => c.foo = 1);
+test(var c) {
+ bool inCheckedMode = false;
+ try {
+ var x = 42;
+ String a = x;
+ } catch (e) {
+ inCheckedMode = true;
+ }
+ if (inCheckedMode) {
+ Expect.throws(() => c.foo = 1, (e) => true);
+ }
+ c.foo = () {};
}
void main() {
diff --git a/tests/language_2/function_subtype_simple0_test.dart b/tests/language_strong/function_subtype_simple0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_simple0_test.dart
rename to tests/language_strong/function_subtype_simple0_test.dart
diff --git a/tests/language_2/function_subtype_simple1_test.dart b/tests/language_strong/function_subtype_simple1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_simple1_test.dart
rename to tests/language_strong/function_subtype_simple1_test.dart
diff --git a/tests/language_2/function_subtype_simple2_test.dart b/tests/language_strong/function_subtype_simple2_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_simple2_test.dart
rename to tests/language_strong/function_subtype_simple2_test.dart
diff --git a/tests/language_2/function_subtype_top_level0_test.dart b/tests/language_strong/function_subtype_top_level0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_top_level0_test.dart
rename to tests/language_strong/function_subtype_top_level0_test.dart
diff --git a/tests/language_2/function_subtype_top_level1_test.dart b/tests/language_strong/function_subtype_top_level1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_top_level1_test.dart
rename to tests/language_strong/function_subtype_top_level1_test.dart
diff --git a/tests/language_2/function_subtype_typearg0_test.dart b/tests/language_strong/function_subtype_typearg0_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_typearg0_test.dart
rename to tests/language_strong/function_subtype_typearg0_test.dart
diff --git a/tests/language_2/function_subtype_typearg1_test.dart b/tests/language_strong/function_subtype_typearg1_test.dart
similarity index 100%
rename from tests/language_2/function_subtype_typearg1_test.dart
rename to tests/language_strong/function_subtype_typearg1_test.dart
diff --git a/tests/language_2/function_subtype_typearg2_test.dart b/tests/language_strong/function_subtype_typearg2_test.dart
similarity index 85%
rename from tests/language_2/function_subtype_typearg2_test.dart
rename to tests/language_strong/function_subtype_typearg2_test.dart
index e23c88f..c8d0f7a 100644
--- a/tests/language_2/function_subtype_typearg2_test.dart
+++ b/tests/language_strong/function_subtype_typearg2_test.dart
@@ -17,6 +17,5 @@
typedef void f2(C<I> c);
main() {
- Expect.isFalse(new C<f1>() is C<f2>);
- Expect.isTrue(new C<f2>() is C<f1>);
+ Expect.isTrue(new C<f1>() is C<f2>);
}
diff --git a/tests/language_2/function_subtype_typearg3_test.dart b/tests/language_strong/function_subtype_typearg3_test.dart
similarity index 92%
rename from tests/language_2/function_subtype_typearg3_test.dart
rename to tests/language_strong/function_subtype_typearg3_test.dart
index b2208af..e39c2ed 100644
--- a/tests/language_2/function_subtype_typearg3_test.dart
+++ b/tests/language_strong/function_subtype_typearg3_test.dart
@@ -18,5 +18,4 @@
main() {
Expect.isTrue(new C<f1>() is C<f2>);
- Expect.isFalse(new C<f2>() is C<f1>);
}
diff --git a/tests/language_2/function_subtype_typearg3_test.dart b/tests/language_strong/function_subtype_typearg4_test.dart
similarity index 85%
copy from tests/language_2/function_subtype_typearg3_test.dart
copy to tests/language_strong/function_subtype_typearg4_test.dart
index b2208af..1c5e786 100644
--- a/tests/language_2/function_subtype_typearg3_test.dart
+++ b/tests/language_strong/function_subtype_typearg4_test.dart
@@ -13,10 +13,9 @@
class J extends I {}
-typedef J f1();
-typedef I f2();
+typedef I f1();
+typedef J f2();
main() {
Expect.isTrue(new C<f1>() is C<f2>);
- Expect.isFalse(new C<f2>() is C<f1>);
}
diff --git a/tests/language_2/function_syntax_test.dart b/tests/language_strong/function_syntax_test.dart
similarity index 100%
rename from tests/language_2/function_syntax_test.dart
rename to tests/language_strong/function_syntax_test.dart
diff --git a/tests/language_2/function_test.dart b/tests/language_strong/function_test.dart
similarity index 97%
rename from tests/language_2/function_test.dart
rename to tests/language_strong/function_test.dart
index 334d48a..e1dd788 100644
--- a/tests/language_2/function_test.dart
+++ b/tests/language_strong/function_test.dart
@@ -54,30 +54,30 @@
class B1 extends A {
final mfn;
B1(int a)
- : this.mfn = (() {
+ : super(a),
+ this.mfn = (() {
return a;
- }),
- super(a);
+ }) {}
}
class B2 extends A {
final mfn;
B2(int a)
- : this.mfn = (() {
+ : super(2),
+ this.mfn = (() {
return a;
- }),
- super(2);
+ }) {}
}
class B3 extends A {
final mfn;
B3(int a)
- : this.mfn = (() {
+ : super(() {
return a;
}),
- super(() {
+ this.mfn = (() {
return a;
- });
+ }) {}
}
typedef void Fisk();
diff --git a/tests/language_strong/function_type2_test.dart b/tests/language_strong/function_type2_test.dart
new file mode 100644
index 0000000..7bd41a8
--- /dev/null
+++ b/tests/language_strong/function_type2_test.dart
@@ -0,0 +1,36 @@
+// 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";
+
+bool get inCheckedMode {
+ try {
+ String a = 42;
+ } catch (e) {
+ return true;
+ }
+ return false;
+}
+
+class A<T> {
+ A(f) {
+ f(42);
+ }
+}
+
+class B<T> extends A<T> {
+ B() : super((T param) => 42);
+}
+
+main() {
+ var t = new B<int>();
+ bool caughtException = false;
+
+ try {
+ new B<String>();
+ } on TypeError catch (e) {
+ caughtException = true;
+ }
+ Expect.isTrue(!inCheckedMode || caughtException);
+}
diff --git a/tests/language_2/function_type3_test.dart b/tests/language_strong/function_type3_test.dart
similarity index 100%
rename from tests/language_2/function_type3_test.dart
rename to tests/language_strong/function_type3_test.dart
diff --git a/tests/language_2/function_type_alias2_test.dart b/tests/language_strong/function_type_alias2_test.dart
similarity index 100%
rename from tests/language_2/function_type_alias2_test.dart
rename to tests/language_strong/function_type_alias2_test.dart
diff --git a/tests/language_strong/language_strong.status b/tests/language_strong/language_strong.status
index ef74245..db874ad 100644
--- a/tests/language_strong/language_strong.status
+++ b/tests/language_strong/language_strong.status
@@ -131,6 +131,16 @@
function_literals2_test: Skip
function_literals_test: Skip
function_malformed_result_type_test: Skip
+function_subtype_bound_closure7_test: Skip
+function_subtype_checked0_test: Skip
+function_subtype_closure0_test: Skip
+function_subtype_closure1_test: Skip
+function_subtype_factory1_test: Skip
+function_subtype_inline1_test: Skip
+function_subtype_setter0_test: Skip
+function_syntax_test: Skip
+function_test: Skip
+function_type2_test: Skip
function_type_alias5_test: Skip
function_type_alias6_test: Skip
function_type_alias7_test: Skip
@@ -542,6 +552,12 @@
flatten_test/09: MissingRuntimeError # Issue 29920
flatten_test/12: MissingRuntimeError # Issue 29920
for_variable_capture_test: RuntimeError # Issue 29920
+function_subtype_named1_test: RuntimeError # Issue 29920
+function_subtype_named2_test: RuntimeError # Issue 29920
+function_subtype_optional1_test: RuntimeError # Issue 29920
+function_subtype_optional2_test: RuntimeError # Issue 29920
+function_subtype_typearg2_test: RuntimeError # Issue 29920
+function_subtype_typearg4_test: RuntimeError # Issue 29920
instance_creation_in_function_annotation_test: RuntimeError # Issue 29920
instanceof2_test: RuntimeError # Issue 29920
instanceof4_test/01: RuntimeError # Issue 29920
diff --git a/tests/language_strong/language_strong_kernel.status b/tests/language_strong/language_strong_kernel.status
index 724aa8f..cf3a820 100644
--- a/tests/language_strong/language_strong_kernel.status
+++ b/tests/language_strong/language_strong_kernel.status
@@ -58,6 +58,16 @@
flatten_test/12: MissingRuntimeError
for2_test: RuntimeError
for_variable_capture_test: RuntimeError
+function_subtype2_test: RuntimeError
+function_subtype_bound_closure3_test: RuntimeError
+function_subtype_bound_closure4_test: RuntimeError
+function_subtype_cast1_test: RuntimeError
+function_subtype_inline0_test: RuntimeError
+function_subtype_local3_test: RuntimeError
+function_subtype_local4_test: RuntimeError
+function_subtype_not1_test: RuntimeError
+function_subtype_regression_ddc_588_test: RuntimeError
+function_type_alias2_test: RuntimeError
function_type_alias3_test: RuntimeError
function_type_alias4_test: RuntimeError
inferrer_closure_test: RuntimeError