Skip to content

Commit e7098a3

Browse files
committed
[Sema] Remove isInvalid checks from checkAndContextualizePatternBindingInit
The invalid bit on PatternBindingDecl is very coarse grained, it means any of the possible binding entries could be invalid. Contextualization can handle invalid code anyway (e.g this is what we do for `typeCheckBody`), so let's just avoid checking.
1 parent fef7f53 commit e7098a3

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,18 +591,13 @@ static void checkAndContextualizePatternBindingInit(PatternBindingDecl *binding,
591591
unsigned i) {
592592
// Force the entry to be checked.
593593
(void)binding->getCheckedPatternBindingEntry(i);
594-
if (binding->isInvalid())
595-
return;
596594

597595
if (!binding->isInitialized(i))
598596
return;
599597

600598
if (!binding->isInitializerChecked(i))
601599
TypeChecker::typeCheckPatternBinding(binding, i);
602600

603-
if (binding->isInvalid())
604-
return;
605-
606601
// If we entered an initializer context, contextualize any auto-closures we
607602
// might have created. Note that we don't contextualize the initializer for a
608603
// property with a wrapper, because the initializer will have been subsumed by
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// {"kind":"typecheck","signature":"(anonymous namespace)::ActorIsolationChecker::checkLocalCaptures(swift::AnyFunctionRef)","signatureAssert":"Assertion failed: (Captures.hasBeenComputed()), function getCaptureInfo"}
2-
// RUN: not --crash %target-swift-frontend -typecheck %s
2+
// RUN: not %target-swift-frontend -typecheck %s
33
struct a {
44
b : c =, d = {} protocol c

0 commit comments

Comments
 (0)