Skip to content

Adapt to the state when FunctionTypeAliasElement does not implement FunctionTypedElement. #2051

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3257,6 +3257,8 @@ abstract class ModelElement extends Canonicalization
if (e is FunctionElement) {
newModelElement = ModelFunction(e, library, packageGraph);
} else if (e is GenericFunctionTypeElement) {
// TODO(scheglov) "e" cannot be both GenericFunctionTypeElement,
// and FunctionTypeAliasElement or GenericTypeAliasElement.
if (e is FunctionTypeAliasElement) {
assert(e.name != '');
newModelElement = ModelFunctionTypedef(e, library, packageGraph);
Expand Down Expand Up @@ -3517,7 +3519,9 @@ abstract class ModelElement extends Canonicalization
}

bool get canHaveParameters =>
element is ExecutableElement || element is FunctionTypedElement;
element is ExecutableElement ||
element is FunctionTypedElement ||
element is FunctionTypeAliasElement;

ModelElement _buildCanonicalModelElement() {
Container preferredClass;
Expand Down Expand Up @@ -4049,6 +4053,9 @@ abstract class ModelElement extends Canonicalization
params = (element as FunctionTypedElement).parameters;
}
}
if (params == null && element is FunctionTypeAliasElement) {
params = (element as FunctionTypeAliasElement).function.parameters;
}

_parameters = UnmodifiableListView<Parameter>(params
.map((p) => ModelElement.from(p, library, packageGraph) as Parameter)
Expand Down