Skip to content

Commit

Permalink
Version 3.4.0-64.0.dev
Browse files Browse the repository at this point in the history
Merge 4a82018 into dev
  • Loading branch information
Dart CI committed Jan 24, 2024
2 parents 838cd73 + 4a82018 commit 69af2ca
Show file tree
Hide file tree
Showing 221 changed files with 346 additions and 10,017 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {

@override
void visitInterpolationExpression(InterpolationExpression node) {
declarationHelper(mustBeStatic: node.inStaticContext)
declarationHelper(mustBeStatic: node.inStaticContext, mustBeNonVoid: true)
.addLexicalDeclarations(node);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,30 @@ import '../../../../client/completion_driver_test.dart';

void main() {
defineReflectiveSuite(() {
defineReflectiveTests(StringInterpolationTest);
defineReflectiveTests(StringLiteralTest);
});
}

@reflectiveTest
class StringInterpolationTest extends AbstractCompletionDriverTest
with StringInterpolationTestCases {}

mixin StringInterpolationTestCases on AbstractCompletionDriverTest {
Future<void> test_inBraces_nonVoid() async {
await computeSuggestions(r'''
var s = 'a ${^} b';
void f0() {}
int f1() {}
''');
assertResponse(r'''
suggestions
f1
kind: functionInvocation
''');
}
}

@reflectiveTest
class StringLiteralTest extends AbstractCompletionDriverTest
with StringLiteralTestCases {}
Expand Down
5 changes: 4 additions & 1 deletion pkg/analyzer/lib/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ abstract class AugmentedClassElement implements AugmentedInterfaceElement {
/// The result of applying augmentations to an [EnumElement].
///
/// Clients may not extend, implement or mix-in this class.
abstract class AugmentedEnumElement implements AugmentedInterfaceElement {}
abstract class AugmentedEnumElement implements AugmentedInterfaceElement {
@override
EnumElement get declaration;
}

/// The result of applying augmentations to an [ExtensionElement].
///
Expand Down
30 changes: 20 additions & 10 deletions pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
import 'package:analyzer/src/dart/resolver/resolution_visitor.dart';
import 'package:analyzer/src/error/best_practices_verifier.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/error/constructor_fields_verifier.dart';
import 'package:analyzer/src/error/dead_code_verifier.dart';
import 'package:analyzer/src/error/ignore_validator.dart';
import 'package:analyzer/src/error/imports_verifier.dart';
Expand Down Expand Up @@ -79,8 +80,8 @@ class LibraryAnalyzer {
final Map<FileState, IgnoreInfo> _fileToIgnoreInfo = {};
final Map<FileState, RecordingErrorListener> _errorListeners = {};
final Map<FileState, ErrorReporter> _errorReporters = {};
final LibraryVerificationContext _libraryVerificationContext =
LibraryVerificationContext();
late final LibraryVerificationContext _libraryVerificationContext;

final TestingData? _testingData;
final TypeSystemOperations _typeSystemOperations;

Expand All @@ -89,7 +90,13 @@ class LibraryAnalyzer {
{TestingData? testingData,
required TypeSystemOperations typeSystemOperations})
: _testingData = testingData,
_typeSystemOperations = typeSystemOperations;
_typeSystemOperations = typeSystemOperations {
_libraryVerificationContext = LibraryVerificationContext(
constructorFieldsVerifier: ConstructorFieldsVerifier(
typeSystem: _typeSystem,
),
);
}

TypeProviderImpl get _typeProvider => _libraryElement.typeProvider;

Expand Down Expand Up @@ -271,6 +278,8 @@ class LibraryAnalyzer {
_computeVerifyErrors(file, unit);
});

_libraryVerificationContext.constructorFieldsVerifier.report();

if (_analysisOptions.warning) {
var usedImportedElements = <UsedImportedElements>[];
var usedLocalElements = <UsedLocalElements>[];
Expand Down Expand Up @@ -406,13 +415,14 @@ class LibraryAnalyzer {
// Use the ErrorVerifier to compute errors.
//
ErrorVerifier errorVerifier = ErrorVerifier(
errorReporter,
_libraryElement,
_typeProvider,
_inheritance,
_libraryVerificationContext,
_analysisOptions,
typeSystemOperations: _typeSystemOperations);
errorReporter,
_libraryElement,
_typeProvider,
_inheritance,
_libraryVerificationContext,
_analysisOptions,
typeSystemOperations: _typeSystemOperations,
);
unit.accept(errorVerifier);

// Verify constraints on FFI uses. The CFE enforces these constraints as
Expand Down
8 changes: 8 additions & 0 deletions pkg/analyzer/lib/src/dart/element/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,14 @@ class ConstructorElementImpl extends ExecutableElementImpl
/// and [offset].
ConstructorElementImpl(super.name, super.offset);

ConstructorElementImpl? get augmentedDeclaration {
if (isAugmentation) {
return augmentationTarget?.augmentedDeclaration;
} else {
return this;
}
}

/// Return the constant initializers for this element, which will be empty if
/// there are no initializers, or `null` if there was an error in the source.
List<ConstructorInitializer> get constantInitializers {
Expand Down
Loading

0 comments on commit 69af2ca

Please sign in to comment.