Skip to content

Commit 9def526

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 (cherry picked from commit 2bec75e)
1 parent cdc3e6c commit 9def526

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
@@ -3638,7 +3638,7 @@ static bool tryRawRepresentableFixIts(InFlightDiagnostic &diag,
36383638
toType, fromType)
36393639
.highlight(exprRange)
36403640
.fixItInsert(exprRange.Start, fixItBefore)
3641-
.fixItInsert(exprRange.End, fixItAfter);
3641+
.fixItInsertAfter(exprRange.End, fixItAfter);
36423642
}
36433643
};
36443644

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)