Skip to content

Commit 01be655

Browse files
committed
---
yaml --- r: 348439 b: refs/heads/master c: 6ce93ce h: refs/heads/master i: 348437: d5907ef 348435: 7ac9f18 348431: 342e689
1 parent 40767ff commit 01be655

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 99e5870309e81bef41e64743e3b4d0c77a37f3be
2+
refs/heads/master: 6ce93ce73af9c0dfd965071a7396b4ac890c03fd
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/AST/NameLookup.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,9 @@ static DirectlyReferencedTypeDecls
18571857
directReferencesForUnqualifiedTypeLookup(DeclName name,
18581858
SourceLoc loc, DeclContext *dc) {
18591859
DirectlyReferencedTypeDecls results;
1860-
UnqualifiedLookup::Options options = UnqualifiedLookup::Flags::TypeLookup;
1860+
UnqualifiedLookup::Options options =
1861+
UnqualifiedLookup::Flags::TypeLookup |
1862+
UnqualifiedLookup::Flags::AllowProtocolMembers;
18611863
UnqualifiedLookup lookup(name, dc, loc, options);
18621864
for (const auto &result : lookup.Results) {
18631865
if (auto typeDecl = dyn_cast<TypeDecl>(result.getValueDecl()))

trunk/test/decl/var/property_wrappers.swift

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,3 +1519,65 @@ func test_missing_method_with_lvalue_base() {
15191519
}
15201520
}
15211521
}
1522+
1523+
// SR-11288
1524+
// Look into the protocols that the type conforms to
1525+
1526+
// typealias as propertyWrapper //
1527+
1528+
@propertyWrapper
1529+
struct SR_11288_S0 {
1530+
var wrappedValue: Int
1531+
}
1532+
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
1579+
}
1580+
1581+
struct SR_11288_S5<T>: SR_11288_P5 {
1582+
@SR_11288_Wrapper5 var answer = 42 // Okay
1583+
}

0 commit comments

Comments
 (0)