Files
swift-mirror/test/Interpreter/SDK/objc_ns_enum.swift
Joe Groff 90651fcdd6 Clang importer: Preserve unknown NS_ENUM values through raw value conversions.
We can't reliably reject raw values in an NS_ENUM's init(rawValue:), because the enum may have SPI or future values we don't statically know about. Fixes https://twitter.com/autorelease/status/524698585406124033

Swift SVN r23817
2014-12-09 23:33:42 +00:00

24 lines
587 B
Swift

// RUN: %target-run-simple-swift
// NSButtonType (from AppKit) and UIViewAnimationCurve (from UIKit) both have
// private enumerators, so we preserve their values through raw value
// conversion operations.
// (Really we do this for all NS_ENUMs, though we reserve the right to do
// strict checking if we get a guarantee that certain types don't have
// hidden or future enumeration values.)
#if os(OSX)
import AppKit
println(NSButtonType(rawValue: 20721)!.rawValue)
#endif
#if os(iOS)
import UIKit
println(UIViewAnimationCurve(rawValue: 20721)!.rawValue)
#endif
// CHECK: 20721