Skip to content

Commit 2bec75e

Browse files
committed
[QoI] Fix position of the fix-it related to raw representable conversion
Part of the fix-it for conversion from optional to raw representable was inserted at the incorrect position which produces invalid expression. Resolves: rdar://problem/32431736
1 parent 879e8e5 commit 2bec75e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3637,7 +3637,7 @@ static bool tryRawRepresentableFixIts(InFlightDiagnostic &diag,
36373637
toType, fromType)
36383638
.highlight(exprRange)
36393639
.fixItInsert(exprRange.Start, fixItBefore)
3640-
.fixItInsert(exprRange.End, fixItAfter);
3640+
.fixItInsertAfter(exprRange.End, fixItAfter);
36413641
}
36423642
};
36433643

test/Sema/enum_raw_representable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ func rdar32431736() {
9797

9898
let myE1: E = items1.first
9999
// expected-error@-1 {{cannot convert value of type 'String?' to specified type 'E'}}
100-
// expected-note@-2 {{construct 'E' from unwrapped 'String' value}} {{17-17=E(rawValue: }} {{24-24=!)}}
100+
// expected-note@-2 {{construct 'E' from unwrapped 'String' value}} {{17-17=E(rawValue: }} {{29-29=!)}}
101101

102102
let myE2: E = items2?.first
103103
// expected-error@-1 {{cannot convert value of type 'String?' to specified type 'E'}}
104-
// expected-note@-2 {{construct 'E' from unwrapped 'String' value}} {{17-17=E(rawValue: (}} {{25-25=)!)}}
104+
// expected-note@-2 {{construct 'E' from unwrapped 'String' value}} {{17-17=E(rawValue: (}} {{30-30=)!)}}
105105
}
106106

107107
// rdar://problem/32431165 - improve diagnostic for raw representable argument mismatch

0 commit comments

Comments
 (0)