File tree Expand file tree Collapse file tree 5 files changed +20
-8
lines changed Expand file tree Collapse file tree 5 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,9 @@ class alignas(8) Pattern {
163
163
});
164
164
}
165
165
166
+ // / Does this binding declare something that requires storage?
167
+ bool hasStorage () const ;
168
+
166
169
static bool classof (const Pattern *P) { return true ; }
167
170
168
171
// *** Allocation Routines ************************************************/
Original file line number Diff line number Diff line change @@ -1132,14 +1132,10 @@ StaticSpellingKind PatternBindingDecl::getCorrectStaticSpelling() const {
1132
1132
bool PatternBindingDecl::hasStorage () const {
1133
1133
// Walk the pattern, to check to see if any of the VarDecls included in it
1134
1134
// have storage.
1135
- bool HasStorage = false ;
1136
1135
for (auto entry : getPatternList ())
1137
- entry.getPattern ()->forEachVariable ([&](VarDecl *VD) {
1138
- if (VD->hasStorage ())
1139
- HasStorage = true ;
1140
- });
1141
-
1142
- return HasStorage;
1136
+ if (entry.getPattern ()->hasStorage ())
1137
+ return true ;
1138
+ return false ;
1143
1139
}
1144
1140
1145
1141
void PatternBindingDecl::setPattern (unsigned i, Pattern *P) {
Original file line number Diff line number Diff line change @@ -237,6 +237,16 @@ void Pattern::forEachNode(const std::function<void(Pattern*)> &f) {
237
237
}
238
238
}
239
239
240
+ bool Pattern::hasStorage () const {
241
+ bool HasStorage = false ;
242
+ forEachVariable ([&](VarDecl *VD) {
243
+ if (VD->hasStorage ())
244
+ HasStorage = true ;
245
+ });
246
+
247
+ return HasStorage;
248
+ }
249
+
240
250
// / Return true if this is a non-resolved ExprPattern which is syntactically
241
251
// / irrefutable.
242
252
static bool isIrrefutableExprPattern (const ExprPattern *EP) {
Original file line number Diff line number Diff line change @@ -2866,7 +2866,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
2866
2866
// default-initializable. If so, do it.
2867
2867
if (PBD->getPattern (i)->hasType () &&
2868
2868
!PBD->getInit (i) &&
2869
- PBD->hasStorage () &&
2869
+ PBD->getPattern (i)-> hasStorage () &&
2870
2870
!PBD->getPattern (i)->getType ()->is <ErrorType>()) {
2871
2871
2872
2872
// If we have a type-adjusting attribute (like ownership), apply it now.
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ class SwiftGizmo : A {
50
50
@NSManaged func mutableArrayValueForB( ) { } // expected-error {{NSManaged method cannot have a body; it must be provided at runtime}}
51
51
@NSManaged class func mutableArrayValueForA( ) { } // expected-error {{@NSManaged only allowed on an instance property or method}}
52
52
53
+ // SR-1050: don't assert
54
+ @NSManaged var multiA , multiB , multiC : NSNumber ?
55
+
53
56
override init ( ) { }
54
57
}
55
58
You can’t perform that action at this time.
0 commit comments