<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> foo () -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Bool</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span></div><div style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Double</span><span style="font-variant-ligatures: no-common-ligatures" class="">((</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">pt</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">x</span><span style="font-variant-ligatures: no-common-ligatures" class=""> - </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">p0</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">x</span><span style="font-variant-ligatures: no-common-ligatures" class="">) * (</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">p1</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">y</span><span style="font-variant-ligatures: no-common-ligatures" class=""> - </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">p0</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">y</span><span style="font-variant-ligatures: no-common-ligatures" class="">) - (</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">pt</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">y</span><span style="font-variant-ligatures: no-common-ligatures" class=""> - </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">p0</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">y</span><span style="font-variant-ligatures: no-common-ligatures" class="">) * (</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">p1</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">x</span><span style="font-variant-ligatures: no-common-ligatures" class=""> - </span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">p0</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">x</span><span style="font-variant-ligatures: no-common-ligatures" class="">)) < </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0.0</span></div><div style="margin: 0px; font-size: 16px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">See if that works and then file a bug report?</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">-- E</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 16, 2016, at 2:59 PM, Dave Reed via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">Joe, <br class=""><br class="">I had an expression that worked fine with Swift2.2 but Swift3 (Xcode 8 version) complains it's too complex:<br class=""><br class="">The variables are of type CGPoint and the function returns a Bool.<br class=""><br class=""> return (pt.x - p0.x) * (p1.y - p0.y) - (pt.y - p0.y) * (p1.x - p0.x) < 0.0<br class=""><br class="">Thanks,<br class="">Dave<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 6, 2016, at 6:15 PM, Joe Groff via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 6, 2016, at 3:13 PM, Saagar Jha <<a href="mailto:saagarjha28@gmail.com" class="">saagarjha28@gmail.com</a>> wrote:<br class=""><br class="">I’ve seen that this tends to happen with operators that are really overloaded-stuff like +, *, etc. The compiler seems to take longer to figure out which function to use.<br class=""></blockquote><br class="">Yeah. The type checker has gotten better about making these situations with lots of overload operators tractable in common cases. Over the remaining course of Swift 3, we're also looking to rearchitect the standard library so that there are fewer generic global operator overloads, moving the polymorphism into protocol methods instead, which should further reduce the burden on the type checker.<br class=""><br class="">-Joe<br class=""><br class=""><blockquote type="cite" class="">On Mon, Jun 6, 2016 at 3:09 PM Joe Groff via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">On Jun 6, 2016, at 3:06 PM, G B via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:<br class=""><br class="">Is progress being made on the type checker to get the compiler to stop whinging about the complexity of expressions?<br class=""></blockquote><br class="">Yes, a lot of cases work much better in Swift 3. You might give these a try in a nightly build. Please file a bug if you continue to see this in Swift 3 though.<br class=""><br class="">-Joe<br class=""><br class=""><blockquote type="cite" class=""><br class="">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:<br class="">let v=T.Vector4Type([axis[0]*s, axis[1]*s, axis[2]*s, cos(a/2.0)])<br class=""><br class=""><br class="">Interestingly, this line compiled fine (everything is the same except the last list element is moved to the front):<br class="">let v=T.Vector4Type([cos(a/2.0), axis[0]*s, axis[1]*s, axis[2]*s])<br class=""><br class=""><br class=""><br class="">The initializer that this code is embedded in is this:<br class="">public init(axis:T.Vector3Type, angle a:T){<br class=""> let s=sin(a/2.0)<br class=""> let v=T.Vector4Type([axis[0]*s, axis[1]*s, axis[2]*s, cos(a/2.0)])<br class=""> let l=v.length()<br class=""> self.init(v/l)<br class="">}<br class=""><br class="">I’m running this in a playground, I don’t know if that makes a difference.<br class=""><br class="">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.<br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></blockquote><br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class="">-- <br class="">-Saagar Jha<br class=""></blockquote><br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></blockquote><br class="">_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></div></blockquote></div><br class=""></body></html>