<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 24, 2017, at 1:52 AM, Trevör ANNE DENISE 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello everyone, I found this on StackOverflow : <a href="https://stackoverflow.com/questions/46381752/swift-4-methods-chaining/" class="">https://stackoverflow.com/questions/46381752/swift-4-methods-chaining/</a><div class=""><br class=""></div><div class="">Is this a bug of Swift 4 or is this normal ? I don't understand why the problem only happens when methods are chained !</div></div></div></blockquote><div><br class=""></div>It’s a bug.</div><div><br class=""></div><div>The reason you see this when they are chained is because the type checker (in general) often finds multiple potential solutions (meaning a set of types and particular function overloads) and then has to select the “best” solution from those. For example one solution might involve “map” from type A combined with “filter” from type B, and another might involve “map” from type X and “filter” from type Y.</div><div><br class=""></div><div>For the sake of illustration, let’s say it found only those two solutions in your case. Selecting the best solution involves examining the components of the solutions and comparing each component to determine which is best. In your example we may decide A.map is the best map, but Y.filter is the best filter. There is no solution that involves A.map combined with Y.filter, so we consider the solution to be ambiguous.</div><div><br class=""></div><div>The combination of the type checker and standard library design should ensure this never happens, but we have some known bugs we need to work through in order to fix all of these cases.</div><div><br class=""></div><div>Mark</div><div><br class=""></div></body></html>