File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -989,6 +989,7 @@ class StringLiteralExpr : public LiteralExpr {
989
989
// / "[\(min)..\(max)]"
990
990
// / \endcode
991
991
class InterpolatedStringLiteralExpr : public LiteralExpr {
992
+ // / Points at the beginning quote.
992
993
SourceLoc Loc;
993
994
MutableArrayRef<Expr *> Segments;
994
995
Expr *SemanticExpr;
@@ -1007,10 +1008,12 @@ class InterpolatedStringLiteralExpr : public LiteralExpr {
1007
1008
void setSemanticExpr (Expr *SE) { SemanticExpr = SE; }
1008
1009
1009
1010
SourceLoc getStartLoc () const {
1010
- return Segments. front ()-> getStartLoc () ;
1011
+ return Loc ;
1011
1012
}
1012
1013
SourceLoc getEndLoc () const {
1013
- return Segments.back ()->getEndLoc ();
1014
+ // SourceLocs are token based, and the interpolated string is one string
1015
+ // token, so the range should be (Start == End).
1016
+ return Loc;
1014
1017
}
1015
1018
1016
1019
static bool classof (const Expr *E) {
Original file line number Diff line number Diff line change @@ -78,6 +78,16 @@ func testMask13(a: MyEventMask2?) {
78
78
testMask1 ( a: a) // no fix, nullability mismatch.
79
79
}
80
80
81
+ struct SomeName : RawRepresentable {
82
+ init ( _ rawValue: String ) { }
83
+ init ( rawValue: String ) { }
84
+ var rawValue : String { return " " }
85
+ }
86
+ func testPassSomeName( _: SomeName ) { }
87
+ func testConvertSomeName( s: String ) {
88
+ testPassSomeName ( " \( s) } " )
89
+ }
90
+
81
91
enum MyEnumType : UInt32 {
82
92
case invalid
83
93
}
Original file line number Diff line number Diff line change @@ -78,6 +78,16 @@ func testMask13(a: MyEventMask2?) {
78
78
testMask1(a: a) // no fix, nullability mismatch.
79
79
}
80
80
81
+ struct SomeName : RawRepresentable {
82
+ init(_ rawValue: String) {}
83
+ init(rawValue: String) {}
84
+ var rawValue: String { return "" }
85
+ }
86
+ func testPassSomeName(_: SomeName) {}
87
+ func testConvertSomeName(s: String) {
88
+ testPassSomeName(SomeName(rawValue: "\(s)}"))
89
+ }
90
+
81
91
enum MyEnumType : UInt32 {
82
92
case invalid
83
93
}
You can’t perform that action at this time.
0 commit comments