Files
swift-mirror/test/Interpreter/moveonly_existentials.swift
Nate Chandler e2fcdb4524 [MoveOnlyAddressChecker] Handle init_exi_addr.
It's a pass-through for FSPL's purposes.

rdar://128900124
2024-06-06 19:04:41 -07:00

31 lines
581 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift %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)