Fix a bug in unreachableFromMain
Closes https://github.com/dart-lang/sdk/issues/63425 Change-Id: I4bffe8413c56e4d71ae48284c6960085abf33d2f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505482 Auto-Submit: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Keerti Parthasarathy <keertip@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
f4ff72aadd
commit
aa67f94ba2
@@ -705,8 +705,11 @@ extension on Declaration {
|
||||
return self.namePart.typeName.lexeme;
|
||||
case ConstructorDeclaration():
|
||||
var name = self.name?.lexeme ?? 'new';
|
||||
// TODO(scheglov): support primary constructors
|
||||
return '${self.typeName!.name}.$name';
|
||||
var typeName =
|
||||
self.typeName ??
|
||||
self.declaredFragment?.element.enclosingElement.name ??
|
||||
'unknown';
|
||||
return '$typeName.$name';
|
||||
case EnumConstantDeclaration():
|
||||
return self.name.lexeme;
|
||||
case EnumDeclaration():
|
||||
|
||||
@@ -624,6 +624,19 @@ void main() {}
|
||||
]);
|
||||
}
|
||||
|
||||
test_constructor_named_new() async {
|
||||
// https://github.com/dart-lang/sdk/issues/63425
|
||||
await assertDiagnosticsFromMarkdown(r'''
|
||||
void main() {
|
||||
C;
|
||||
}
|
||||
|
||||
class C {
|
||||
new [!named!]();
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
test_constructor_named_onEnum() async {
|
||||
await assertNoDiagnostics(r'''
|
||||
void main() {
|
||||
|
||||
Reference in New Issue
Block a user