Skip to content

Commit 6694c16

Browse files
authored
Merge pull request #77887 from aphananthe42/56350
Refactor the remaining parts of replacing starts_with("_") with hasUnderscoredNaming()
2 parents 463b615 + f4a3a65 commit 6694c16

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Sema/TypeCheckNameLookup.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,15 +548,16 @@ unsigned TypeChecker::getCallEditDistance(DeclNameRef writtenName,
548548
return 0;
549549
}
550550

551-
StringRef writtenBase = writtenName.getBaseName().userFacingName();
552-
StringRef correctedBase = correctedName.getBaseName().userFacingName();
553-
554551
// Don't typo-correct to a name with a leading underscore unless the typed
555552
// name also begins with an underscore.
556-
if (correctedBase.starts_with("_") && !writtenBase.starts_with("_")) {
553+
if (correctedName.getBaseIdentifier().hasUnderscoredNaming() &&
554+
!writtenName.getBaseIdentifier().hasUnderscoredNaming()) {
557555
return UnreasonableCallEditDistance;
558556
}
559557

558+
StringRef writtenBase = writtenName.getBaseName().userFacingName();
559+
StringRef correctedBase = correctedName.getBaseName().userFacingName();
560+
560561
unsigned distance = writtenBase.edit_distance(correctedBase, maxEditDistance);
561562

562563
// Bound the distance to UnreasonableCallEditDistance.

0 commit comments

Comments
 (0)