Skip to content

Commit bee86ea

Browse files
committed
Had wrongly disregarded generic conformers in my original fix for sr-6097.
This commit extends that fix.
1 parent 48c5786 commit bee86ea

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3990,10 +3990,10 @@ static Type getWitnessTypeForMatching(TypeChecker &tc,
39903990
// Retrieve the set of substitutions to be applied to the witness.
39913991
Type model = conformance->getType();
39923992
TypeSubstitutionMap substitutions = model->getMemberSubstitutions(witness);
3993+
Type type = witness->getInterfaceType()->getReferenceStorageReferent();
3994+
39933995
if (substitutions.empty())
3994-
return witness->getInterfaceType()->getReferenceStorageReferent();
3995-
3996-
Type type = witness->getInterfaceType();
3996+
return type;
39973997

39983998
// Strip off the requirements of a generic function type.
39993999
// FIXME: This doesn't actually break recursion when substitution

test/Generics/associated_types.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,8 @@ class C3 : sr6097_b {
220220
weak var aProperty: C1? // and same here, despite 'weak'
221221
init() { fatalError() }
222222
}
223+
class G<T> : sr6097_b where T : AnyObject {
224+
weak var aProperty: T?
225+
}
226+
223227

0 commit comments

Comments
 (0)