mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 14:32:24 +00:00
Fix dart2js subtyping
A<dynamic> is _not_ a subtype of A<int> in Dart 2 Change-Id: I0d1185b38192a06aaf9d8622a78c7384dfc287dc Reviewed-on: https://dart-review.googlesource.com/52106 Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
818c4b5bfd
commit
be47fa67aa
6 changed files with 5 additions and 24 deletions
|
@ -1030,11 +1030,9 @@ bool isSubtypeV2(var s, var sEnv, var t, var tEnv) {
|
|||
var field = '${JS_GET_NAME(JsGetName.OPERATOR_AS_PREFIX)}${typeOfTString}';
|
||||
substitution = getField(typeOfSPrototype, field);
|
||||
}
|
||||
// The class of [s] is a subclass of the class of [t]. If [s] has no type
|
||||
// arguments and no substitution, it is used as raw type. If [t] has no
|
||||
// type arguments, it used as a raw type. In both cases, [s] is a subtype
|
||||
// of [t].
|
||||
if ((!isJsArray(s) && substitution == null) || !isJsArray(t)) {
|
||||
// The class of [s] is a subclass of the class of [t]. If [t] has no
|
||||
// type arguments, it used as a raw type and [s] is a subtype of [t].
|
||||
if (!isJsArray(t)) {
|
||||
return true;
|
||||
}
|
||||
// Recursively check the type arguments.
|
||||
|
|
|
@ -21,7 +21,7 @@ main() {
|
|||
var f = (List x) {};
|
||||
Expect.isTrue(f is F);
|
||||
var g = (List<F> x) {};
|
||||
Expect.isTrue(g is F);
|
||||
Expect.isFalse(g is F);
|
||||
var d = new D();
|
||||
Expect.isTrue(d.foo is! C);
|
||||
Expect.isTrue(d.bar is C);
|
||||
|
|
|
@ -73,7 +73,6 @@ function_subtype_call1_test: RuntimeError
|
|||
function_subtype_call2_test: RuntimeError
|
||||
function_subtype_cast1_test: RuntimeError
|
||||
function_subtype_not1_test: RuntimeError
|
||||
function_subtype_typearg5_test: RuntimeError
|
||||
function_type/function_type0_test: RuntimeError # Issue 30476
|
||||
function_type/function_type10_test: RuntimeError # Issue 30476
|
||||
function_type/function_type12_test: RuntimeError # Issue 30476
|
||||
|
@ -339,8 +338,6 @@ generalized_void_syntax_test: CompileTimeError # Issue #30176.
|
|||
generic_closure_test/01: RuntimeError
|
||||
generic_closure_test/none: RuntimeError
|
||||
generic_function_dcall_test: Crash # Unsupported operation: Unsupported type parameter type node T.
|
||||
generic_function_typedef_test/01: RuntimeError
|
||||
generic_instanceof_test: RuntimeError
|
||||
generic_tearoff_test: Crash # Unsupported operation: Unsupported type parameter type node T.
|
||||
generic_typedef_test: RuntimeError
|
||||
getter_override2_test/02: MissingCompileTimeError
|
||||
|
@ -371,7 +368,6 @@ list_literal_syntax_test/01: MissingCompileTimeError
|
|||
list_literal_syntax_test/02: MissingCompileTimeError
|
||||
list_literal_syntax_test/03: MissingCompileTimeError
|
||||
malformed2_test/00: MissingCompileTimeError
|
||||
many_generic_instanceof_test: RuntimeError
|
||||
map_literal1_test/01: MissingCompileTimeError
|
||||
map_literal8_test: RuntimeError
|
||||
method_override7_test/00: MissingCompileTimeError
|
||||
|
@ -744,7 +740,6 @@ function_subtype_cast1_test: RuntimeError
|
|||
function_subtype_inline2_test: RuntimeError
|
||||
function_subtype_not1_test: RuntimeError
|
||||
function_subtype_setter0_test: RuntimeError
|
||||
function_subtype_typearg5_test: RuntimeError
|
||||
function_type_alias2_test: RuntimeError
|
||||
function_type_alias4_test: RuntimeError
|
||||
generic_closure_test/01: RuntimeError
|
||||
|
@ -753,9 +748,7 @@ generic_function_bounds_test: RuntimeError
|
|||
generic_function_dcall_test: RuntimeError
|
||||
generic_function_type_as_type_argument_test/01: MissingCompileTimeError
|
||||
generic_function_type_as_type_argument_test/02: MissingCompileTimeError
|
||||
generic_function_typedef_test/01: RuntimeError
|
||||
generic_instanceof2_test: RuntimeError
|
||||
generic_instanceof_test: RuntimeError
|
||||
generic_is_check_test: RuntimeError
|
||||
generic_method_types_test/02: RuntimeError
|
||||
generic_methods_bounds_test/02: MissingRuntimeError
|
||||
|
@ -803,7 +796,6 @@ local_function2_test/none: RuntimeError
|
|||
local_function3_test/none: RuntimeError
|
||||
local_function_test/none: RuntimeError
|
||||
main_test/03: RuntimeError
|
||||
many_generic_instanceof_test: RuntimeError
|
||||
many_overridden_no_such_method_test: RuntimeError
|
||||
method_override7_test/00: MissingCompileTimeError
|
||||
method_override7_test/01: MissingCompileTimeError
|
||||
|
@ -1229,7 +1221,6 @@ function_subtype_cast1_test: RuntimeError
|
|||
function_subtype_inline2_test: RuntimeError
|
||||
function_subtype_not1_test: RuntimeError
|
||||
function_subtype_setter0_test: RuntimeError
|
||||
function_subtype_typearg5_test: RuntimeError
|
||||
function_type_alias2_test: RuntimeError
|
||||
function_type_alias4_test: RuntimeError
|
||||
generic_closure_test/01: RuntimeError
|
||||
|
@ -1238,9 +1229,7 @@ generic_function_bounds_test: RuntimeError
|
|||
generic_function_dcall_test: RuntimeError
|
||||
generic_function_type_as_type_argument_test/01: MissingCompileTimeError
|
||||
generic_function_type_as_type_argument_test/02: MissingCompileTimeError
|
||||
generic_function_typedef_test/01: RuntimeError
|
||||
generic_instanceof2_test: RuntimeError
|
||||
generic_instanceof_test: RuntimeError
|
||||
generic_is_check_test: RuntimeError
|
||||
generic_method_types_test/02: RuntimeError
|
||||
generic_methods_bounds_test/01: MissingCompileTimeError
|
||||
|
@ -1322,7 +1311,6 @@ malbounded_type_test2_test/00: MissingCompileTimeError
|
|||
malbounded_type_test_test/00: MissingCompileTimeError
|
||||
malbounded_type_test_test/01: MissingCompileTimeError
|
||||
malbounded_type_test_test/02: MissingCompileTimeError
|
||||
many_generic_instanceof_test: RuntimeError
|
||||
many_overridden_no_such_method_test: RuntimeError
|
||||
map_literal3_test/01: MissingCompileTimeError
|
||||
map_literal3_test/02: MissingCompileTimeError
|
||||
|
@ -1899,16 +1887,13 @@ function_subtype_cast1_test: RuntimeError
|
|||
function_subtype_inline2_test: RuntimeError
|
||||
function_subtype_not1_test: RuntimeError
|
||||
function_subtype_setter0_test: RuntimeError
|
||||
function_subtype_typearg5_test: RuntimeError
|
||||
function_type_alias2_test: RuntimeError
|
||||
function_type_alias4_test: RuntimeError
|
||||
generic_function_bounds_test: RuntimeError
|
||||
generic_function_dcall_test: RuntimeError
|
||||
generic_function_type_as_type_argument_test/01: MissingCompileTimeError
|
||||
generic_function_type_as_type_argument_test/02: MissingCompileTimeError
|
||||
generic_function_typedef_test/01: RuntimeError
|
||||
generic_instanceof2_test: RuntimeError
|
||||
generic_instanceof_test: RuntimeError
|
||||
generic_is_check_test: RuntimeError
|
||||
generic_method_types_test/02: RuntimeError
|
||||
generic_methods_bounds_test/01: MissingCompileTimeError
|
||||
|
@ -1990,7 +1975,6 @@ malbounded_type_test2_test/00: MissingCompileTimeError
|
|||
malbounded_type_test_test/00: MissingCompileTimeError
|
||||
malbounded_type_test_test/01: MissingCompileTimeError
|
||||
malbounded_type_test_test/02: MissingCompileTimeError
|
||||
many_generic_instanceof_test: RuntimeError
|
||||
many_overridden_no_such_method_test: RuntimeError
|
||||
map_literal3_test/01: MissingCompileTimeError
|
||||
map_literal3_test/02: MissingCompileTimeError
|
||||
|
|
|
@ -757,7 +757,6 @@ flatten_test/09: MissingRuntimeError # Issue 29920
|
|||
flatten_test/12: MissingRuntimeError # Issue 29920
|
||||
for_variable_capture_test: RuntimeError # Issue 29920; Expect.equals(expected: <1>, actual: <0>) fails.
|
||||
function_subtype_inline2_test: RuntimeError # Expect.fail('Missing type error: 'new C.c1(m2)'.')
|
||||
function_type_alias6_test/none: RuntimeError # Expect.isTrue(false) fails.
|
||||
generic_function_type_as_type_argument_test/01: MissingCompileTimeError # Issue 29920
|
||||
generic_function_type_as_type_argument_test/02: MissingCompileTimeError # Issue 29920
|
||||
generic_instanceof2_test: RuntimeError # Issue 29920; ReferenceError: FooOfK$String is not defined
|
||||
|
|
|
@ -645,7 +645,6 @@ flatten_test/12: MissingRuntimeError
|
|||
for_in_side_effects_test/01: MissingCompileTimeError
|
||||
function_propagation_test: RuntimeError
|
||||
function_subtype_inline2_test: RuntimeError
|
||||
function_type_alias6_test/none: RuntimeError
|
||||
generic_instanceof2_test: RuntimeError
|
||||
generic_is_check_test: RuntimeError
|
||||
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Issue 31533
|
||||
|
|
|
@ -1123,6 +1123,7 @@ 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_type_alias2_test: RuntimeError
|
||||
function_type_alias6_test/none: RuntimeError
|
||||
invalid_override_in_mixin_test/01: MissingCompileTimeError
|
||||
type_literal_prefix_call_test: RuntimeError
|
||||
|
||||
|
|
Loading…
Reference in a new issue