Skip to content

Commit 70266b5

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 f0b4f4a commit 70266b5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/AST/ConformanceLookup.cpp

+2
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

+2-1
Original file line numberDiff line numberDiff line change
@@ -2558,7 +2558,8 @@ static Type validateParameterType(ParamDecl *decl) {
25582558
}
25592559

25602560
// Validate the presence of ownership for a parameter with an inverse applied.
2561-
if (diagnoseMissingOwnership(ctx, dc, ownership,
2561+
if (!Ty->hasUnboundGenericType() &&
2562+
diagnoseMissingOwnership(ctx, dc, ownership,
25622563
decl->getTypeRepr(), Ty, options)) {
25632564
decl->setInvalid();
25642565
return ErrorType::get(ctx);

0 commit comments

Comments
 (0)