You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Foundation
enum JSON {
case object([String: Any])
case array([Any])
case any(Any)
var object: Any {
switch self {
case .object(let any as Any):
return any
case .array(let any as Any):
return any
case .any(let any):
return any
default:
return NSNull()
}
}
var objectWillError: Any {
switch self {
case .object(let any as Any), .array(let any as Any), .any(let any):
return any
default:
return NSNull()
}
}
}
JSON.object(["aaa": 222]).object
JSON.any(10).object
JSON.any(10).objectWillError
//The code below will be error
JSON.object(["aaa": 222]).objectWillError
The text was updated successfully, but these errors were encountered:
Before closing SR-5336 as fixed, noticed this errors and no longer miscompiles in a recent toolchain:
{code:swift-DEVELOPMENT-SNAPSHOT-2017-06-12-a.xctoolchain errors:}
pbpaste | /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2017-06-12-a.xctoolchain/usr/bin/swiftc -sdk $(xcrun --show-sdk-path --sdk macosx) -emit-sil -
<stdin>:32:27: warning: expression of type 'Any' is unused
JSON.object(["aaa": 222]).object
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
<stdin>:33:14: warning: expression of type 'Any' is unused
JSON.any(10).object
~~~~~~~~~~~~^~~~~
<stdin>:35:14: warning: expression of type 'Any' is unused
JSON.any(10).objectWillError
~~~~~~~~~~~~^~~~~~~~~~~~~~
<stdin>:39:27: warning: expression of type 'Any' is unused
JSON.object(["aaa": 222]).objectWillError
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
<stdin>:24:22: error: matching a protocol value in multiple patterns is not yet supported; use separate cases instead
case .object(let any as Any), .array(let any as Any), .any(let any):
^
Environment
OSX 10.11.5 Xcode 8
Additional Detail from JIRA
md5: 10e424072ec1488a0545714cb098b421
Issue Description:
The text was updated successfully, but these errors were encountered: