Skip to content

Commit 33da580

Browse files
committed
Sema: Fix MissingCallFailure::diagnoseAsError() crash with special base names
1 parent 1801bbd commit 33da580

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,10 +1436,10 @@ ERROR(did_not_call_function_value,none,
14361436
())
14371437
ERROR(did_not_call_function,none,
14381438
"function %0 was used as a property; add () to call it",
1439-
(Identifier))
1439+
(DeclBaseName))
14401440
ERROR(did_not_call_method,none,
14411441
"method %0 was used as a property; add () to call it",
1442-
(Identifier))
1442+
(DeclBaseName))
14431443

14441444
ERROR(init_not_instance_member_use_assignment,none,
14451445
"'init' is a member of the type; use assignment "

lib/Sema/CSDiagnostics.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3940,22 +3940,22 @@ bool MissingCallFailure::diagnoseAsError() {
39403940

39413941
if (auto *DRE = getAsExpr<DeclRefExpr>(anchor)) {
39423942
emitDiagnostic(diag::did_not_call_function,
3943-
DRE->getDecl()->getBaseIdentifier())
3943+
DRE->getDecl()->getBaseName())
39443944
.fixItInsertAfter(insertLoc, "()");
39453945
return true;
39463946
}
39473947

39483948
if (auto *UDE = getAsExpr<UnresolvedDotExpr>(anchor)) {
39493949
emitDiagnostic(diag::did_not_call_method,
3950-
UDE->getName().getBaseIdentifier())
3950+
UDE->getName().getBaseName())
39513951
.fixItInsertAfter(insertLoc, "()");
39523952
return true;
39533953
}
39543954

39553955
if (auto *DSCE = getAsExpr<DotSyntaxCallExpr>(anchor)) {
39563956
if (auto *DRE = dyn_cast<DeclRefExpr>(DSCE->getFn())) {
39573957
emitDiagnostic(diag::did_not_call_method,
3958-
DRE->getDecl()->getBaseIdentifier())
3958+
DRE->getDecl()->getBaseName())
39593959
.fixItInsertAfter(insertLoc, "()");
39603960
return true;
39613961
}

0 commit comments

Comments
 (0)