Commit Graph

16 Commits

Author SHA1 Message Date
Ben Langmuir
19d13c3aee Reapply "[CodeCompletion] Don't show the loop index before it is visible"
With the tests updated to account for not having the correct behaviour
for brace-stmt items from after the code-completion point.  That part
turns out to be harder to fix.

This reverts commit a5325e6281.
2016-03-09 14:02:51 -08:00
Ben Langmuir
739c409140 Revert "[CodeCompletion] Don't show variables defined after the completion loc"
This broke some tests; may need a different approach.

This reverts commit 9734bd94bb.
2016-03-07 22:29:24 -08:00
Ben Langmuir
a5325e6281 Revert "[CodeCompletion] Don't show the loop index before it is visible"
This reverts commit ce77c868d1.
2016-03-07 22:29:00 -08:00
Ben Langmuir
ce77c868d1 [CodeCompletion] Don't show the loop index before it is visible
for i in <here>            // should *not* show 'i'
for i in ...  where <here> // should show 'i'
for i in ... { <here>      // should show 'i'

Part of rdar://problem/24873625
2016-03-07 22:04:49 -08:00
Ben Langmuir
9734bd94bb [CodeCompletion] Don't show variables defined after the completion loc
... in brace statements. Found by inspection.
2016-03-07 22:01:01 -08:00
gregomni
30b67344b2 Improve var decl completion in switch cases
Variables bound in the case item pattern should be available inside the
case body and in the where clause, but not elsewhere within the
statement (e.g. other case items). The added accessor
CaseStmt.getLabelItemsRange() is needed to be able to determine the
difference between a completion location after a colon and one where
the colon doesn’t exist (in both cases this would be in the — implicit
— body statement range).
2016-02-28 22:17:29 -08:00
Chris Lattner
95f07f02b9 rename AST/Parameter.h to AST/ParameterList.h now that Parameter is gone. 2016-01-03 14:47:44 -08:00
Chris Lattner
6afe77d597 Eliminate the Parameter type completely - now ParameterList is just
an overblown array of ParamDecl*'s that also keeps track of parenlocs
and has helper methods.
2016-01-03 14:45:38 -08:00
Chris Lattner
a30ae2bf55 Merge pull request #836 from zachpanz88/new-year
Update copyright date
2015-12-31 19:36:14 -08:00
Chris Lattner
7daaa22d93 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.
2015-12-31 19:24:46 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Joe Groff
2cf81672c1 AST: Correct scoping of 'while' condition bindings.
Fixes rdar://problem/22210545.

Swift SVN r31945
2015-09-14 22:52:22 +00:00
Jordan Rose
16735a36f6 Fix local variable lookup for names in if/while/guard conditions.
These names don't go into scope until after they've been bound. Not having
this broke "if let foo = foo" for shadowing-based unwrapping.

rdar://problem/21961391

Swift SVN r30539
2015-07-23 16:22:05 +00:00
Ted Kremenek
953ad5350b Revert "Revert "Unify FindLocalVal across UnqualifiedLookup and lookupVisibleDecls.""
This reverts commit r30528.

This is not the source of our project regressions.

Swift SVN r30537
2015-07-23 15:01:15 +00:00
Ted Kremenek
685f2e3800 Revert "Unify FindLocalVal across UnqualifiedLookup and lookupVisibleDecls."
This reverts commit r30525.

This appears likely to be causing build regressions with guard statements on our test projects.

Swift SVN r30528
2015-07-23 05:39:20 +00:00
Jordan Rose
8a2e338e5a Unify FindLocalVal across UnqualifiedLookup and lookupVisibleDecls.
They had already diverged even before my last commit. Let's not have that
happen again!

This re-fixes code completion for bindings declared in top-level guard
statements.

More rdar://problem/21928533

Swift SVN r30525
2015-07-23 04:42:09 +00:00