mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: A couple of recursion-breaking hacks
This commit is contained in:
@@ -1662,9 +1662,13 @@ PotentialArchetype *PotentialArchetype::getNestedArchetypeAnchor(
|
||||
assocType = dyn_cast<AssociatedTypeDecl>(member);
|
||||
|
||||
// FIXME: Filter out type declarations that aren't in the protocol itself?
|
||||
if (!concreteDecl && !isa<AssociatedTypeDecl>(member))
|
||||
if (!concreteDecl && !isa<AssociatedTypeDecl>(member)) {
|
||||
if (!member->hasInterfaceType())
|
||||
builder.getLazyResolver()->resolveDeclSignature(member);
|
||||
if (member->hasInterfaceType())
|
||||
concreteDecl = dyn_cast<TypeDecl>(member);
|
||||
}
|
||||
}
|
||||
|
||||
if (assocType &&
|
||||
(!bestAssocType ||
|
||||
@@ -1781,9 +1785,13 @@ PotentialArchetype *PotentialArchetype::updateNestedTypeForConformance(
|
||||
assocType = dyn_cast<AssociatedTypeDecl>(member);
|
||||
|
||||
// FIXME: Filter out concrete types that aren't in the protocol itself?
|
||||
if (!concreteDecl && !isa<AssociatedTypeDecl>(member))
|
||||
if (!concreteDecl && !isa<AssociatedTypeDecl>(member)) {
|
||||
if (!member->hasInterfaceType())
|
||||
proto->getASTContext().getLazyResolver()->resolveDeclSignature(member);
|
||||
if (member->hasInterfaceType())
|
||||
concreteDecl = dyn_cast<TypeDecl>(member);
|
||||
}
|
||||
}
|
||||
|
||||
// There is no associated type or concrete type with this name in this
|
||||
// protocol
|
||||
|
||||
@@ -599,6 +599,10 @@ ModuleDecl::lookupConformance(Type type, ProtocolDecl *protocol,
|
||||
// existential's list of conformances and the existential conforms to
|
||||
// itself.
|
||||
if (type->isExistentialType()) {
|
||||
// FIXME: Recursion break.
|
||||
if (!protocol->hasValidSignature())
|
||||
return None;
|
||||
|
||||
// If the existential type cannot be represented or the protocol does not
|
||||
// conform to itself, there's no point in looking further.
|
||||
if (!protocol->existentialConformsToSelf() ||
|
||||
|
||||
@@ -4200,7 +4200,13 @@ void ConformanceChecker::resolveTypeWitnesses() {
|
||||
}
|
||||
|
||||
TC.validateDecl(assocType);
|
||||
Type defaultType = assocType->getDefaultDefinitionLoc().getType().subst(
|
||||
Type defaultType = assocType->getDefaultDefinitionLoc().getType();
|
||||
|
||||
// FIXME: Circularity
|
||||
if (!defaultType)
|
||||
return Type();
|
||||
|
||||
defaultType = defaultType.subst(
|
||||
QueryTypeSubstitutionMap{substitutions},
|
||||
LookUpConformanceInModule(DC->getParentModule()));
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
|
||||
// RUN: not --crash %target-swift-frontend %s -emit-ir
|
||||
// RUN: not %target-swift-frontend %s -emit-ir
|
||||
protocol P{{}typealias a:=A.a:struct A:P
|
||||
@@ -5,5 +5,5 @@
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
|
||||
// RUN: not --crash %target-swift-frontend %s -emit-ir
|
||||
// RUN: not %target-swift-frontend %s -emit-ir
|
||||
protocol P}extension P{typealias a:Self.a{}func a:Self.a
|
||||
@@ -6,5 +6,5 @@
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
|
||||
// REQUIRES: asserts
|
||||
// RUN: not --crash %target-swift-frontend %s -emit-ir
|
||||
// RUN: not %target-swift-frontend %s -emit-ir
|
||||
@objc protocol P{typealias e:P{}var a}{}extension P{typealias e:P
|
||||
Reference in New Issue
Block a user