Wednesday, 15 May 2013

Swift - not able to compile with instance checking -



Swift - not able to compile with instance checking -

i want inspect if object optional string type @ runtime. why next not compile in command line project?

var p:string? if p string { println("p string") } else { println("p not string") }

build error:

bitcast requires both operands pointer or neither %81 = bitcast i8* %80 %ss, !dbg !131 invalid operand types icmp instruction %82 = icmp ne %ss %81, null, !dbg !131 phi nodes must have @ to the lowest degree 1 entry. if block dead, phi should removed! %85 = phi i64 phi node operands not same type result! %84 = phi i8* [ %81, %73 ] llvm error: broken function found, compilation aborted! command /applications/xcode6-beta2.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/swift failed exit code 1

you first have assign value it. this:

var p : any? p = "string" if p string { println("p string") } else { println("p else") }

swift

No comments:

Post a Comment