Skip to content

Commit 6ab17db

Browse files
author
Jennifer Messerly
committed
fix more mixin tests to work in strong mode
[email protected] Review-Url: https://codereview.chromium.org/2861783002 .
1 parent 04f7ba2 commit 6ab17db

21 files changed

+84
-91
lines changed

pkg/dev_compiler/test/browser/language_tests.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'is', 'require'],
194194
'mixin_forwarding_constructor3_test': fail,
195195
'mixin_implements_test': fail,
196196
'mixin_regress_13688_test': fail,
197+
'mixin_super_constructor_test': fail, // https://github.com/dart-lang/sdk/issues/28059
198+
'mixin_super_constructor2_test': fail, // Issue 28059
199+
'mixin_super_constructor_named_test_none_multi': fail, // Issue 28059
200+
'mixin_super_constructor_positionals_test_none_multi': fail, // Issue 28059
197201
'modulo_test': fail,
198202
'named_parameter_clash_test': fail,
199203
'named_parameters_passing_falsy_test': is.firefox('<=50') ? fail : pass,

pkg/dev_compiler/test/not_yet_strong_tests.dart

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,9 +1085,6 @@ final notYetStrongTests = new HashSet<String>.from([
10851085
'language/mixin_black_listed_test_08_multi',
10861086
'language/mixin_cyclic_test_01_multi',
10871087
'language/mixin_cyclic_test_02_multi',
1088-
'language/mixin_extends_field_test',
1089-
'language/mixin_extends_method_test',
1090-
'language/mixin_field_test',
10911088
'language/mixin_forwarding_constructor4_test_01_multi',
10921089
'language/mixin_forwarding_constructor4_test_02_multi',
10931090
'language/mixin_forwarding_constructor4_test_03_multi',
@@ -1204,32 +1201,18 @@ final notYetStrongTests = new HashSet<String>.from([
12041201
'language/mixin_invalid_inheritance2_test_01_multi',
12051202
'language/mixin_invalid_inheritance2_test_02_multi',
12061203
'language/mixin_invalid_inheritance2_test_03_multi',
1207-
'language/mixin_lib_extends_field_test',
1208-
'language/mixin_lib_extends_method_test',
1209-
'language/mixin_method_test',
12101204
'language/mixin_super_bound2_test_01_multi',
12111205
'language/mixin_super_bound2_test_none_multi',
1212-
'language/mixin_super_bound_test',
1213-
'language/mixin_super_constructor2_test',
1214-
'language/mixin_super_constructor_default_test',
1206+
'language/mixin_super_bound_test', // tests static errors
12151207
'language/mixin_super_constructor_named_test_01_multi',
1216-
'language/mixin_super_constructor_named_test_none_multi',
12171208
'language/mixin_super_constructor_positionals_test_01_multi',
1218-
'language/mixin_super_constructor_positionals_test_none_multi',
1219-
'language/mixin_super_constructor_test',
12201209
'language/mixin_super_test',
1221-
'language/mixin_type_parameter4_test',
12221210
'language/mixin_type_parameters_errors_test_01_multi',
12231211
'language/mixin_type_parameters_errors_test_02_multi',
12241212
'language/mixin_type_parameters_errors_test_03_multi',
12251213
'language/mixin_type_parameters_errors_test_04_multi',
12261214
'language/mixin_type_parameters_errors_test_05_multi',
1227-
'language/mixin_type_parameters_mixin_extends_test',
1228-
'language/mixin_type_parameters_mixin_test',
1229-
'language/mixin_type_parameters_simple_test',
1230-
'language/mixin_type_parameters_super_extends_test',
1231-
'language/mixin_type_parameters_super_test',
1232-
'language/mixin_with_two_implicit_constructors_test',
1215+
'language/mixin_with_two_implicit_constructors_test', // tests static errors
12331216
'language/multiline_newline_test_01_multi',
12341217
'language/multiline_newline_test_02_multi',
12351218
'language/multiline_newline_test_03_multi',

pkg/dev_compiler/tool/run.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ function finish(e) {
5353
}
5454
}
5555

56-
var async_helper = requirejs('async_helper').async_helper;
56+
sdk.dart.ignoreWhitelistedErrors(false);
57+
sdk.dart.failForWeakModeIsChecks(false);
5758
sdk._isolate_helper.startRootIsolate(() => {}, []);
59+
// Make it easier to debug test failures and required for formatter test that
60+
// assumes custom formatters are enabled.
61+
sdk._debugger.registerDevtoolsFormatter();
62+
63+
var async_helper = requirejs('async_helper').async_helper;
5864
async_helper.asyncTestInitialize(finish);
5965

6066
var module = requirejs(test);

tests/language_strong/mixin_extends_field_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class F extends E {
2727
}
2828

2929
main() {
30-
var c = new C();
31-
var d = new D();
32-
var e = new E();
33-
var f = new F();
30+
dynamic c = new C();
31+
dynamic d = new D();
32+
dynamic e = new E();
33+
dynamic f = new F();
3434

3535
Expect.equals("S-foo", c.foo);
3636
Expect.equals("S-foo", d.foo);

tests/language_strong/mixin_extends_method_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class F extends E {
3131
}
3232

3333
main() {
34-
var c = new C();
34+
dynamic c = new C();
3535
Expect.equals("S-foo", c.foo());
3636
Expect.equals("M1-bar", c.bar());
3737
Expect.equals("S-baz", c.baz());

tests/language_strong/mixin_field_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class F extends E {
2525
}
2626

2727
main() {
28-
var c = new C();
29-
var d = new D();
30-
var e = new E();
31-
var f = new F();
28+
dynamic c = new C();
29+
dynamic d = new D();
30+
dynamic e = new E();
31+
dynamic f = new F();
3232

3333
Expect.equals("S-foo", c.foo);
3434
Expect.equals("S-foo", d.foo);

tests/language_strong/mixin_lib_extends_field_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class F extends E {
2222
}
2323

2424
main() {
25-
var c = new C();
26-
var d = new D();
27-
var e = new E();
28-
var f = new F();
25+
dynamic c = new C();
26+
dynamic d = new D();
27+
dynamic e = new E();
28+
dynamic f = new F();
2929

3030
Expect.equals("S-foo", c.foo);
3131
Expect.equals("S-foo", d.foo);

tests/language_strong/mixin_lib_extends_method_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class F extends E {
2323
}
2424

2525
main() {
26-
var c = new C();
26+
dynamic c = new C();
2727
Expect.equals("S-foo", c.foo());
2828
Expect.equals("M1-bar", c.bar());
2929
Expect.equals("S-baz", c.baz());

tests/language_strong/mixin_method_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class F extends E {
2828
}
2929

3030
main() {
31-
var c = new C();
31+
dynamic c = new C();
3232
Expect.equals("S-foo", c.foo());
3333
Expect.equals("M1-bar", c.bar());
3434
Expect.equals("S-baz", c.baz());

tests/language_strong/mixin_super_bound_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import "package:expect/expect.dart";
66

77
bool inCheckedMode() {
88
try {
9-
var i = 42;
10-
String s = i;
9+
String s = 42 as dynamic;
1110
} on TypeError catch (e) {
1211
return true;
1312
}
@@ -20,9 +19,10 @@ class N<U, V extends U> {}
2019

2120
class S<T> {}
2221

23-
class MNA<U, V, W> extends S<List<U>> with M<V, U>, N<List<W>, List<W>> {}
22+
class MNA<U, V extends U, W> extends S<List<U>>
23+
with M<V, U>, N<List<W>, List<W>> {}
2424

25-
class MNA2<U, V, W> = S<List<U>> with M<V, U>, N<List<W>, List<W>>;
25+
class MNA2<U, V extends U, W> = S<List<U>> with M<V, U>, N<List<W>, List<W>>;
2626

2727
main() {
2828
new MNA<num, int, bool>();

tests/language_strong/mixin_super_constructor2_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import "package:expect/expect.dart";
66

77
class Base {
8-
int i, j;
8+
var i, j;
99
Base.ctor1(int i, this.j) : this.i = i + 7;
1010
Base.ctor2(int i, this.j) : this.i = i + 8;
1111
}

tests/language_strong/mixin_super_constructor_default_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class Base {
1010
}
1111

1212
abstract class M {
13-
get i;
14-
get j;
13+
int get i;
14+
int get j;
1515
int k = 42;
1616
foo() => i + j;
1717
}

tests/language_strong/mixin_super_constructor_named_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class Base {
1616
}
1717

1818
abstract class M {
19-
get i;
20-
get j;
19+
int get i;
20+
int get j;
2121
int k = 42;
2222
foo() => i + j;
2323
}

tests/language_strong/mixin_super_constructor_positionals_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class Base {
1515
}
1616

1717
abstract class M {
18-
get i;
19-
get j;
18+
int get i;
19+
int get j;
2020
int k = 42;
2121
foo() => i + j;
2222
}

tests/language_strong/mixin_super_constructor_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class Base {
1010
}
1111

1212
abstract class M {
13-
get i;
14-
get j;
13+
int get i;
14+
int get j;
1515
int k = 42;
1616
foo() => i + j;
1717
}

tests/language_strong/mixin_type_parameter4_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class A1<T> extends B1 with M<T> {}
1717
class A2<T> = B2 with M<T>;
1818

1919
main() {
20-
var ab = new A1<int>();
21-
Expect.isTrue(ab is R<bool, int>);
22-
ab = new A2<int>();
23-
Expect.isTrue(ab is R<bool, int>);
20+
var a1 = new A1<int>();
21+
Expect.isTrue(a1 is R<bool, int>);
22+
var a2 = new A2<int>();
23+
Expect.isTrue(a2 is R<bool, int>);
2424
}

tests/language_strong/mixin_type_parameters_mixin_extends_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class M<T> {
2929
static final bool checkedMode = computeCheckedMode();
3030
static bool computeCheckedMode() {
3131
try {
32-
int x = "foo";
32+
int x = "foo" as dynamic;
3333
} on Error {
3434
return true;
3535
}
@@ -50,32 +50,32 @@ class C3 extends S with M<String> {}
5050
main() {
5151
var c0 = new C0();
5252
Expect.isTrue(c0 is M);
53-
Expect.isTrue(c0 is M<int>);
54-
Expect.isTrue(c0 is M<String>);
53+
Expect.isFalse(c0 is M<int>);
54+
Expect.isFalse(c0 is M<String>);
5555
Expect.isTrue(c0.matches(c0));
5656
Expect.isTrue(c0.matches(42));
5757
Expect.isTrue(c0.matches("hello"));
5858

5959
var c0_int = new C0<int>();
6060
Expect.isTrue(c0_int is M);
61-
Expect.isTrue(c0_int is M<int>);
62-
Expect.isTrue(c0_int is M<String>);
61+
Expect.isFalse(c0_int is M<int>);
62+
Expect.isFalse(c0_int is M<String>);
6363
Expect.isTrue(c0_int.matches(c0));
6464
Expect.isTrue(c0_int.matches(42));
6565
Expect.isTrue(c0_int.matches("hello"));
6666

6767
var c0_String = new C0<String>();
6868
Expect.isTrue(c0_String is M);
69-
Expect.isTrue(c0_String is M<int>);
70-
Expect.isTrue(c0_String is M<String>);
69+
Expect.isFalse(c0_String is M<int>);
70+
Expect.isFalse(c0_String is M<String>);
7171
Expect.isTrue(c0_String.matches(c0));
7272
Expect.isTrue(c0_String.matches(42));
7373
Expect.isTrue(c0_String.matches("hello"));
7474

7575
var c1 = new C1();
7676
Expect.isTrue(c1 is M);
77-
Expect.isTrue(c1 is M<int>);
78-
Expect.isTrue(c1 is M<String>);
77+
Expect.isFalse(c1 is M<int>);
78+
Expect.isFalse(c1 is M<String>);
7979
Expect.isTrue(c1.matches(c1));
8080
Expect.isTrue(c1.matches(42));
8181
Expect.isTrue(c1.matches("hello"));

tests/language_strong/mixin_type_parameters_mixin_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class M<T> {
2929
static final bool checkedMode = computeCheckedMode();
3030
static bool computeCheckedMode() {
3131
try {
32-
int x = "foo";
32+
int x = "foo" as dynamic;
3333
} on Error {
3434
return true;
3535
}
@@ -47,32 +47,32 @@ class C3 = S with M<String>;
4747
main() {
4848
var c0 = new C0();
4949
Expect.isTrue(c0 is M);
50-
Expect.isTrue(c0 is M<int>);
51-
Expect.isTrue(c0 is M<String>);
50+
Expect.isFalse(c0 is M<int>);
51+
Expect.isFalse(c0 is M<String>);
5252
Expect.isTrue(c0.matches(c0));
5353
Expect.isTrue(c0.matches(42));
5454
Expect.isTrue(c0.matches("hello"));
5555

5656
var c0_int = new C0<int>();
5757
Expect.isTrue(c0_int is M);
58-
Expect.isTrue(c0_int is M<int>);
59-
Expect.isTrue(c0_int is M<String>);
58+
Expect.isFalse(c0_int is M<int>);
59+
Expect.isFalse(c0_int is M<String>);
6060
Expect.isTrue(c0_int.matches(c0));
6161
Expect.isTrue(c0_int.matches(42));
6262
Expect.isTrue(c0_int.matches("hello"));
6363

6464
var c0_String = new C0<String>();
6565
Expect.isTrue(c0_String is M);
66-
Expect.isTrue(c0_String is M<int>);
67-
Expect.isTrue(c0_String is M<String>);
66+
Expect.isFalse(c0_String is M<int>);
67+
Expect.isFalse(c0_String is M<String>);
6868
Expect.isTrue(c0_String.matches(c0));
6969
Expect.isTrue(c0_String.matches(42));
7070
Expect.isTrue(c0_String.matches("hello"));
7171

7272
var c1 = new C1();
7373
Expect.isTrue(c1 is M);
74-
Expect.isTrue(c1 is M<int>);
75-
Expect.isTrue(c1 is M<String>);
74+
Expect.isFalse(c1 is M<int>);
75+
Expect.isFalse(c1 is M<String>);
7676
Expect.isTrue(c1.matches(c1));
7777
Expect.isTrue(c1.matches(42));
7878
Expect.isTrue(c1.matches("hello"));

tests/language_strong/mixin_type_parameters_simple_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ main() {
2323
// so we make sure to handle these specifically in the compiler.
2424
Expect.equals("int", a.m1().toString());
2525
Expect.equals("int", a.m2().toString());
26-
a = new A<String>();
27-
Expect.equals("String", a.m1().toString());
28-
Expect.equals("String", a.m2().toString());
26+
var a2 = new A<String>();
27+
Expect.equals("String", a2.m1().toString());
28+
Expect.equals("String", a2.m2().toString());
2929
}

tests/language_strong/mixin_type_parameters_super_extends_test.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class S<T> {
2929
static final bool checkedMode = computeCheckedMode();
3030
static bool computeCheckedMode() {
3131
try {
32-
int x = "foo";
32+
int x = "foo" as dynamic;
3333
} on Error {
3434
return true;
3535
}
@@ -50,32 +50,32 @@ class C3 extends S<String> with M {}
5050
main() {
5151
var c0 = new C0();
5252
Expect.isTrue(c0 is S);
53-
Expect.isTrue(c0 is S<int>);
54-
Expect.isTrue(c0 is S<String>);
53+
Expect.isFalse(c0 is S<int>);
54+
Expect.isFalse(c0 is S<String>);
5555
Expect.isTrue(c0.matches(c0));
5656
Expect.isTrue(c0.matches(42));
5757
Expect.isTrue(c0.matches("hello"));
5858

5959
var c0_int = new C0<int>();
6060
Expect.isTrue(c0_int is S);
61-
Expect.isTrue(c0_int is S<int>);
62-
Expect.isTrue(c0_int is S<String>);
61+
Expect.isFalse(c0_int is S<int>);
62+
Expect.isFalse(c0_int is S<String>);
6363
Expect.isTrue(c0_int.matches(c0));
6464
Expect.isTrue(c0_int.matches(42));
6565
Expect.isTrue(c0_int.matches("hello"));
6666

6767
var c0_String = new C0<String>();
6868
Expect.isTrue(c0_String is S);
69-
Expect.isTrue(c0_String is S<int>);
70-
Expect.isTrue(c0_String is S<String>);
69+
Expect.isFalse(c0_String is S<int>);
70+
Expect.isFalse(c0_String is S<String>);
7171
Expect.isTrue(c0_String.matches(c0));
7272
Expect.isTrue(c0_String.matches(42));
7373
Expect.isTrue(c0_String.matches("hello"));
7474

7575
var c1 = new C1();
7676
Expect.isTrue(c1 is S);
77-
Expect.isTrue(c1 is S<int>);
78-
Expect.isTrue(c1 is S<String>);
77+
Expect.isFalse(c1 is S<int>);
78+
Expect.isFalse(c1 is S<String>);
7979
Expect.isTrue(c1.matches(c1));
8080
Expect.isTrue(c1.matches(42));
8181
Expect.isTrue(c1.matches("hello"));

0 commit comments

Comments
 (0)