Files
swift-mirror/test/SIL/parse_swift_decls_in_sil_mode.sil
Michael Gottesman 40449a6987 [move-only] Emit a clearer message around deinits.
Specifically:

1. Fix the error message so that when we say you can't have a deinit that a
deinit can be on a noncopyable type along side a class or an actor.

2. Even though we already error on @objc enums and say they cannot be
noncopyable, we did not emit an error on the deinit saying that @objc enums
cannot have a deinit. I put in a nice to have error just to make it even
clearer.

rdar://105855978
rdar://106566054
2023-03-12 14:47:34 -07:00

11 lines
374 B
Plaintext

// RUN: %target-typecheck-verify-swift
typealias Int = ()
deinit // expected-error {{deinitializers may only be declared within a class, actor, or noncopyable type}}
subscript (x : Int, y : Int) -> Int { get }// expected-error{{'subscript' functions may only be declared within a type}}
init(i:Int) // expected-error {{initializers may only be declared within a type}}