mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SE-390 concluded with choosing the keyword discard rather than forget for the statement that disables the deinit of a noncopyable type. This commit adds parsing support for `discard self` and adds a deprecation warning for `_forget self`. rdar://108859077
16 lines
277 B
Swift
16 lines
277 B
Swift
// RUN: %target-swift-frontend -print-ast %s 2>&1 | %FileCheck %s
|
|
|
|
@_moveOnly
|
|
struct S {
|
|
__consuming func c() {
|
|
discard self
|
|
}
|
|
|
|
deinit {}
|
|
}
|
|
|
|
// CHECK: @_moveOnly internal struct S {
|
|
// CHECK: internal __consuming func c() {
|
|
// CHECK: discard self
|
|
// CHECK: }
|