Files
swift-mirror/test/Interpreter/lifetime_nonmutating_address_only.swift
2022-09-01 06:35:57 +03:00

27 lines
526 B
Swift

// RUN: %target-run-simple-swift | %FileCheck %s
// REQUIRES: executable_test
// https://github.com/apple/swift/issues/51493
// CHECK: A
// CHECK: B
// CHECK: C
protocol SomeProtocol { }
class SomeClass: SomeProtocol { deinit { print("C") } }
struct SomeStruct { var x, y: Int }
extension SomeProtocol {
var someProperty: SomeStruct {
nonmutating set {
print("B")
}
get {
print("A")
return SomeStruct(x: 1, y: 2)
}
}
}
SomeClass().someProperty.x = 32