Files
swift-mirror/test/SILOptimizer/definite_init_nsmanagedvalue.swift
Michael Gottesman 79e07c7db2 [di] DI assumes that all structs it analyzes will have /1/ property... this is not always true =><=.
The culprit here is NSManagedObject subclasses that only have @NSManaged
attributes.

This doesn't affect predictable mem opts since this issue is in the
DIMemoryUseCollector that only affects DI and that I have removed.

rdar://34589327
2017-10-10 13:58:34 -07:00

30 lines
676 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/../ClangImporter/Inputs/custom-modules %s -emit-sil -enable-sil-ownership
// REQUIRES: objc_interop
// Make sure if we have an NSManagedObject without stored properties that DI
// does not crash or emit an error.
import Foundation
import CoreData
class Person : NSManagedObject {
enum MyError : Error {
case error
}
static func myThrow() throws {}
static func myBool() -> Bool { return false }
public required init(_ x: Int) throws {
if Person.myBool() {
throw MyError.error
}
super.init()
try Person.myThrow()
}
}
extension Person {
@NSManaged var name: String
}