mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We didn't have a consistent way to utter attributes in diagnostics, sometimes saying the 'foo' attribute is not allowed @foo attribute is not allowed 'foo' is not allowed @foo is not allowed etc. Standardize on the last one, since it is clear (with the @ sign, with no quotes, with no 'attribute' word in the diagnostic) that we're talking about an attribute. Move a bunch of diagnostics inline with this. Swift SVN r25524
32 lines
1003 B
Swift
32 lines
1003 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse %s -verify
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
|
|
@objc class X {
|
|
func foo() -> X { return self }
|
|
}
|
|
|
|
@NSManaged var global: Int // expected-error {{@NSManaged only allowed on a property in a class}}
|
|
|
|
@NSManaged // expected-error {{@NSManaged may only be used on 'var' declarations}}
|
|
func managedFunction() {}
|
|
|
|
class SwiftGizmo : A {
|
|
@NSManaged var a: X
|
|
@NSManaged var b: Int
|
|
@NSManaged let c: Int // expected-error {{@NSManaged not allowed on a 'let' property}}
|
|
|
|
@NSManaged class var d: Int = 4 // expected-error {{@NSManaged only allowed on a property in a class}} \
|
|
// expected-error {{class stored properties not yet supported}}
|
|
|
|
|
|
@NSManaged var e: Int { return 4 } // expected-error {{@NSManaged not allowed on computed properties}}
|
|
|
|
@NSCopying @NSManaged var optionalProperty : NSString? // expected-error {{@NSManaged property cannot also be marked @NSCopying}}
|
|
|
|
override init() {}
|
|
}
|
|
|