Skip to content

Commit 974a1c0

Browse files
Merge pull request #4695 from swiftwasm/release/5.7
[pull] swiftwasm-release/5.7 from release/5.7
2 parents a0bcf6c + 7a41749 commit 974a1c0

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
156156
PrintOptions::FunctionRepresentationMode::Full;
157157
result.AlwaysTryPrintParameterLabels = true;
158158
result.PrintSPIs = printSPIs;
159-
result.DesugarExistentialConstraint = true;
160159

161160
// We should print __consuming, __owned, etc for the module interface file.
162161
result.SkipUnderscoredKeywords = false;

lib/AST/ExistentialGeneralization.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ class Generalizer : public CanTypeVisitor<Generalizer, Type> {
267267
ExistentialTypeGeneralization
268268
ExistentialTypeGeneralization::get(Type rawType) {
269269
assert(rawType->isAnyExistentialType());
270-
assert(!rawType->hasTypeParameter());
271270

272271
// Canonicalize. We need to generalize the canonical shape of the
273272
// type or else generalization parameters won't match up.
273+
//
274+
// TODO: in full generality, do we need to do *contextual*
275+
// canonicalization in order to avoid introducing non-canonical
276+
// parameters? (That is, do we need a contextual generic
277+
// signature if given an interface type?)
274278
CanType type = rawType->getCanonicalType();
275279

276280
Generalizer generalizer(type->getASTContext());

test/Interpreter/parameterized_existentials.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,14 @@ ParameterizedProtocolsTestSuite.test("casting") {
4444
expectEqual(a.value, b.value)
4545
}
4646

47+
// rdar://96571508
48+
struct ErasingHolder<T> {
49+
let box: any Holder<T>
50+
}
51+
ParameterizedProtocolsTestSuite.test("casting") {
52+
let a = ErasingHolder(box: IntHolder(value: 5))
53+
expectEqual(a.box.value, 5)
54+
}
55+
4756
runAllTests()
4857

test/ModuleInterface/existential-any.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@ public protocol ProtocolTypealias {
4444
typealias A = P
4545
}
4646

47-
// CHECK: public func dependentExistential<T>(value: (T) -> main.P) where T : main.ProtocolTypealias
47+
// CHECK: public func dependentExistential<T>(value: (T) -> T.A) where T : main.ProtocolTypealias
4848
public func dependentExistential<T: ProtocolTypealias>(value: (T) -> T.A) {}
49+
50+
public typealias Composition = ProtocolTypealias & P
51+
52+
// CHECK: public func optionalComposition(value: main.Composition?)
53+
public func optionalComposition(value: Composition?) {}

0 commit comments

Comments
 (0)