mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
- replaces "move-only" terminology with "noncopyable" - replaces compiler jargon like "guaranteed parameters" and "lvalue" with corresponding language-level notions - simplifies diagnostics about closures. and probably more. rdar://109281444
30 lines
585 B
Swift
30 lines
585 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// This test validates that move only enums cannot be marked indirect or have
|
|
// indirect cases.
|
|
|
|
@_moveOnly
|
|
struct S {
|
|
var i = 5
|
|
}
|
|
|
|
@_moveOnly enum E { }
|
|
|
|
@_moveOnly
|
|
enum E1 {
|
|
case first
|
|
case second(S)
|
|
}
|
|
|
|
@_moveOnly
|
|
indirect enum E2 { // expected-error {{noncopyable enum 'E2' cannot be marked indirect or have indirect cases yet}}
|
|
case first
|
|
case second(S)
|
|
}
|
|
|
|
@_moveOnly
|
|
enum E3 {
|
|
case first
|
|
indirect case second(S) // expected-error {{noncopyable enum 'E3' cannot be marked indirect or have indirect cases yet}}
|
|
}
|