Skip to content

Commit 08c30a2

Browse files
committed
ParseSIL: handle ReferenceStorageType
It doesn't make sense that we permit a `ReferenceStorageType` to be substituted for a generic parameter, since I don't know whether any valid Swift code would ever actually construct such SIL. But there are some hand-written SIL test cases that do it anyway, for unconstrained generic parameters. Since now even those get protocol requirements with NoncopyableGenerics, just look at the referent type in ParseSIL.
1 parent 5fe149d commit 08c30a2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,7 @@ static bool getConformancesForSubstitution(Parser &P,
17591759
SourceLoc loc,
17601760
SmallVectorImpl<ProtocolConformanceRef> &conformances) {
17611761
auto M = P.SF.getParentModule();
1762+
subReplacement = subReplacement->getReferenceStorageReferent();
17621763

17631764
for (auto protoDecl : protocols) {
17641765
auto conformance = M->lookupConformance(subReplacement, protoDecl);
@@ -1814,6 +1815,7 @@ SubstitutionMap getApplySubstitutionsFromParsed(
18141815
[&](CanType dependentType, Type replacementType,
18151816
ProtocolDecl *proto) -> ProtocolConformanceRef {
18161817
auto M = SP.P.SF.getParentModule();
1818+
replacementType = replacementType->getReferenceStorageReferent();
18171819
if (auto conformance = M->lookupConformance(replacementType, proto))
18181820
return conformance;
18191821

0 commit comments

Comments
 (0)