Fix AbstractionPattern::isNoncopyable to handle archetypes.

This fixes TypeLowering for ~Copyable generics, such as:

struct S<T: ~Copyable>: ~Copyable {
  var x: T
}

extension S: Copyable where T: Copyable  {}

func foo<T>(s: S<T>) -> ()

Previously, TypeLowering would ignore the implicit Copyable
requirement on the archetype 'T'.
This commit is contained in:
Andrew Trick
2024-04-07 20:31:55 -07:00
parent 8981f2dcc1
commit 22646bd07c

View File

@@ -290,7 +290,7 @@ bool AbstractionPattern::isNoncopyable(CanType substTy) const {
auto isDefinitelyCopyable = [&](CanType t) -> bool { auto isDefinitelyCopyable = [&](CanType t) -> bool {
auto result = copyable->getParentModule() auto result = copyable->getParentModule()
->checkConformanceWithoutContext(substTy, copyable, ->checkConformanceWithoutContext(t, copyable,
/*allowMissing=*/false); /*allowMissing=*/false);
return result.has_value() && !result.value().isInvalid(); return result.has_value() && !result.value().isInvalid();
}; };