Skip to content

Commit acba675

Browse files
committed
[Test] Add more test cases as requested
1 parent 0948695 commit acba675

File tree

1 file changed

+51
-5
lines changed

1 file changed

+51
-5
lines changed

test/decl/var/property_wrappers.swift

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,15 +1523,61 @@ func test_missing_method_with_lvalue_base() {
15231523
// SR-11288
15241524
// Look into the protocols that the type conforms to
15251525

1526+
// typealias as propertyWrapper //
1527+
15261528
@propertyWrapper
1527-
struct SR_11288_S {
1529+
struct SR_11288_S0 {
15281530
var wrappedValue: Int
15291531
}
15301532

1531-
protocol SR_11288_P {
1532-
typealias Wrapper = SR_11288_S
1533+
protocol SR_11288_P1 {
1534+
typealias SR_11288_Wrapper1 = SR_11288_S0
1535+
}
1536+
1537+
struct SR_11288_S1: SR_11288_P1 {
1538+
@SR_11288_Wrapper1 var answer = 42 // Okay
1539+
}
1540+
1541+
// associatedtype as propertyWrapper //
1542+
1543+
protocol SR_11288_P2 {
1544+
associatedtype SR_11288_Wrapper2 = SR_11288_S0
1545+
}
1546+
1547+
struct SR_11288_S2: SR_11288_P2 {
1548+
@SR_11288_Wrapper2 var answer = 42 // expected-error {{unknown attribute 'SR_11288_Wrapper2'}}
1549+
}
1550+
1551+
protocol SR_11288_P3 {
1552+
associatedtype SR_11288_Wrapper3
1553+
}
1554+
1555+
struct SR_11288_S3: SR_11288_P3 {
1556+
typealias SR_11288_Wrapper3 = SR_11288_S0
1557+
@SR_11288_Wrapper3 var answer = 42 // Okay
1558+
}
1559+
1560+
// typealias as propertyWrapper in a constrained protocol extension //
1561+
1562+
protocol SR_11288_P4 {}
1563+
extension SR_11288_P4 where Self: AnyObject {
1564+
typealias SR_11288_Wrapper4 = SR_11288_S0
1565+
}
1566+
1567+
struct SR_11288_S4: SR_11288_P4 {
1568+
@SR_11288_Wrapper4 var answer = 42 // expected-error 2 {{'SR_11288_S4.SR_11288_Wrapper4.Type' (aka 'SR_11288_S0.Type') requires that 'SR_11288_S4' conform to 'AnyObject'}}
1569+
}
1570+
1571+
class SR_11288_C0: SR_11288_P4 {
1572+
@SR_11288_Wrapper4 var answer = 42 // Okay
1573+
}
1574+
1575+
// typealias as propertyWrapper in a generic type //
1576+
1577+
protocol SR_11288_P5 {
1578+
typealias SR_11288_Wrapper5 = SR_11288_S0
15331579
}
15341580

1535-
struct SR_11288_C: SR_11288_P {
1536-
@Wrapper var answer = 42 // Okay
1581+
struct SR_11288_S5<T>: SR_11288_P5 {
1582+
@SR_11288_Wrapper5 var answer = 42 // Okay
15371583
}

0 commit comments

Comments
 (0)