Skip to content

Commit 5431efa

Browse files
committed
Add fixed test case from rdar://problem/53349209
1 parent 8613b05 commit 5431efa

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/decl/var/property_wrappers.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,3 +1697,29 @@ struct SR_11381_W<T> {
16971697
struct SR_11381_S {
16981698
@SR_11381_W var foo: Int = nil // expected-error {{'nil' is not compatible with expected argument type 'Int'}}
16991699
}
1700+
1701+
// rdar://problem/53349209 - regression in property wrapper inference
1702+
struct Concrete1: P {}
1703+
1704+
@propertyWrapper struct ConcreteWrapper {
1705+
var wrappedValue: Concrete1 { get { fatalError() } }
1706+
}
1707+
1708+
struct TestConcrete1 {
1709+
@ConcreteWrapper() var s1
1710+
1711+
func f() {
1712+
// Good:
1713+
let _: P = self.s1
1714+
1715+
// Bad:
1716+
self.g(s1: self.s1)
1717+
1718+
// Ugly:
1719+
self.g(s1: self.s1 as P)
1720+
}
1721+
1722+
func g(s1: P) {
1723+
// ...
1724+
}
1725+
}

0 commit comments

Comments
 (0)