mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
Handle 'dynamic' as type argument in generic calls.
R=eernst@google.com Review URL: https://codereview.chromium.org/2541473002 .
This commit is contained in:
parent
44bdc75827
commit
40bf5d321e
|
@ -577,7 +577,7 @@ class Parser {
|
|||
/// Returns token after match if [token] matches identifier ('.' identifier)?,
|
||||
/// and otherwise returns null. Does not produce listener events.
|
||||
Token tryParseQualified(Token token) {
|
||||
if (!identical(token.kind, IDENTIFIER_TOKEN)) return null;
|
||||
if (!isValidTypeReference(token)) return null;
|
||||
token = token.next;
|
||||
if (!identical(token.kind, PERIOD_TOKEN)) return token;
|
||||
token = token.next;
|
||||
|
|
|
@ -68,6 +68,13 @@ X aFunction<X>() => new X(42);
|
|||
main() {
|
||||
aFunction<Set>();
|
||||
}
|
||||
''',
|
||||
|
||||
'dynamic_as_type_argument.dart': '''
|
||||
main() {
|
||||
method<dynamic>();
|
||||
}
|
||||
method<T>() {}
|
||||
''',
|
||||
};
|
||||
|
||||
|
@ -84,7 +91,7 @@ Future runTest(Uri main, {MessageKind warning, MessageKind info}) async {
|
|||
outputProvider: output);
|
||||
|
||||
Expect.isFalse(output.hasExtraOutput);
|
||||
Expect.equals(0, diagnostics.errors.length);
|
||||
Expect.equals(0, diagnostics.errors.length, "Unexpected errors.");
|
||||
Expect.equals(warning != null ? 1 : 0, diagnostics.warnings.length);
|
||||
if (warning != null) {
|
||||
Expect.equals(warning, diagnostics.warnings.first.message.kind);
|
||||
|
@ -105,5 +112,7 @@ void main() {
|
|||
|
||||
await runTest(Uri.parse('memory:cannot_new_function_type_variable.dart'),
|
||||
warning: MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE);
|
||||
|
||||
await runTest(Uri.parse('memory:dynamic_as_type_argument.dart'));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue