File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3
- refs/heads/master-next: 4aefbcf447d24250c246a9f04d7c31fe32b93a0f
3
+ refs/heads/master-next: 97f3c39c46d969c8dbf21dbdeb3e9e12d5e9cb96
4
4
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
5
5
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
6
6
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07
Original file line number Diff line number Diff line change @@ -1964,8 +1964,17 @@ void TypeChecker::validateDecl(OperatorDecl *OD) {
1964
1964
}
1965
1965
1966
1966
bool swift::doesContextHaveValueSemantics (DeclContext *dc) {
1967
- if (Type contextTy = dc->getDeclaredInterfaceType ())
1968
- return !contextTy->hasReferenceSemantics ();
1967
+ if (Type contextTy = dc->getDeclaredInterfaceType ()) {
1968
+ // If the decl context is an extension, then it could be imposing a class
1969
+ // constraint (ex: where Self: SomeClass). Make sure we include that
1970
+ // in our check as well.
1971
+ auto extensionRequiresClass = false ;
1972
+ if (auto ED = dyn_cast<ExtensionDecl>(dc)) {
1973
+ extensionRequiresClass =
1974
+ ED->getGenericSignature ()->requiresClass (ED->getSelfInterfaceType ());
1975
+ }
1976
+ return !contextTy->hasReferenceSemantics () && !extensionRequiresClass;
1977
+ }
1969
1978
return false ;
1970
1979
}
1971
1980
Original file line number Diff line number Diff line change @@ -124,3 +124,23 @@ struct WrapperContext {
124
124
static let propUsingMember = originalValue
125
125
}
126
126
}
127
+
128
+ // SR-11298
129
+
130
+ protocol SR_11298_P { }
131
+
132
+ class SR_11298_C : SR_11298_P {
133
+ var property : String = " "
134
+ }
135
+
136
+ // Self: SR_11298_C requirement constrains this extension to SR_11298C and its subclasses.
137
+ // Since this implies a class constraint, the setter should be implicitly nonmutating.
138
+ extension SR_11298_P where Self: SR_11298_C {
139
+ var wrappingProperty : String {
140
+ get { return property }
141
+ set { property = newValue }
142
+ }
143
+ }
144
+
145
+ let instance = SR_11298_C ( )
146
+ instance. wrappingProperty = " " // Okay
You can’t perform that action at this time.
0 commit comments