From 22646bd07ca6d9aaabacb10df86aa30964b51b0d Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Sun, 7 Apr 2024 20:31:55 -0700 Subject: [PATCH] Fix AbstractionPattern::isNoncopyable to handle archetypes. This fixes TypeLowering for ~Copyable generics, such as: struct S: ~Copyable { var x: T } extension S: Copyable where T: Copyable {} func foo(s: S) -> () Previously, TypeLowering would ignore the implicit Copyable requirement on the archetype 'T'. --- lib/SIL/IR/AbstractionPattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SIL/IR/AbstractionPattern.cpp b/lib/SIL/IR/AbstractionPattern.cpp index 03f161c3e0a..2a2ad69c3af 100644 --- a/lib/SIL/IR/AbstractionPattern.cpp +++ b/lib/SIL/IR/AbstractionPattern.cpp @@ -290,7 +290,7 @@ bool AbstractionPattern::isNoncopyable(CanType substTy) const { auto isDefinitelyCopyable = [&](CanType t) -> bool { auto result = copyable->getParentModule() - ->checkConformanceWithoutContext(substTy, copyable, + ->checkConformanceWithoutContext(t, copyable, /*allowMissing=*/false); return result.has_value() && !result.value().isInvalid(); };