Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit df9ca4c

Browse files
eernstgcommit-bot@chromium.org
authored andcommitted
Adjusted method_override_test to eliminate spurious compile time error
Change-Id: I1f46f28c220ba2a6d5c5e3dc4f2c3efd010c7a8a Reviewed-on: https://dart-review.googlesource.com/68664 Reviewed-by: Kevin Millikin <[email protected]> Commit-Queue: Erik Ernst <[email protected]>
1 parent 5332130 commit df9ca4c

File tree

5 files changed

+12
-25
lines changed

5 files changed

+12
-25
lines changed

tests/language_2/language_2_analyzer.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ invalid_type_argument_count_test/02: MissingCompileTimeError
7373
invalid_type_argument_count_test/03: MissingCompileTimeError
7474
invalid_type_argument_count_test/04: MissingCompileTimeError
7575
method_override7_test/03: Fail # Issue 11497
76-
method_override_test: CompileTimeError
77-
method_override_test: StaticWarning
7876
mixin_supertype_subclass2_test/02: MissingStaticWarning # Issue 25614
7977
mixin_supertype_subclass2_test/05: MissingStaticWarning # Issue 25614
8078
mixin_supertype_subclass3_test/02: MissingStaticWarning # Issue 25614

tests/language_2/language_2_dart2js.status

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ library_env_test/has_mirror_support: RuntimeError
897897
local_function2_test/none: RuntimeError
898898
local_function3_test/none: RuntimeError
899899
local_function_test/none: RuntimeError
900-
method_override_test: CompileTimeError
901900
minify_closure_variable_collision_test: CompileTimeError
902901
mint_arithmetic_test: RuntimeError # non JS number semantics
903902
mixin_forwarding_constructor4_test/01: MissingCompileTimeError

tests/language_2/language_2_dartdevc.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ issue32353_test: RuntimeError
100100
label_test: RuntimeError
101101
left_shift_test: RuntimeError # Ints and doubles are unified.
102102
method_override7_test/03: MissingCompileTimeError
103-
method_override_test: CompileTimeError # Negative test
104103
mixin_super_2_test/01: MissingCompileTimeError
105104
mixin_super_2_test/03: MissingCompileTimeError
106105
mixin_super_test: RuntimeError
@@ -325,7 +324,6 @@ malbounded_type_test_test/02: MissingCompileTimeError
325324
map_literal3_test/01: MissingCompileTimeError
326325
map_literal3_test/02: MissingCompileTimeError
327326
map_literal3_test/03: MissingCompileTimeError
328-
method_override_test: CompileTimeError # Issue 31616
329327
mixin_forwarding_constructor4_test/01: MissingCompileTimeError
330328
mixin_forwarding_constructor4_test/02: MissingCompileTimeError
331329
mixin_forwarding_constructor4_test/03: MissingCompileTimeError

tests/language_2/language_2_kernel.status

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ local_function2_test/none: RuntimeError
8888
local_function3_test/none: RuntimeError
8989
local_function_test/none: RuntimeError
9090
main_test/03: RuntimeError
91-
method_override_test: CompileTimeError # Issue 31616 --- note that this test cannot be expected to pass in its current state!
9291
mixin_illegal_super_use_test/01: MissingCompileTimeError
9392
mixin_illegal_super_use_test/04: MissingCompileTimeError
9493
mixin_illegal_super_use_test/07: MissingCompileTimeError
@@ -863,7 +862,6 @@ method_override5_test/03: MissingCompileTimeError
863862
method_override6_test/01: MissingCompileTimeError
864863
method_override6_test/02: MissingCompileTimeError
865864
method_override6_test/03: MissingCompileTimeError
866-
method_override_test: CompileTimeError # Issue 31616 --- note that this test cannot be expected to pass in its current state!
867865
mixin_illegal_super_use_test: Skip # Issues 24478 and 23773
868866
mixin_illegal_superclass_test: Skip # Issues 24478 and 23773
869867
named_parameters_default_eq_test/none: RuntimeError
@@ -983,7 +981,6 @@ generic_tearoff_test: CompileTimeError
983981
instantiate_tearoff_of_call_test: CompileTimeError
984982
issue31596_super_test/01: CompileTimeError
985983
issue31596_super_test/03: CompileTimeError
986-
method_override_test: CompileTimeError # Issue 31616 --- note that this test cannot be expected to pass in its current state!
987984
mixin_illegal_super_use_test/01: MissingCompileTimeError
988985
mixin_illegal_super_use_test/04: MissingCompileTimeError
989986
mixin_illegal_super_use_test/07: MissingCompileTimeError
@@ -1454,7 +1451,6 @@ method_override5_test/03: MissingCompileTimeError
14541451
method_override6_test/01: MissingCompileTimeError
14551452
method_override6_test/02: MissingCompileTimeError
14561453
method_override6_test/03: MissingCompileTimeError
1457-
method_override_test: CompileTimeError # Issue 31616 --- note that this test cannot be expected to pass in its current state!
14581454
mixin_illegal_super_use_test: Skip # Issues 24478 and 23773
14591455
mixin_illegal_superclass_test: Skip # Issues 24478 and 23773
14601456
named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.

tests/language_2/method_override_test.dart

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ import "package:expect/expect.dart";
99

1010
typedef V RemoveFunctionType<K, V>(K key);
1111

12-
class MapBase<K, V> implements Map<K, V> {
12+
class MapBase<K, V> {
1313
K remove(K key) {
1414
throw 'Must be implemented';
1515
}
1616

17-
void Tests() {
17+
void tests() {
1818
Expect.isTrue(this is MapBase<int, int>);
1919

20+
// `remove` takes an argument which is covariant-by-class, so
21+
// the tear-off has dynamic type `int Function(Object)`.
22+
2023
Expect.isTrue(remove is RemoveFunctionType);
2124
Expect.isTrue(remove is RemoveFunctionType<int, int>);
2225
Expect.isTrue(remove is RemoveFunctionType<String, int>);
@@ -29,10 +32,14 @@ class MethodOverrideTest extends MapBase<String, String> {
2932
throw 'Must be implemented';
3033
}
3134

32-
void Tests() {
35+
void tests() {
3336
Expect.isTrue(this is MethodOverrideTest);
3437
Expect.isTrue(this is MapBase<String, String>);
3538

39+
// `remove` takes an argument which is covariant-by-class because
40+
// an overridden method does so, and hence the tear-off has dynamic
41+
// type `String Function(Object)`; so does `super.remove`.
42+
3643
Expect.isTrue(remove is RemoveFunctionType);
3744
Expect.isTrue(remove is RemoveFunctionType<String, String>);
3845
Expect.isTrue(remove is! RemoveFunctionType<int, int>);
@@ -43,17 +50,6 @@ class MethodOverrideTest extends MapBase<String, String> {
4350
}
4451

4552
main() {
46-
// Since method overriding is only checked statically, explicitly check
47-
// the subtyping relation using a function type alias.
48-
var x = new MethodOverrideTest();
49-
Expect.isTrue(x.remove is RemoveFunctionType<String, String>);
50-
51-
// Perform a few more tests.
52-
x.Tests();
53-
54-
var m = new MapBase<int, int>();
55-
Expect.isTrue(m.remove is RemoveFunctionType<int, int>);
56-
57-
// Perform a few more tests.
58-
m.Tests();
53+
new MapBase<int, int>().tests();
54+
new MethodOverrideTest().tests();
5955
}

0 commit comments

Comments
 (0)