You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Curried function syntax was removed in Swift 3, and Swift 4 carries the tech debt from them for migration purposes. Now that Swift 4 has branched, we can remove the AST representation and simply parse and reject them in the parser. We still have curried functions, because methods carry a curried self parameter, but we now know we have either 1 or 2 parameter lists, not an unbounded number. Be aware that deinit's are a special case because they just have a self parameter, not a self param + a normal param list.
Simplify everything that passes these down to AFD, and simplify the clients.
The existing getParameterLists() function should remain, but it makes sense to add a new "getSelfParameterList()" and "getNormalParameterList()" method to simplify clients that only care about one or the other.
The text was updated successfully, but these errors were encountered:
If this is still up to grab, I can try a run for it.
Only twi things, what is the parameter to pass to the --filter for running only the tests for the AST and the ninja command to rebuild it without full one? I still can't grasp how to find them 🙂
I took a slighly different approach than the one outlined in this bug:
There's no ParameterList for self. Self is enough of a special case that it's not useful to build a single-element ParameterList for it. Instead, the AbstractFunctionDecl constructor takes a ParamDecl for self and a ParameterList for the normal parameters.
getParameterLists() is gone, because again, all clients that look at parameter lists were giving 'self' special treatment anyway.
I'm not storing the parameter array itself inline. Getting the parameter list of a function still requires dereferencing a pointer. In the future we might want to investigate storing the parameter array inline, but right now there are enough places that want to treat a ParameterList as a first-class entity that it would be difficult to do this.
Additional Detail from JIRA
md5: 3408999bc5c0a3bd8274b1aacdd5e271
Issue Description:
Curried function syntax was removed in Swift 3, and Swift 4 carries the tech debt from them for migration purposes. Now that Swift 4 has branched, we can remove the AST representation and simply parse and reject them in the parser. We still have curried functions, because methods carry a curried self parameter, but we now know we have either 1 or 2 parameter lists, not an unbounded number. Be aware that deinit's are a special case because they just have a self parameter, not a self param + a normal param list.
Specifically, this stuff should be simplified:
remove "NumParameterLists". We can determine whether there is one or two https://github.com/apple/swift/blob/master/include/swift/AST/Decl.h#L364
AbstractFunctionDecl should take a two parameter list instead of an array of them, and store them inline instead of a separate allocation:
https://github.com/apple/swift/blob/master/include/swift/AST/Decl.h#L4846
Simplify everything that passes these down to AFD, and simplify the clients.
The existing getParameterLists() function should remain, but it makes sense to add a new "getSelfParameterList()" and "getNormalParameterList()" method to simplify clients that only care about one or the other.
The text was updated successfully, but these errors were encountered: