mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
Fix ParameterElementImpl.hasImplicitType for function-typed parameters.
UnlinkedParam.type serves a dual role: for ordinary parameters it is the declared type; for function-typed parameters it is the declared return type. So to determine whether a parameter has an implicit type it is not sufficient to check whether UnlinkedParam.type is `null`. We also need to check whether the parameter is function-typed. R=brianwilkerson@google.com Review-Url: https://codereview.chromium.org/2947703002 .
This commit is contained in:
parent
b5cff3f68f
commit
e8131d6f1a
|
@ -7449,7 +7449,7 @@ class ParameterElementImpl extends VariableElementImpl
|
|||
@override
|
||||
bool get hasImplicitType {
|
||||
if (_unlinkedParam != null) {
|
||||
return _unlinkedParam.type == null;
|
||||
return _unlinkedParam.type == null && !_unlinkedParam.isFunctionTyped;
|
||||
}
|
||||
return super.hasImplicitType;
|
||||
}
|
||||
|
|
|
@ -8417,6 +8417,14 @@ void f<T, U>((U) → T x) {}
|
|||
}
|
||||
}
|
||||
|
||||
test_function_typed_parameter_implicit() {
|
||||
var library = checkLibrary('f(g()) => null;');
|
||||
expect(
|
||||
library
|
||||
.definingCompilationUnit.functions[0].parameters[0].hasImplicitType,
|
||||
isFalse);
|
||||
}
|
||||
|
||||
test_functions() {
|
||||
var library = checkLibrary('f() {} g() {}');
|
||||
if (isStrongMode) {
|
||||
|
|
Loading…
Reference in a new issue