Files
swift-mirror/test/decl/var/NSManaged_properties.swift
Chris Lattner a9e69c0c36 Take a bozooka out to fix <rdar://problem/19932544> refine error for using @autoclosure and @noescape on the same decl
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
2015-02-25 01:19:04 +00:00

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() {}
}