Skip to content

Commit bdcb248

Browse files
committed
---
yaml --- r: 349416 b: refs/heads/master-next c: 1063e97 h: refs/heads/master
1 parent 91b8ad2 commit bdcb248

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: c7422c297d5912ef0c07355d95fbb2e70bad70b8
3+
refs/heads/master-next: 1063e97cef84f459704b0de76bbd977fdbce6462
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/lib/Parse/ParseExpr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,11 +1855,11 @@ parseStringSegments(SmallVectorImpl<Lexer::StringSegment> &Segments,
18551855
TokReceiver->registerTokenKindChange(Tok.getLoc(),
18561856
tok::string_interpolation_anchor);
18571857

1858-
auto callee = new (Context) UnresolvedDotExpr(InterpolationVarRef,
1859-
/*dotloc=*/BackSlashLoc,
1860-
appendInterpolation,
1861-
/*nameloc=*/DeclNameLoc(),
1862-
/*Implicit=*/true);
1858+
auto callee = new (Context)
1859+
UnresolvedDotExpr(InterpolationVarRef,
1860+
/*dotloc=*/BackSlashLoc, appendInterpolation,
1861+
/*nameloc=*/DeclNameLoc(Segment.Loc),
1862+
/*Implicit=*/true);
18631863
auto S = parseExprCallSuffix(makeParserResult(callee), true);
18641864

18651865
// If we stopped parsing the expression before the expression segment is
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %target-swift-frontend -swift-version 5 -typecheck %s 2>&1 | %FileCheck %s
2+
3+
extension DefaultStringInterpolation {
4+
@available(*, deprecated) func appendInterpolation(deprecated: Int) {}
5+
}
6+
7+
// Make sure diagnostics emitted via string interpolations have a reasonable source location
8+
9+
_ = "\(deprecated: 42)"
10+
// CHECK: [[@LINE-1]]:7: warning: 'appendInterpolation(deprecated:)' is deprecated
11+
12+
_ = "hello, world\(deprecated: 42)!!!"
13+
// CHECK: [[@LINE-1]]:19: warning: 'appendInterpolation(deprecated:)' is deprecated
14+
15+
_ = "\(42)\(deprecated: 42)test\(deprecated: 42)"
16+
// CHECK: [[@LINE-1]]:12: warning: 'appendInterpolation(deprecated:)' is deprecated
17+
// CHECK: [[@LINE-2]]:33: warning: 'appendInterpolation(deprecated:)' is deprecated
18+
19+
_ = """
20+
This is a multiline literal with a deprecated interpolation:
21+
22+
\(deprecated: 42)
23+
"""
24+
// CHECK: [[@LINE-2]]:2: warning: 'appendInterpolation(deprecated:)' is deprecated

0 commit comments

Comments
 (0)