Skip to content

Commit f0d6f11

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
Make nested_generic_closure_test work for dart2js
Change-Id: I07fa89b184cd542ebd028dbf70279ee6d64cd1cf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107834 Commit-Queue: Stephen Adams <[email protected]> Reviewed-by: Lasse R.H. Nielsen <[email protected]>
1 parent 0a538a4 commit f0d6f11

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

tests/language_2/language_2_dart2js.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ mock_writable_final_private_field_test: RuntimeError # Issue 17526, 30847
164164
modulo_test: RuntimeError # non JS number semantics
165165
named_parameters_default_eq_test/none: RuntimeError
166166
nan_identical_test: RuntimeError # Issue 11551
167-
nested_generic_closure_test: RuntimeError
168167
no_main_test/01: CompileTimeError
169168
no_such_method_mock_test: RuntimeError
170169
null_no_such_method_test: CompileTimeError
@@ -459,7 +458,6 @@ mock_writable_final_field_test: RuntimeError # Issue 30847
459458
mock_writable_final_private_field_test: RuntimeError # Issue 17526, 30847
460459
modulo_test: RuntimeError # non JS number semantics
461460
nan_identical_test: RuntimeError # Issue 11551
462-
nested_generic_closure_test: Crash # Unsupported operation: Unsupported type parameter type node F.
463461
no_main_test/01: CompileTimeError
464462
not_enough_positional_arguments_test/00: MissingCompileTimeError
465463
not_enough_positional_arguments_test/01: MissingCompileTimeError

tests/language_2/nested_generic_closure_test.dart

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// VMOptions=--reify-generic-functions
5+
// TODO(37452): Avoid using unspecified 'toString' behaviour in language test.
66

77
import 'package:expect/expect.dart';
88

@@ -25,11 +25,34 @@ class C<T> {
2525
}
2626

2727
main() {
28-
Expect.equals("(<F>(F) => F) => void", foo.runtimeType.toString());
29-
Expect.equals("<B>(<F>(F) => B) => B", bar.runtimeType.toString());
30-
Expect.equals("<F>(F) => int", baz<int>().runtimeType.toString());
28+
expectOne(
29+
foo.runtimeType.toString(),
30+
["(<F>(F) => F) => void", "(<T1>(T1) => T1) => void"],
31+
);
32+
expectOne(
33+
bar.runtimeType.toString(),
34+
["<B>(<F>(F) => B) => B", "<T1>(<T2>(T2) => T1) => T1"],
35+
);
36+
expectOne(
37+
baz<int>().runtimeType.toString(),
38+
["<F>(F) => int", "<T1>(T1) => int"],
39+
);
40+
3141
var c = new C<bool>();
32-
Expect.equals("(<F>(bool, F) => F) => void", c.foo.runtimeType.toString());
33-
Expect.equals("<B>(<F>(bool, F) => B) => B", c.bar.runtimeType.toString());
34-
Expect.equals("<F>(bool, F) => int", c.baz<int>().runtimeType.toString());
42+
expectOne(
43+
c.foo.runtimeType.toString(),
44+
["(<F>(bool, F) => F) => void", "(<T1>(bool, T1) => T1) => void"],
45+
);
46+
expectOne(
47+
c.bar.runtimeType.toString(),
48+
["<B>(<F>(bool, F) => B) => B", "<T1>(<T2>(bool, T2) => T1) => T1"],
49+
);
50+
expectOne(
51+
c.baz<int>().runtimeType.toString(),
52+
["<F>(bool, F) => int", "<T1>(bool, T1) => int"],
53+
);
54+
}
55+
56+
expectOne(String name, Iterable<String> names) {
57+
Expect.isTrue(names.contains(name), '"$name" should be one of: ${names}');
3558
}

0 commit comments

Comments
 (0)