Skip to content

Commit acc90b1

Browse files
committed
[NameLookup] Opaque Type Collector should skip existential types
1 parent b3f3b80 commit acc90b1

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/AST/NameLookup.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,11 +2847,7 @@ CollectedOpaqueReprs swift::collectOpaqueReturnTypeReprs(TypeRepr *r, ASTContext
28472847
return Action::Continue();
28482848

28492849
if (auto existential = dyn_cast<ExistentialTypeRepr>(repr)) {
2850-
auto meta = dyn_cast<MetatypeTypeRepr>(existential->getConstraint());
2851-
auto generic = dyn_cast<GenericIdentTypeRepr>(existential->getConstraint());
2852-
if(generic)
2853-
Reprs.push_back(existential);
2854-
return Action::VisitChildrenIf(meta || generic);
2850+
return Action::SkipChildren();
28552851
} else if (auto compositionRepr = dyn_cast<CompositionTypeRepr>(repr)) {
28562852
if (!compositionRepr->isTypeReprAny())
28572853
Reprs.push_back(compositionRepr);

lib/Sema/TypeCheckPattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ validateTypedPattern(TypedPattern *TP, DeclContext *dc,
732732
auto *Repr = TP->getTypeRepr();
733733
if (Repr && (Repr->hasOpaque() ||
734734
(Context.LangOpts.hasFeature(Feature::ImplicitSome) &&
735-
Repr->isProtocol(dc)))) {
735+
!collectOpaqueReturnTypeReprs(Repr, Context, dc).empty()))) {
736736
auto named = dyn_cast<NamedPattern>(
737737
TP->getSubPattern()->getSemanticsProvidingPattern());
738738
if (!named) {

0 commit comments

Comments
 (0)