mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
One can still in resilient frameworks have noncopyable frozen types. This means that one cannot make a noncopyable: 1. Full resilient public type. 2. @usableFromInline type. NOTE: One can still use a frozen noncopyable type as a usableFromInline class field. I validated in the attached tests that we get the correct code generation. I also eliminated a small bug in TypeCheckDeclPrimary where we weren't using a requestified attr check and instead were checking directly. rdar://111125845
29 lines
1.4 KiB
Swift
29 lines
1.4 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -verify -enable-experimental-feature MoveOnlyResilientTypes
|
|
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t -enable-experimental-feature MoveOnlyResilientTypes
|
|
// RUN: %FileCheck %s < %t/Library.swiftinterface
|
|
|
|
// This test makes sure that discard and _forget are emitted correctly in the
|
|
// interfaces. We expect that if you use the old name _forget, you'll get that
|
|
// in the interface file.
|
|
|
|
// CHECK: @_alwaysEmitIntoClient public consuming func AEIC_discard() { discard self }
|
|
// CHECK: @inlinable public consuming func inlinable_discard() { discard self }
|
|
|
|
// CHECK: @_alwaysEmitIntoClient public consuming func AEIC_forget() { _forget self }
|
|
// CHECK: @inlinable public consuming func inlinable_forget() { _forget self }
|
|
|
|
public struct MoveOnlyStruct: ~Copyable {
|
|
let x = 0
|
|
|
|
@_alwaysEmitIntoClient public consuming func AEIC_discard() { discard self }
|
|
@inlinable public consuming func inlinable_discard() { discard self }
|
|
|
|
@_alwaysEmitIntoClient public consuming func AEIC_forget() { _forget self }
|
|
// expected-warning@-1 {{'_forget' keyword is deprecated and will be removed soon; use 'discard' instead}}
|
|
@inlinable public consuming func inlinable_forget() { _forget self }
|
|
// expected-warning@-1 {{'_forget' keyword is deprecated and will be removed soon; use 'discard' instead}}
|
|
|
|
deinit {}
|
|
}
|