File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1528,6 +1528,19 @@ class FixedBoxTypeInfoBase : public BoxTypeInfo {
1528
1528
boxedInterfaceType = boxedType.mapTypeOutOfContext ();
1529
1529
}
1530
1530
1531
+ {
1532
+ // FIXME: This seems wrong. We used to just mangle opened archetypes as
1533
+ // their interface type. Let's make that explicit now.
1534
+ auto astType = boxedInterfaceType.getASTType ();
1535
+ astType = astType.transformRec ([](Type t) -> Optional<Type> {
1536
+ if (auto *openedExistential = t->getAs <OpenedArchetypeType>())
1537
+ return openedExistential->getInterfaceType ();
1538
+ return None;
1539
+ })->getCanonicalType ();
1540
+ boxedInterfaceType = SILType::getPrimitiveType (
1541
+ astType, boxedInterfaceType.getCategory ());
1542
+ }
1543
+
1531
1544
auto boxDescriptor = IGF.IGM .getAddrOfBoxDescriptor (
1532
1545
boxedInterfaceType,
1533
1546
env ? env->getGenericSignature ().getCanonicalSignature ()
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir %s -disable-availability-checking
2
+
3
+ public protocol P { }
4
+
5
+ struct S < T> : P {
6
+ var x : Any
7
+ init ( ) { fatalError ( ) }
8
+ }
9
+
10
+ public func mangleArchetype( _ p: any P ) -> any P {
11
+ p. open
12
+ }
13
+
14
+ extension P {
15
+ var open : some P {
16
+ S < Self > ( )
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments