Files
swift-mirror/test/Interpreter/moveonly_existentials.swift
Kavon Farvardin b604488f1c Demangler: edge case in existential demangling
We now may have constrained existentials that have no primary associated
types, so there won't be any arguments for the parameterized protocol
type. Because the "constrained" part is that there's an inverse.

resolves rdar://128695929
2024-06-14 12:25:39 -07:00

31 lines
583 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -g %s -o %t/bin
// RUN: %target-codesign %t/bin
// RUN: %target-run %t/bin | %FileCheck %s
// REQUIRES: executable_test
protocol Boopable: ~Copyable {
func boop()
mutating func bonk()
}
struct S: ~Copyable, Boopable {
func boop() { print("boop") }
mutating func bonk() { print("hmm") }
}
func borrow(_ b: borrowing any Boopable & ~Copyable) {
b.boop()
}
func mutate(_ b: inout any Boopable & ~Copyable) {
b.bonk()
}
// CHECK: boop
// CHECK: hmm
borrow(S())
var s = S() as any Boopable & ~Copyable
mutate(&s)