mirror of
https://github.com/dart-lang/sdk
synced 2024-09-23 12:08:53 +00:00
Update function subtyping rules to latest spec (issue 9057).
Update language tests and status files (and filed co19 issue 392). Review URL: https://codereview.chromium.org//12940010 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20493 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
b0e7728673
commit
5eeaba1d98
|
@ -3901,8 +3901,11 @@ bool Function::HasCompatibleParametersWith(const Function& other) const {
|
|||
const intptr_t num_ignored_params =
|
||||
(other.IsRedirectingFactory() && IsConstructor()) ? 1 : 0;
|
||||
// The default values of optional parameters can differ.
|
||||
if (((num_fixed_params - num_ignored_params) != other_num_fixed_params) ||
|
||||
(num_opt_pos_params < other_num_opt_pos_params) ||
|
||||
// This function requires the same arguments or less and accepts the same
|
||||
// arguments or more.
|
||||
if (((num_fixed_params - num_ignored_params) > other_num_fixed_params) ||
|
||||
((num_fixed_params - num_ignored_params) + num_opt_pos_params <
|
||||
other_num_fixed_params + other_num_opt_pos_params) ||
|
||||
(num_opt_named_params < other_num_opt_named_params)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3999,8 +4002,11 @@ bool Function::TypeTest(TypeTestKind test_kind,
|
|||
other.NumOptionalPositionalParameters();
|
||||
const intptr_t other_num_opt_named_params =
|
||||
other.NumOptionalNamedParameters();
|
||||
if ((num_fixed_params != other_num_fixed_params) ||
|
||||
(num_opt_pos_params < other_num_opt_pos_params) ||
|
||||
// This function requires the same arguments or less and accepts the same
|
||||
// arguments or more.
|
||||
if ((num_fixed_params > other_num_fixed_params) ||
|
||||
(num_fixed_params + num_opt_pos_params <
|
||||
other_num_fixed_params + other_num_opt_pos_params) ||
|
||||
(num_opt_named_params < other_num_opt_named_params)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -4033,7 +4039,8 @@ bool Function::TypeTest(TypeTestKind test_kind,
|
|||
}
|
||||
}
|
||||
// Check the types of fixed and optional positional parameters.
|
||||
for (intptr_t i = 0; i < num_fixed_params + other_num_opt_pos_params; i++) {
|
||||
for (intptr_t i = 0;
|
||||
i < other_num_fixed_params + other_num_opt_pos_params; i++) {
|
||||
if (!TestParameterType(test_kind,
|
||||
i, i, type_arguments, other, other_type_arguments,
|
||||
malformed_error)) {
|
||||
|
|
|
@ -43,6 +43,8 @@ Language/11_Expressions/31_Type_Test_A01_t04: Fail # co19 issue 341 (class Type
|
|||
Language/11_Expressions/32_Type_Cast_A01_t04: Fail # co19 issue 342 (class can be used anywhere, including left side of "as")
|
||||
|
||||
|
||||
Language/14_Types/5_Function_Types_A01_t10: Pass # co19 issue 392, issue 9058
|
||||
Language/14_Types/5_Function_Types_A02_t06: Pass # co19 issue 392, issue 9058
|
||||
Language/14_Types/5_Function_Types_A04_t01: Fail # co19 issue 345 (optional parameters list cannot by empty)
|
||||
|
||||
Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t15: Fail # co19 issue 346 (invalid 'one ugly cascade')
|
||||
|
|
|
@ -17,6 +17,8 @@ Language/12_Statements/10_Try_A03_t01: Fail # TODO(dart2dart-team): Please triag
|
|||
Language/12_Statements/10_Try_A03_t02: Fail # TODO(dart2dart-team): Please triage this failure.
|
||||
Language/12_Statements/10_Try_A03_t03: Fail # TODO(dart2dart-team): Please triage this failure.
|
||||
Language/13_Libraries_and_Scripts/4_Scripts_A01_t20: Fail # TODO(dart2dart-team): Please triage this failure.
|
||||
Language/14_Types/5_Function_Types_A01_t10: Fail # co19 issue 392
|
||||
Language/14_Types/5_Function_Types_A02_t06: Fail # co19 issue 392
|
||||
Language/14_Types/5_Function_Types_A04_t01: Fail # TODO(dart2dart-team): Please triage this failure.
|
||||
Language/15_Reference/1_Lexical_Rules_A01_t09: Fail # TODO(dart2dart-team): Please triage this failure.
|
||||
Language/15_Reference/1_Lexical_Rules_A01_t11: Fail # TODO(dart2dart-team): Please triage this failure.
|
||||
|
|
|
@ -111,6 +111,8 @@ Language/13_Libraries_and_Scripts/5_URIs_A01_t11: Fail # TODO(ahe): Please triag
|
|||
Language/13_Libraries_and_Scripts/5_URIs_A01_t21: Fail # TODO(ahe): Please triage this failure.
|
||||
Language/13_Libraries_and_Scripts/5_URIs_A01_t24: Fail # TODO(ahe): Please triage this failure.
|
||||
Language/13_Libraries_and_Scripts/5_URIs_A01_t25: Fail # TODO(ahe): Please triage this failure.
|
||||
Language/14_Types/5_Function_Types_A01_t10: Pass # co19 issue 392, issue 9058
|
||||
Language/14_Types/5_Function_Types_A02_t06: Pass # co19 issue 392, issue 9058
|
||||
Language/14_Types/5_Function_Types_A04_t01: Fail # TODO(ahe): Please triage this failure.
|
||||
Language/15_Reference/1_Lexical_Rules/1_Reserved_Words_A40_t04: Fail # TODO(ahe): Please triage this failure.
|
||||
Language/15_Reference/1_Lexical_Rules_A01_t09: Fail # TODO(ahe): Please triage this failure.
|
||||
|
|
|
@ -117,6 +117,8 @@ Language/13_Libraries_and_Scripts/5_URIs_A01_t11: Fail # Dart issue 6352
|
|||
Language/13_Libraries_and_Scripts/5_URIs_A01_t14: Fail # Dart issue 7317
|
||||
Language/13_Libraries_and_Scripts/5_URIs_A01_t15: Fail # Dart issue 7317
|
||||
Language/13_Libraries_and_Scripts/5_URIs_A01_t21: Fail # Dart issue 6352
|
||||
Language/14_Types/5_Function_Types_A01_t10: Fail # co19 issue 392
|
||||
Language/14_Types/5_Function_Types_A02_t06: Fail # co19 issue 392
|
||||
Language/14_Types/5_Function_Types_A04_t01: Fail # Dart issue 6921
|
||||
Language/14_Types/5_Function_Types_A06_t01: Fail # Dart issue 1604
|
||||
Language/15_Reference/1_Lexical_Rules_A01_t09: Fail # Dart issue 2687
|
||||
|
|
|
@ -87,11 +87,11 @@ class FunctionTypeAliasTest {
|
|||
Expect.equals(99, test(minus, 100, 1));
|
||||
|
||||
int plus (int a, [int b = 1]) { return a + b; };
|
||||
Expect.isTrue(plus is !Fun);
|
||||
Expect.isTrue(plus is !IntFun);
|
||||
Expect.isTrue(plus is Fun);
|
||||
Expect.isTrue(plus is IntFun);
|
||||
Expect.isTrue(plus is !BoolFun);
|
||||
Expect.isTrue(plus is !CompareObj);
|
||||
Expect.isTrue(plus is !CompareInt);
|
||||
Expect.isTrue(plus is CompareObj);
|
||||
Expect.isTrue(plus is CompareInt);
|
||||
Expect.isTrue(plus is !CompareString);
|
||||
|
||||
Expect.equals(0, bar());
|
||||
|
|
|
@ -141,13 +141,13 @@ compile_time_constant8_test: Fail # We don't take the generic type into account
|
|||
canonical_const_test: Fail # We don't take the generic type into account yet.
|
||||
|
||||
# Support for optional parameters not conform to latest spec.
|
||||
function_type_alias_test: Fail
|
||||
typedef_is_test: Fail # http://dartbug.com/9058
|
||||
function_type_alias_test: Fail # http://dartbug.com/9058
|
||||
function_type_alias2_test: Fail
|
||||
named_parameters_type_test: Fail
|
||||
positional_parameters_type_test: Fail
|
||||
named_parameters_with_object_property_names_test: Fail
|
||||
|
||||
|
||||
# Compilation errors.
|
||||
default_factory3_test: Fail # type arguments on redirecting factory not implemented
|
||||
non_parameterized_factory_test: Fail # type arguments on redirecting factory not implemented
|
||||
|
|
|
@ -59,9 +59,9 @@ void main() {
|
|||
Expect.isFalse(func5 is Func7);
|
||||
|
||||
int func6([int i, int j, int k]) {}
|
||||
Expect.isFalse(func6 is Func1);
|
||||
Expect.isFalse(func6 is Func2);
|
||||
Expect.isFalse(func6 is Func3);
|
||||
Expect.isTrue(func6 is Func1);
|
||||
Expect.isTrue(func6 is Func2);
|
||||
Expect.isTrue(func6 is Func3);
|
||||
Expect.isTrue(func6 is Func4);
|
||||
Expect.isFalse(func6 is Func5);
|
||||
Expect.isFalse(func6 is Func6);
|
||||
|
|
Loading…
Reference in a new issue