// RUN: rm -rf %t/clang-module-cache
// RUN: %swift -module-cache-path %t/clang-module-cache %clang-importer-sdk -parse %s -verify

import Foundation

@objc class X {
  func foo() -> X { return self }
}

@NSManaged var global: Int // expected-error {{'NSManaged' attribute 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' attribute not allowed on a 'let' property}}

  @NSManaged class var d: Int = 4  // expected-error {{'NSManaged' attribute only allowed on a property in a class}} \
            // expected-error {{class variables 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() {}
}


// RUN: rm -rf %t/clang-module-cache
// RUN: %swift -module-cache-path %t/clang-module-cache -target x86_64-apple-macosx10.9 -sdk %S/../../SILGen/Inputs %s -I %S/../../SILGen/Inputs -enable-source-import -parse -verify

import Foundation
import gizmo

@objc class X {
  func foo() -> X { return self }
}

@NSManaged var global: Int // expected-error {{'NSManaged' attribute only allowed on a property in a class}}

@NSManaged     // expected-error {{'NSManaged' may only be used on 'var' declarations}}
func managedFunction() {}

class SwiftGizmo : Gizmo {
  @NSManaged var a: X
  @NSManaged var b: Int
  @NSManaged let c: Int  // expected-error {{'NSManaged' attribute not allowed on a 'let' property}}

  @NSManaged class var d: Int = 4  // expected-error {{'NSManaged' attribute only allowed on a property in a class}} \
            // expected-error {{class variables 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() {}
}


--- 
+++ 
@@ -1,8 +1,7 @@
 // RUN: rm -rf %t/clang-module-cache
-// RUN: %swift -module-cache-path %t/clang-module-cache -target x86_64-apple-macosx10.9 -sdk %S/../../SILGen/Inputs %s -I %S/../../SILGen/Inputs -enable-source-import -parse -verify
+// RUN: %swift -module-cache-path %t/clang-module-cache %clang-importer-sdk -parse %s -verify
 
 import Foundation
-import gizmo
 
 @objc class X {
   func foo() -> X { return self }
@@ -13,7 +12,7 @@
 @NSManaged     // expected-error {{'NSManaged' may only be used on 'var' declarations}}
 func managedFunction() {}
 
-class SwiftGizmo : Gizmo {
+class SwiftGizmo : A {
   @NSManaged var a: X
   @NSManaged var b: Int
   @NSManaged let c: Int  // expected-error {{'NSManaged' attribute not allowed on a 'let' property}}
[test] Rewrite @NSManaged test to use the regular mock SDK instead of SILGen's.

Swift SVN r23669
