From 0fa438df957036f394a66130dc58dd67f71fa24d Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Mon, 6 May 2024 17:21:13 +0000 Subject: [PATCH] Augment. Fix resolving AugmentedInvocation after AugmentedExpression for fields changes. Each change separately worked, together - logical merge conflict. Bug: https://github.com/dart-lang/sdk/issues/55650 Change-Id: If839fcc5dca980902f1e69f5a4b5706812163bb7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365482 Reviewed-by: Brian Wilkerson Commit-Queue: Konstantin Shcheglov --- pkg/analyzer/lib/src/generated/resolver.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart index fe38fcaa14d..2f8540cb9fa 100644 --- a/pkg/analyzer/lib/src/generated/resolver.dart +++ b/pkg/analyzer/lib/src/generated/resolver.dart @@ -84,7 +84,6 @@ import 'package:analyzer/src/generated/utilities_dart.dart'; import 'package:analyzer/src/generated/variable_type_provider.dart'; import 'package:analyzer/src/task/inference_error.dart'; import 'package:analyzer/src/util/ast_data_extractor.dart'; -import 'package:analyzer/src/utilities/extensions/object.dart'; typedef SharedMatchContext = shared.MatchContext; @@ -2148,7 +2147,7 @@ class ResolverVisitor extends ThrowingAstVisitor var outerAugmentation = _enclosingAugmentation; try { _enclosingFunction = element; - _enclosingAugmentation = element.ifTypeOrNull(); + _enclosingAugmentation = element; assert(_thisType == null); _setupThisType(); checkUnreachableNode(node); @@ -2596,7 +2595,9 @@ class ResolverVisitor extends ThrowingAstVisitor try { _enclosingFunction = element; if (!isLocal) { - _enclosingAugmentation = element.ifTypeOrNull(); + if (element case AugmentableElement enclosingAugmentation) { + _enclosingAugmentation = enclosingAugmentation; + } } checkUnreachableNode(node); node.documentationComment?.accept(this); @@ -2938,7 +2939,9 @@ class ResolverVisitor extends ThrowingAstVisitor var outerAugmentation = _enclosingAugmentation; try { _enclosingFunction = element; - _enclosingAugmentation = element.ifTypeOrNull(); + if (element case AugmentableElement enclosingAugmentation) { + _enclosingAugmentation = enclosingAugmentation; + } assert(_thisType == null); _setupThisType(); checkUnreachableNode(node); @@ -3565,7 +3568,9 @@ class ResolverVisitor extends ThrowingAstVisitor var outerAugmentation = _enclosingAugmentation; try { - _enclosingAugmentation = element.ifTypeOrNull(); + if (element case AugmentableElement enclosingAugmentation) { + _enclosingAugmentation = enclosingAugmentation; + } libraryResolutionContext._variableNodes[element] = node; _variableDeclarationResolver.resolve(node); } finally {