Commits

Chris Lattner committed 7daaa22d936
Completely reimplement/redesign the AST representation of parameters. Parameters (to methods, initializers, accessors, subscripts, etc) have always been represented as Pattern's (of a particular sort), stemming from an early design direction that was abandoned. Being built on top of patterns leads to patterns being overly complicated (e.g. tuple patterns have to have varargs and default parameters) and make working on parameter lists complicated and error prone. This might have been ok in 2015, but there is no way we can live like this in 2016. Instead of using Patterns, carve out a new ParameterList and Parameter type to represent all the parameter specific stuff. This simplifies many things and allows a lot of simplifications. Unfortunately, I wasn't able to do this very incrementally, so this is a huge patch. The good news is that it erases a ton of code, and the technical debt that went with it. Ignoring test suite changes, we have: 77 files changed, 2359 insertions(+), 3221 deletions(-) This patch also makes a bunch of wierd things dead, but I'll sweep those out in follow-on patches. Fixes <rdar://problem/22846558> No code completions in Foo( when Foo has error type Fixes <rdar://problem/24026538> Slight regression in generated header, which I filed to go with 3a23d75. Fixes an overloading bug involving default arguments and curried functions (see the diff to Constraints/diagnostics.swift, which we now correctly accept). Fixes cases where problems with parameters would get emitted multiple times, e.g. in the test/Parse/subscripting.swift testcase. The source range for ParamDecl now includes its type, which permutes some of the IDE / SourceModel tests (for the better, I think). Eliminates the bogus "type annotation missing in pattern" error message when a type isn't specified for a parameter (see test/decl/func/functions.swift). This now consistently parenthesizes argument lists in function types, which leads to many diffs in the SILGen tests among others. This does break the "sibling indentation" test in SourceKit/CodeFormat/indent-sibling.swift, and I haven't been able to figure it out. Given that this is experimental functionality anyway, I'm just XFAILing the test for now. i'll look at it separately from this mongo diff.