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 @@ -166,6 +166,9 @@ class alignas(8) Pattern {
166
166
});
167
167
}
168
168
169
+ // / Does this binding declare something that requires storage?
170
+ bool hasStorage () const ;
171
+
169
172
static bool classof (const Pattern *P) { return true ; }
170
173
171
174
// *** Allocation Routines ************************************************/
Original file line number Diff line number Diff line change @@ -991,14 +991,10 @@ StaticSpellingKind PatternBindingDecl::getCorrectStaticSpelling() const {
991
991
bool PatternBindingDecl::hasStorage () const {
992
992
// Walk the pattern, to check to see if any of the VarDecls included in it
993
993
// have storage.
994
- bool HasStorage = false ;
995
994
for (auto entry : getPatternList ())
996
- entry.getPattern ()->forEachVariable ([&](VarDecl *VD) {
997
- if (VD->hasStorage ())
998
- HasStorage = true ;
999
- });
1000
-
1001
- return HasStorage;
995
+ if (entry.getPattern ()->hasStorage ())
996
+ return true ;
997
+ return false ;
1002
998
}
1003
999
1004
1000
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 @@ -3245,7 +3245,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
3245
3245
// default-initializable. If so, do it.
3246
3246
if (PBD->getPattern (i)->hasType () &&
3247
3247
!PBD->getInit (i) &&
3248
- PBD->hasStorage () &&
3248
+ PBD->getPattern (i)-> hasStorage () &&
3249
3249
!PBD->getPattern (i)->getType ()->is <ErrorType>()) {
3250
3250
3251
3251
// If we have a type-adjusting attribute (like ownership), apply it now.
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ class SwiftGizmo : A {
48
48
@NSManaged func mutableArrayValueForB( ) { } // expected-error {{NSManaged method cannot have a body; it must be provided at runtime}}
49
49
@NSManaged class func mutableArrayValueForA( ) { } // expected-error {{@NSManaged only allowed on an instance property or method}}
50
50
51
+ // SR-1050: don't assert
52
+ @NSManaged var multiA , multiB , multiC : NSNumber ?
53
+
51
54
override init ( ) { }
52
55
}
53
56
You can’t perform that action at this time.
0 commit comments