Commit Graph

19 Commits

Author SHA1 Message Date
Alex Hoppen
a5a17aa955 [tests] Add a %batch-code-completion lit substitution
I could never remember the command to run batch code completion tests. Add a lit substitution for it.
2023-09-18 13:57:49 -07:00
Alex Hoppen
71937667f2 [IDE] Don’t return any result if the base expression’s type in postfix completion couldn’t be inferred 2023-07-07 19:51:01 +02:00
Alex Hoppen
00eaed3af9 [CodeCompletion] Migrate postfix expr completion to solver-based 2023-07-07 19:51:01 +02:00
Alex Hoppen
32eff21977 [IDE] Remove "Begin completions" and "End completions" from test cases
These test lines weren't actually providing any value and were annoying to write. Let's jut remove them.
2023-03-22 09:07:17 -07:00
Alex Hoppen
5d01a097e1 [CodeCompletion] Don't distinguish convertible and idenical type relation
I think that preferring identical over convertible makes sense in e.g. C++ where we have implicit user-defined type conversions but since we don’t have them in Swift, I think the distinction doesn’t make too much sense, because if we have a `func foo(x: Int?)`, want don’t really want to  prioritize variables of type `Int?` over `Int` Similarly if we have `func foo(x: View)`, we don’t want to prioritize a variable of type `View` over e.g. `Text`.

rdar://91349364
2022-04-13 08:28:17 +02:00
Rintaro Ishizaki
defb593f8d [CodeCompletion] Migrate some tests to batch completion test 2021-04-01 22:33:12 -07:00
Slava Pestov
f7e39447a7 LookupVisibleDecls: Find generic parameters in methods inside extensions
The logic here had diverged from UnqualifiedLookup. One day we'll merge
the two, for now clean it up a bit to match.

Note that all generic parameters now have 'Reason' reported as 'Local'.
I don't believe this really matters.

Fixes <rdar://problem/20530021>.
2019-01-08 16:51:20 -05:00
Rintaro Ishizaki
18582d3406 [CodeCompletion] Handle ExprPattern in context type analysis
This improves type inference for code completion in argument position of
EnumElementPattern.
2018-08-09 19:49:25 +09:00
Ben Langmuir
e43a1d35ab [codecompletion] Don't complete global names after var/let
We are expecting a new identifier, and completing global names is not
helpful.  If the editor chooses to automatically provide completions, it
may be actively harmful if we end up inserting a completion here.

rdar://problem/29118428
2016-11-09 13:53:45 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Joe
a6dad0091b [SE-0095] Initial parsing implementation for '&' composition syntax
This commit defines the ‘Any’ keyword, implements parsing for composing
types with an infix ‘&’, and provides a fixit to convert ‘protocol<>’

- Updated tests & stdlib for new composition syntax
- Provide errors when compositions used in inheritance.
Any is treated as a contextual keyword. The name ‘Any’
is used emit the empty composition type. We have to
stop user declaring top level types spelled ‘Any’ too.
2016-07-19 12:01:02 -07: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
gregomni
63f810d2fd Variables in 'case' labels with multiple patterns.
Parser now accepts multiple patterns in switch cases that contain variables.
Every pattern must contain the same variable names, but can be in arbitrary
positions. New error for variable that doesn't exist in all patterns.

Sema now checks cases with multiple patterns that each occurence of a variable
name is bound to the same type. New error for unexpected types.

SILGen now shares basic blocks for switch cases that contain multiple
patterns. That BB takes incoming arguments from each applicable pattern match
emission with the specific var decls for the pattern that matched.

Added tests for all three of these, and some simple IDE completion
sanity tests.
2016-02-24 15:46:36 -08:00
Ben Langmuir
5b2a16f7ad [CodeCompletion] Don't look at null subpattern of "is T.Type"
Fixes a crash in

    switch x.self {
    case T.Type:
      #^COMPLETE_HERE^#

rdar://problem/21174713

Swift SVN r29549
2015-06-22 16:45:41 +00:00
Chris Lattner
d7c26d8758 Speculatively land the grammar change for <rdar://problem/20167393> revise typed-pattern grammar to make refutable patterns a superset of irrefutable ones
This is still a subject of discussion on swift-dev, but it seems like clearly the right
way to go to me.  If it turns out that this isn't a good direction, I'll revert this and 
subsequent patches built on top of it.



Swift SVN r26168
2015-03-15 22:54:45 +00:00
Denis Vnukov
152df92966 [CodeCompletion] Code Completion String getName should always return non-empty string value for
valid code completions. Code completion tests call and validate getName’s result. 

A minor fix for code completion fro subscripts.



Swift SVN r25101
2015-02-09 22:32:05 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
35ceac419d Code completion: ensure we don't try to complete the identifier in pattern-atom
Swift SVN r7555
2013-08-24 03:47:05 +00:00