Skip to content

Commit 06b2f55

Browse files
committed
Hack: Avoid devirtualizing calls to requirements with covariant Self inside collections, since the optimizer doesn't know how to handle them yet
1 parent e49ca21 commit 06b2f55

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/decl/protocol/protocols_with_self_or_assoc_reqs_executable.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ Tests.test("Basic") {
4848
expectEqual(3, collection.count)
4949
}
5050

51-
Tests.test("Covariant 'Self' erasure") {
51+
// FIXME: Teach the devirtualizer how to handle calls to requirements with covariant `Self` nested
52+
// inside known-covariant stdlib types such as an array or dictionary.
53+
@_optimize(none)
54+
func convariantSelfErasureTest() {
5255
struct S: P {
5356
static let str = "Success"
5457
func getString() -> String { Self.str }
@@ -104,4 +107,7 @@ Tests.test("Covariant 'Self' erasure") {
104107
expectEqual(true, S() is P)
105108
}
106109

110+
111+
Tests.test("Covariant 'Self' erasure", convariantSelfErasureTest)
112+
107113
runAllTests()

0 commit comments

Comments
 (0)