[swift-users] expression too complex
G B
g.c.b.at.work at gmail.com
Mon Jun 6 17:06:24 CDT 2016
Is progress being made on the type checker to get the compiler to stop whinging about the complexity of expressions?
I can’t really trim down the full project to isolate a good test case, but I’m getting a compiler error on this line of code:
let v=T.Vector4Type([axis[0]*s, axis[1]*s, axis[2]*s, cos(a/2.0)])
Interestingly, this line compiled fine (everything is the same except the last list element is moved to the front):
let v=T.Vector4Type([cos(a/2.0), axis[0]*s, axis[1]*s, axis[2]*s])
The initializer that this code is embedded in is this:
public init(axis:T.Vector3Type, angle a:T){
let s=sin(a/2.0)
let v=T.Vector4Type([axis[0]*s, axis[1]*s, axis[2]*s, cos(a/2.0)])
let l=v.length()
self.init(v/l)
}
I’m running this in a playground, I don’t know if that makes a difference.
I’m willing to wait a little longer for the complier to do its job if it means I don’t have to break my code down to one operation per line.
More information about the swift-users
mailing list