Skip to content

Commit dc7aef7

Browse files
committed
NCGenerics: avoid UGT's in queries
An unbound generic type is not something that should end up in `isNoncopyable` or `isEscapable` queries because there are no conformances for such a type; it's unbound! fixes test/Constraints/closures.swift
1 parent 740b200 commit dc7aef7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/AST/ConformanceLookup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@ static bool conformsToInvertible(CanType type, InvertibleProtocolKind ip) {
831831
// Must not have a type parameter!
832832
assert(!type->hasTypeParameter() && "caller forgot to mapTypeIntoContext!");
833833

834+
assert(!type->hasUnboundGenericType() && "a UGT has no conformances!");
835+
834836
assert(!type->is<PackExpansionType>());
835837

836838
// The SIL types in the AST do not have real conformances, and should have

lib/Sema/TypeCheckDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2564,7 +2564,8 @@ static Type validateParameterType(ParamDecl *decl) {
25642564
}
25652565

25662566
// Validate the presence of ownership for a parameter with an inverse applied.
2567-
if (diagnoseMissingOwnership(ctx, dc, ownership,
2567+
if (!Ty->hasUnboundGenericType() &&
2568+
diagnoseMissingOwnership(ctx, dc, ownership,
25682569
decl->getTypeRepr(), Ty, options)) {
25692570
decl->setInvalid();
25702571
return ErrorType::get(ctx);

0 commit comments

Comments
 (0)