Skip to content

Commit 119e886

Browse files
authored
Merge pull request #38656 from hamishknight/up-for-interpolation
[test] Add test for inout arg in strange interpolation
2 parents fb4ee55 + 916d7b6 commit 119e886

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 4.2
2+
3+
var x = 0
4+
_ = "\(&x)"
5+
// expected-error@-1 {{'&' used with non-inout argument of type 'Int'}}
6+
7+
_ = "\(y: &x)"
8+
// expected-error@-1 {{'&' used with non-inout argument of type 'Int'}}
9+
// expected-warning@-2 {{labeled interpolations will not be ignored in Swift 5}}
10+
// expected-note@-3 {{remove 'y' label to keep current behavior}}
11+
12+
_ = "\(x, y: &x)"
13+
// expected-error@-1 {{use of extraneous '&'}}
14+
// expected-warning@-2 {{interpolating multiple values will not form a tuple in Swift 5}}
15+
// expected-note@-3 {{insert parentheses to keep current behavior}}

0 commit comments

Comments
 (0)