Skip to content

Commit 4b5e617

Browse files
committed
[sema] Add some comments as follow-up for 55bf215. NFC.
1 parent 29fa5e4 commit 4b5e617

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3096,6 +3096,11 @@ static bool isIntegerToStringIndexConversion(Type fromType, Type toType,
30963096
return false;
30973097
}
30983098

3099+
/// Attempts to add a fixit to correct the compiler error.
3100+
///
3101+
/// Corrects the error is "cannot convert value of type <integer> to expected
3102+
/// argument type <RawRepresentable>", by adding a fixit that constructs the
3103+
/// raw-representable type from the value. This helps with SDK changes.
30993104
static void tryConversionFixit(InFlightDiagnostic &diag,
31003105
ConstraintSystem *CS,
31013106
Diag<Type, Type> diagID,
@@ -3119,7 +3124,7 @@ static void tryConversionFixit(InFlightDiagnostic &diag,
31193124

31203125
// When the error is "cannot convert value of type <integer> to expected
31213126
// argument type <RawRepresentable>", add a fixit that constructs the
3122-
// raw-representable type from the value. This helps with SDK changes.
3127+
// raw-representable type from the value.
31233128

31243129
if (!isIntegerType(exprType))
31253130
return;
@@ -3384,6 +3389,7 @@ bool FailureDiagnosis::diagnoseContextualConversionError() {
33843389

33853390
InFlightDiagnostic diag = diagnose(expr->getLoc(), diagID, exprType, contextualType);
33863391
diag.highlight(expr->getSourceRange());
3392+
// Attempt to add a fixit for the error.
33873393
tryConversionFixit(diag, CS, diagID, exprType, contextualType, expr);
33883394
return true;
33893395
}

0 commit comments

Comments
 (0)