Skip to content

Commit

Permalink
[analyzer] Resolve nullability of generic function types
Browse files Browse the repository at this point in the history
Change-Id: Ie14ae8844b83f54b5e2c9d1d5424ca8f015bb5d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101463
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Mike Fairhurst <[email protected]>
  • Loading branch information
MichaelRFairhurst authored and [email protected] committed May 6, 2019
1 parent 36c315e commit 7928dbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pkg/analyzer/lib/src/generated/resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7908,6 +7908,12 @@ class TypeResolverVisitor extends ScopedVisitor {
@override
void visitGenericFunctionType(GenericFunctionType node) {
GenericFunctionTypeElementImpl element = node.type?.element;
if (node.type != null) {
var nullability =
_typeNameResolver._getNullability(node.question != null);
(node as GenericFunctionTypeImpl).type =
(node.type as TypeImpl).withNullability(nullability);
}
if (element != null) {
super.visitGenericFunctionType(node);
element.returnType =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ m() {
''');
}

@failingTest
test_invoke_nullable() async {
// test is failing because nullable function invocations aren't being
// resolved correctly
await assertErrorCodesInCode(r'''
m() {
Function()? x;
Expand Down

0 comments on commit 7928dbd

Please sign in to comment.