Skip to content

Commit 6bc61fe

Browse files
committed
Fix a fix-it to cast to the destination type, not the source type.
Copy/paste issue, most likely.
1 parent 2bfe921 commit 6bc61fe

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
@@ -3719,7 +3719,7 @@ static bool tryRawRepresentableFixIts(InFlightDiagnostic &diag,
37193719
std::string convWrapBefore;
37203720
std::string convWrapAfter = ".rawValue";
37213721
if (rawTy->getCanonicalType() != toType->getCanonicalType()) {
3722-
convWrapBefore += rawTy->getString();
3722+
convWrapBefore += toType->getString();
37233723
convWrapBefore += "(";
37243724
convWrapAfter += ")";
37253725
}

test/FixCode/fixits-apply.swift.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func testMask2(a: UInt64) {
4545
sendIt(MyEventMask2(rawValue: a))
4646
}
4747
func testMask3(a: MyEventMask2) {
48-
testMask1(a: UInt64(a.rawValue))
48+
testMask1(a: Int(a.rawValue))
4949
}
5050
func testMask4(a: MyEventMask2) {
5151
testMask2(a: a.rawValue)
@@ -69,7 +69,7 @@ func testMask10(a: Int?) {
6969
sendIt(a) // no fix, nullability mismatch.
7070
}
7171
func testMask11(a: MyEventMask2?) {
72-
testMask7(a: a.map { UInt64($0.rawValue) })
72+
testMask7(a: a.map { Int($0.rawValue) })
7373
}
7474
func testMask12(a: MyEventMask2?) {
7575
testMask8(a: a.map { $0.rawValue })

0 commit comments

Comments
 (0)