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
swift-ci opened this issue
Jun 21, 2016
· 5 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
letc0 : (Int, Int) -> Void = { (x) -> Voidinprint(x.0, x.1) }
letc1 : (Int, Int) -> Void = { (x: (Int, Int)) -> Voidinprint(x.0, x.1) }
letc2 = { (x: (Int, Int)) -> Voidinprint(x.0, x.1) }
c0(1, 2)
c1(1, 2)
c2((1, 2)) // <-- NOTE: Only compiles with extra parens.// Also note that c1 and c2 are identical except that c1 has its type given// explicitly while c2 lets the type checker infer it.// And look at this:print(c1.dynamicType) // Prints ((Int, Int)) -> ()print(c2.dynamicType) // Prints ((Int, Int)) -> ()// And this:print(c1.dynamicType == c2.dynamicType) // Prints true
typealias BinaryIntOp_v1 = (Int, Int) -> Int
typealias BinaryIntOp_v2 = ((Int, Int)) -> Int
print(BinaryIntOp_v2.self) // Prints ((Int, Int)) -> Int
print(BinaryIntOp_v2.self) // Prints ((Int, Int)) -> Int
let areRepresentingTheSameType = BinaryIntOp_v1.self == BinaryIntOp_v2.self // (alt-click the "==" and read doc.)
print(areRepresentingTheSameType) // Prints true
let add_v1: BinaryIntOp_v1 = (+)
let add_v2: BinaryIntOp_v2 = (+) // Or both could have been eg: { return $0 + $1 }
let ra = add_v1(1, 2)
let rb = add_v2((1, 2)) // NOTE: Needs these extra parens (otherwise error: "Extra argument in call")
let rc = (add_v1 as BinaryIntOp_v2)((1, 2)) // NOTE: I am type casting these to an identical type ...
let rd = (add_v2 as BinaryIntOp_v1)(1, 2) // ... in order to swap which one of them need extra parens ...
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
Environment
IBM Swift Sandbox
Swift Ver. 3.0 (Jun 6, 2016)
Target: x86_64-ubuntu-linux-gnu
Additional Detail from JIRA
md5: ceeff5fc884b27df509c065f88320a3b
relates to:
Issue Description:
This code crashes the compiler, as I understand from the output:
The text was updated successfully, but these errors were encountered: