Skip to content

Commit

Permalink
Version 3.6.0-182.0.dev
Browse files Browse the repository at this point in the history
Merge a6dbe2f into dev
  • Loading branch information
Dart CI committed Aug 26, 2024
2 parents 8163e2e + a6dbe2f commit e62e4b9
Show file tree
Hide file tree
Showing 17 changed files with 6,497 additions and 5,551 deletions.
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/dart/analysis/file_analysis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ class FileAnalysis {
final RecordingErrorListener errorListener;
final ErrorReporter errorReporter;
final CompilationUnitImpl unit;
final CompilationUnitElementImpl element;
final IgnoreInfo ignoreInfo;

late final CompilationUnitElementImpl element;

FileAnalysis({
required this.file,
required this.errorListener,
required this.unit,
required this.element,
}) : errorReporter = ErrorReporter(errorListener, file.source),
ignoreInfo = IgnoreInfo.forDart(unit, file.content);
}
20 changes: 14 additions & 6 deletions pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ class LibraryAnalyzer {
required OperationPerformanceImpl performance,
}) {
var fileAnalysis = performance.run('parse', (performance) {
return _parse(file);
return _parse(
file: file,
unitElement: unitElement,
);
});
var parsedUnit = fileAnalysis.unit;
parsedUnit.declaredElement = unitElement;

var node = NodeLocator(offset).searchWithin(parsedUnit);

Expand Down Expand Up @@ -585,19 +587,24 @@ class LibraryAnalyzer {
}

/// Return a new parsed unresolved [CompilationUnit].
FileAnalysis _parse(FileState file) {
FileAnalysis _parse({
required FileState file,
required CompilationUnitElementImpl unitElement,
}) {
var errorListener = RecordingErrorListener();
var unit = file.parse(
errorListener: errorListener,
performance: OperationPerformanceImpl('<root>'),
);
unit.declaredElement = unitElement;

// TODO(scheglov): Store [IgnoreInfo] as unlinked data.

var result = FileAnalysis(
file: file,
errorListener: errorListener,
unit: unit,
element: unitElement,
);
_libraryFiles[file] = result;
return result;
Expand Down Expand Up @@ -752,12 +759,13 @@ class LibraryAnalyzer {
required FileKind fileKind,
required CompilationUnitElementImpl fileElement,
}) {
var fileAnalysis = _parse(fileKind.file);
var fileAnalysis = _parse(
file: fileKind.file,
unitElement: fileElement,
);
var containerUnit = fileAnalysis.unit;
containerUnit.declaredElement = fileElement;

var containerErrorReporter = fileAnalysis.errorReporter;
fileAnalysis.element = fileElement;

var augmentationImportIndex = 0;
var libraryExportIndex = 0;
Expand Down
5 changes: 3 additions & 2 deletions pkg/analyzer/lib/src/generated/error_verifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3452,11 +3452,12 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
}) {
void report(String memberName, List<ExecutableElement> candidates) {
var contextMessages = candidates.map<DiagnosticMessage>((executable) {
var nonSynthetic = executable.nonSynthetic;
var container = executable.enclosingElement as InterfaceElement;
return DiagnosticMessageImpl(
filePath: executable.source.fullName,
offset: executable.nameOffset,
length: executable.nameLength,
offset: nonSynthetic.nameOffset,
length: nonSynthetic.nameLength,
message: "Inherited from '${container.name}'",
url: null,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ extension type B(int it) implements A1, A2 {}
]);
}

test_conflict_representationField() async {
await assertErrorsInCode('''
extension type A(String bar) {}
extension type B(String bar) {}
extension type C(String foo) implements A, B {}
''', [
error(
CompileTimeErrorCode.EXTENSION_TYPE_INHERITED_MEMBER_CONFLICT,
81,
1,
contextMessages: [
message(testFile, 24, 3),
message(testFile, 57, 3),
],
),
]);
}

test_noConflict_redeclared() async {
await assertNoErrorsInCode('''
extension type A1(int it) {
Expand Down
Loading

0 comments on commit e62e4b9

Please sign in to comment.