Skip to content

Commit 5464400

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Stop reporting diagnostics on synthetic identifiers (issue 38448)
Change-Id: Ief9b77a48526454db430bc131d3c1dbd04234dc1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117761 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent f3b54fa commit 5464400

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ class DuplicateDefinitionVerifier {
343343
void _checkDuplicateIdentifier(
344344
Map<String, Element> getterScope, SimpleIdentifier identifier,
345345
{Element element, Map<String, Element> setterScope}) {
346+
if (identifier.isSynthetic) {
347+
return;
348+
}
346349
element ??= identifier.staticElement;
347350

348351
// Fields define getters and setters, so check them separately.

pkg/analyzer/test/src/diagnostics/duplicate_definition_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/dart/analysis/features.dart';
6+
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
67
import 'package:analyzer/src/error/codes.dart';
78
import 'package:analyzer/src/generated/engine.dart';
89
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -316,6 +317,15 @@ class C {
316317
error(CompileTimeErrorCode.DUPLICATE_DEFINITION, 56, 3),
317318
]);
318319
}
320+
321+
test_topLevel_syntheticParameters() async {
322+
await assertErrorsInCode(r'''
323+
f(,[]) {}
324+
''', [
325+
error(ParserErrorCode.MISSING_IDENTIFIER, 2, 1),
326+
error(ParserErrorCode.MISSING_IDENTIFIER, 4, 1),
327+
]);
328+
}
319329
}
320330

321331
@reflectiveTest

0 commit comments

Comments
 (0)