Files
swift-mirror/test/Sema/moveonly_decl_attr.swift
Kavon Farvardin 31aa2f77e3 polish noncopyable types diagnostic wordings
- 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
2023-05-24 20:56:36 -07:00

27 lines
1.0 KiB
Swift

// RUN: %target-typecheck-verify-swift -parse-stdlib -disable-availability-checking
import Swift
@_moveOnly class C { // expected-error {{'@_moveOnly' attribute is only valid on structs or enums}}{{1-12=}}
@_moveOnly // expected-error {{'@_moveOnly' attribute cannot be applied to this declaration}}
func foo() {}
}
@_moveOnly
struct S {
@_moveOnly // expected-error {{'@_moveOnly' attribute cannot be applied to this declaration}}
func foo() {}
}
@_moveOnly
enum E {
@_moveOnly // expected-error {{'@_moveOnly' attribute cannot be applied to this declaration}}
func foo() {}
}
@_moveOnly let l = C() // expected-error {{'@_moveOnly' attribute cannot be applied to this declaration}}
@_moveOnly protocol P {} // expected-error {{'@_moveOnly' attribute is only valid on structs or enums}}{{1-12=}}
@_moveOnly actor A {} // expected-error {{'@_moveOnly' attribute is only valid on structs or enums}}{{1-12=}}
@_moveOnly extension C {} // expected-error {{'@_moveOnly' attribute cannot be applied to this declaration}}{{1-12=}}