|
|
|
|
|
by floxy
739 days ago
|
|
I found an online Swift Playground, and here is a smaller test case that produces the "unable to type-check this expression in reasonable time" message: print("a" + "b" + "c" + 11 + "d")
...if you reduce it even further to: print("a" + "b" + "c" + 11)
...the error message is: <stdin>:3:23: error: binary operator '+' cannot be applied to operands of type 'String' and 'Int'
print("a" + "b" + "c" + 11)
~~~~~~~~~~~~~~~ ^ ~~
<stdin>:3:23: note: overloads for '+' exist with these partially matching parameter lists: (Int, Int), (String, String)
...it still falls down on with the "reasonable time" error on this tiny example, even if you fully specify the types: let a:String = "a"
let b:String = "b"
let c:String = "c"
let d:String = "d"
let e:String = "e"
let n:Int = 11
print(a + b + c + n + d + e)
...is that pointing to a problem with type-checking or overload resolution more than type inference? Is there a way in Swift to annotate the types of sub-expressions in-line, so you could try something like: print((a + b + c):String + n + d + e)
|
|