-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception in StrongTypeSystemImpl.functionTypeToConcreteType #27133
Comments
Looks like the |
oh dear. elements with null types should not really happen. That's super bad because we rely on ParameterElement having a type in a ton of places. |
@bwilkerson Any thoughts? Given that the documentation explicitly calls out that it might be null I'm hesitant to rely on it being non-null, but it does feel a bit off to me. |
so I looked up those docs, that's for VariableElement (and I'm not sure if the doc is still true, but ignoring that). ParameterElement seems to always have a type filled in if you look in resolver.dart. Here's visitSimpleFormalParameter, but the others are similar: Object visitSimpleFormalParameter(SimpleFormalParameter node) {
super.visitSimpleFormalParameter(node);
DartType declaredType;
TypeName typeName = node.type;
if (typeName == null) {
declaredType = _dynamicType;
} else {
declaredType = _typeNameResolver._getType(typeName);
}
Element element = node.identifier.staticElement;
if (element is ParameterElementImpl) {
element.type = declaredType;
} else {
// TODO(brianwilkerson) Report the internal error.
}
return null;
} (_typeNameResolver._getType returns |
and the doc claims: /**
* Return the declared type of this variable, or `null` if the variable did
* not have a declared type (such as if it was declared using the keyword
* 'var').
*/ but that's not what the code seems to do anymore, even for variables. |
I think it would be better if |
I found why this happens. |
R=brianwilkerson@google.com BUG=#27133 Review URL: https://codereview.chromium.org/2276733003 .
I was typing
in
pkg/analysis_server/test/analysis_abstract.dart
.Somewhere after typing
AnalysisContext
it throws an exception.The text was updated successfully, but these errors were encountered: