Revert "Check whether type-arguments and type-parameters length match from the body builder."

This reverts commit 321a4ec048.

Some VM tests expect to see the behavior with a raw type instead of
an invalid type. I'll revert first, then resend this CL with the default
result changed.

R=ahe@google.com

Change-Id: I2cdd855dbaec93d0a0c257f7e202518fd9b59c81
Reviewed-on: https://dart-review.googlesource.com/6342
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2017-09-15 22:15:09 +00:00
parent f6c50ca219
commit 1ca12788c6
10 changed files with 25 additions and 87 deletions

View file

@ -2909,28 +2909,6 @@ const MessageCode messageTypeAfterVar = const MessageCode("TypeAfterVar",
message: r"""Can't have both a type and 'var'.""",
tip: r"""Try removing 'var.'""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name, String string)>
templateTypeArgumentMismatch =
const Template<Message Function(String name, String string)>(
messageTemplate: r"""'#name' expects #string type arguments.""",
withArguments: _withArgumentsTypeArgumentMismatch);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name, String string)>
codeTypeArgumentMismatch =
const Code<Message Function(String name, String string)>(
"TypeArgumentMismatch",
templateTypeArgumentMismatch,
);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTypeArgumentMismatch(String name, String string) {
return new Message(codeTypeArgumentMismatch,
message: """'$name' expects $string type arguments.""",
arguments: {'name': name, 'string': string});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateTypeArgumentsOnTypeVariable =

View file

@ -1016,13 +1016,6 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
charOffset);
}
@override
void warnTypeArgumentsMismatch(String name, int expected, int charOffset) {
warning(
fasta.templateTypeArgumentMismatch.withArguments(name, '${expected}'),
charOffset);
}
@override
Member lookupSuperMember(Name name, {bool isSetter: false}) {
Class superclass = classBuilder.cls.superclass;

View file

@ -37,7 +37,6 @@ import 'frontend_accessors.dart' show Accessor;
import 'kernel_builder.dart'
show
Builder,
FunctionTypeAliasBuilder,
KernelClassBuilder,
KernelInvalidTypeBuilder,
LibraryBuilder,
@ -131,8 +130,6 @@ abstract class BuilderHelper {
void warnUnresolvedSuperSet(Name name, int charOffset);
void warnUnresolvedSuperMethod(Name name, int charOffset);
void warnTypeArgumentsMismatch(String name, int expected, int charOffset);
}
abstract class FastaAccessor implements Accessor {
@ -1028,27 +1025,6 @@ class TypeDeclarationAccessor extends ReadOnlyAccessor {
DartType buildType(List<DartType> arguments,
{bool nonInstanceAccessIsError: false}) {
if (arguments != null) {
int expected = 0;
if (declaration is KernelClassBuilder) {
expected = declaration.target.typeParameters.length;
} else if (declaration is FunctionTypeAliasBuilder) {
expected = declaration.target.typeParameters.length;
} else {
return unhandled(
"${declaration.runtimeType}",
"TypeDeclarationAccessor.buildType",
offsetForToken(token),
helper.uri);
}
if (arguments.length != expected) {
helper.warnTypeArgumentsMismatch(
declaration.name, expected, offsetForToken(token));
// TODO(sigmund): include more details in InvalidType about why the type
// is invalid (see #29840).
return const InvalidType();
}
}
DartType type =
declaration.buildTypesWithBuiltArguments(helper.library, arguments);
if (type is TypeParameterType) {

View file

@ -541,10 +541,6 @@ ListLiteralTooManyTypeArguments:
ListLiteralTypeArgumentMismatch:
template: "Map literal requires two type arguments."
TypeArgumentMismatch:
# TODO(sigmund): #string should be a number instead.
template: "'#name' expects #string type arguments."
NotAType:
template: "'#name' isn't a type."

View file

@ -96,6 +96,7 @@ regress/issue_29944: Crash # Issue 29944.
regress/issue_29975: Fail # Issue 29975.
regress/issue_29976: RuntimeError
regress/issue_29977: Crash # Issue 29977.
regress/issue_29981: Crash # Issue 29981.
regress/issue_29982: RuntimeError
regress/issue_29983: Crash # Issue 29983.
regress/issue_29984: Crash # Issue 29984.

View file

@ -1,13 +0,0 @@
library;
import self as self;
import "dart:core" as core;
class C<T extends core::Object> extends core::Object {
field self::C<core::String> field = null;
default constructor •() → void
: super core::Object::•()
;
}
static method main() → dynamic {
core::print(new self::C::•<dynamic>());
}

View file

@ -1,13 +0,0 @@
library;
import self as self;
import "dart:core" as core;
class C<T extends core::Object> extends core::Object {
field self::C<core::String> field = null;
default constructor •() → void
: super core::Object::•()
;
}
static method main() → dynamic {
core::print(new self::C::•<dynamic>());
}

View file

@ -156,6 +156,7 @@ regress/issue_29944: Crash # Issue 29944.
regress/issue_29975: Fail # Issue 29975.
regress/issue_29976: RuntimeError # Issue 29976.
regress/issue_29977: Crash # Issue 29977.
regress/issue_29981: Crash # Issue 29981.
regress/issue_29982: RuntimeError # Issue 29982.
regress/issue_29983: Crash # Issue 29983.
regress/issue_29984: Crash # Issue 29984.

View file

@ -646,6 +646,7 @@ for_variable_capture_test: RuntimeError
full_stacktrace1_test: RuntimeError
full_stacktrace2_test: RuntimeError
full_stacktrace3_test: RuntimeError
function_malformed_result_type_test: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
function_subtype_cast2_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#)) for j:closure_call(Class_test_closure.call).
function_subtype_cast3_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(Class.test#local)) for j:closure_call(Class_test_closure.call).
function_subtype_closure0_test: Crash # NoSuchMethodError: The method 'hasSubclass' was called on null.
@ -700,8 +701,12 @@ main_test/42: Crash # Assertion failure: Runtime type information not available
main_test/43: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
main_test/44: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
main_test/45: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
malformed_test/06: CompileTimeError
malformed_test/none: Crash # Internal Error: Non-empty instruction stack
malformed_test/01: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
malformed_test/02: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
malformed_test/03: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
malformed_test/04: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
malformed_test/06: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
malformed_test/none: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
many_named_arguments_test: RuntimeError
map_literal4_test: RuntimeError
method_name_test: CompileTimeError
@ -955,13 +960,22 @@ syncstar_less_than_test: RuntimeError
syncstar_yield_test/copyParameters: RuntimeError
syncstar_yield_test/none: RuntimeError
syncstar_yieldstar_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
syntax_test/02: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/03: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/27: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/28: Crash # type 'KernelConstructorBuilder' is not a subtype of type 'KernelProcedureBuilder' of 'method' where
syntax_test/29: Crash # type 'KernelConstructorBuilder' is not a subtype of type 'KernelProcedureBuilder' of 'method' where
syntax_test/30: Crash # type 'KernelConstructorBuilder' is not a subtype of type 'KernelProcedureBuilder' of 'method' where
syntax_test/31: Crash # type 'KernelConstructorBuilder' is not a subtype of type 'KernelProcedureBuilder' of 'method' where
syntax_test/32: Crash # type 'KernelConstructorBuilder' is not a subtype of type 'KernelProcedureBuilder' of 'method' where
syntax_test/33: Crash # type 'KernelConstructorBuilder' is not a subtype of type 'KernelProcedureBuilder' of 'method' where
syntax_test/none: CompileTimeError
syntax_test/49: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/54: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/59: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/60: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/61: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/62: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
syntax_test/none: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
temp_mangling_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
top_level_getter_no_setter1_test/01: RuntimeError
top_level_getter_no_setter2_test/01: RuntimeError
@ -975,6 +989,7 @@ type_parameter_test/04: Crash # Assertion failure: Runtime type information not
type_parameter_test/05: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in j:closure_call(A$bar_A$bar_closure.call).
type_parameter_test/06: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in j:closure_call(A$bar_A$bar_closure.call).
type_parameter_test/none: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in j:closure_call(A$bar_A$bar_closure.call).
type_variable_bounds_test/10: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
type_variable_closure2_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(C.list#)) for j:closure_call(C_list_closure.call).
type_variable_closure3_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(C.a#)) for j:closure_call(C_a_closure.call).
type_variable_closure4_test: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(C.map#)) for j:closure_call(C_map_closure.call).
@ -986,6 +1001,8 @@ type_variable_conflict2_test/09: RuntimeError
type_variable_field_initializer_closure2_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in j:closure_call(A_closure.call).
type_variable_field_initializer_closure_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(A.T) in j:closure_call(A_closure.call).
type_variable_function_type_test: RuntimeError
wrong_number_type_arguments_test/00: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
wrong_number_type_arguments_test/02: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
yieldstar_pause_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]
@ -1228,7 +1245,7 @@ main_test/43: Crash # Assertion failure: Runtime type information not available
main_test/44: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
main_test/45: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
malformed_test/06: CompileTimeError
malformed_test/none: Crash # Internal Error: Non-empty instruction stack
malformed_test/none: RuntimeError
many_named_arguments_test: RuntimeError
map_literal4_test: RuntimeError
method_name_test: CompileTimeError

View file

@ -730,6 +730,8 @@ named_parameters_with_dollars_test: RuntimeError
regress_30339_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
typevariable_substitution2_test/02: RuntimeError
unused_overridden_async_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
wrong_number_type_arguments_test/00: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
wrong_number_type_arguments_test/02: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
yieldstar_pause_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(_LinkedCustomHashSet.E) in j:closure_call(_LinkedCustomHashSet__LinkedCustomHashSet_closure.call).
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]