Commit Graph

29 Commits

Author SHA1 Message Date
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
3ad1ac75b9 [IDE] Change -NEXT to -DAG in test cases
We don’t actually care about the order of the results here. Change `-NEXT` to `-DAG` to make the test cases more robust to changes  in code completion.
2023-02-16 09:39:01 +01: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
Ben Barham
65ef8020de [CodeComplete] Add option to add calls with no defaults (or not)
Now that arguments are marked up with whether they have a default or
not, clients may not need the extra call (that has no default
arguments). Add an option to allow not adding this item.

Resolves rdar://85526214.
2021-12-15 13:30:57 +10:00
Rintaro Ishizaki
a87996c23d [CodeCompletion] 'nil'/'[]'/'[:]' default arguments are "interesting"
func foo(arg: Int? = nil)

Code completion didn't sugget 'foo()' call pattern variant for this
function.
2021-11-05 22:29:14 -07:00
Rintaro Ishizaki
154cd88c86 [CodeCompletion] Use 'Flair' to describe "is argument labels" 2021-06-07 17:25:01 -07:00
Robert Widmann
a772d76c57 Remove an invalid IDE test
Even if we weren't invalidating the parameter's type, this would be
completing a type's members on a parameter label.
2019-10-24 16:03:41 -07:00
Slava Pestov
de8745b733 Sema: Simplify error handling in typeCheckParameterList() 2019-10-10 13:08:08 -04:00
Rintaro Ishizaki
f94a6c0d9b [CodeCompletion] Context type analysis for default argument initializer
rdar://problem/51037538
2019-06-17 15:04:30 -07:00
Rintaro Ishizaki
0c38f2df8a [CodeCompletion] Associate callee declaration with call patterns
In `addFunctionCallPattern()` we should associate declarations if
possible.

rdar://problem/49158044
2019-04-01 11:21:43 -07:00
Rintaro Ishizaki
c99af83901 [CodeCompletion] Consolidate parameter list processing funcitons
There were 2 functions to output argument list. Consolidate them and
consistently use it from every call like production (i.e. function call,
constructor call, enum with associated values, subscript)
2019-03-05 16:45:48 -08:00
Ben Langmuir
642ae90a86 [code-complete] Reduce the priority of function call patterns
Constructor call patterns already get a real priority, but because of
the way we do function call patterns we don't have enough information,
and previously we were setting it to "expression specific", which is
unnecessarily high, particularly since functions (unlike inits) have
other better ways to code-complete already.

rdar://31113161
2017-12-18 12:55:20 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Argyrios Kyrtzidis
8b1dde645a [IDE] Fix code-completion fallout after changes for SE-0111.
rdar://27642873
2016-08-09 18:07:58 -07:00
Doug Gregor
5b67fe455c [SE-0111 HACK] Disable some IDE- and SourceKit-related changes.
I still need to investigate what happened here, but I don't want it to
delay landing the bulk of SE-0111.
2016-07-29 17:28:25 -07:00
Doug Gregor
b9363fe6bd [SE-0111] Enable SE-0111 by default. 2016-07-29 17:28:24 -07:00
Doug Gregor
e2632c1cfa [Code completion] Teach code completion to use declarations for postfix completions.
Code completion had the ability to use declarations to provide better
code completion results for postfix completions, e.g., calls to
functions/methods, but it wasn't trying to get these declarations from
anywhere. Now, get these declarations from the solution to the
constraint system.

The impetus for this is to use default-argument information from the
declaration rather than the type, but plumbing this information
through also means that we get proper "rethrows" annotations, covered
by <rdar://problem/21010193>, and more specific completions in a
number of other places.

Fixes <rdar://problem/21010193>.
2016-06-16 11:44:42 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Saleem Abdulrasool
4984c96caa fix tests for FileCheck behaviour (DAG edition)
FileCheck does not support the combination negation.  These tests were incorrect
and silently passing rather than checking what they intended.
2016-03-12 20:12:23 -08:00
Chris Lattner
0619e57a61 Switch the stdlib to use #file instead of __FILE__, and deprecate the __FILE__ identifiers.
This also updates the tests that would otherwise fail.
2016-02-04 15:08:31 -08:00
Doug Gregor
b2cc34c241 Remove '#' for making parameter names into argument labels.
If you want to make the parameter and argument label the same in
places where you don't get the argument label for free (i.e., the
first parameter of a function or a parameter of a subscript),
double-up the identifier:

  func translate(dx dx: Int, dy: Int) { }

Make this a warning with Fix-Its to ease migration. Part of
rdar://problem/17218256.

Swift SVN r27715
2015-04-24 23:58:57 +00:00
Doug Gregor
793b3326af Implement the new rules for argument label defaults.
The rule changes are as follows:
  * All functions (introduced with the 'func' keyword) have argument
  labels for arguments beyond the first, by default. Methods are no
  longer special in this regard.
  * The presence of a default argument no longer implies an argument
  label.

The actual changes to the parser and printer are fairly simple; the
rest of the noise is updating the standard library, overlays, tests,
etc.

With the standard library, this change is intended to be API neutral:
I've added/removed #'s and _'s as appropriate to keep the user
interface the same. If we want to separately consider using argument
labels for more free functions now that the defaults in the language
have shifted, we can tackle that separately.

Fixes rdar://problem/17218256.

Swift SVN r27704
2015-04-24 19:03:30 +00:00
Ben Langmuir
70a93e0bfe Add code completion overload for defaulted arguments
When a call (func, method, initializer) has default arguments, produce
both the *with* and *without* default argument versions as if they were
overloaded.

rdar://problem/18573874

Swift SVN r27118
2015-04-08 02:41:20 +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
Ben Langmuir
40e6416448 Test improvement missed in r19421
Swift SVN r19422
2014-07-01 18:54:09 +00:00
Ben Langmuir
a2aabbe575 Fix assertion failure completing anonymous default arguments
Parameters may be nameless VarDecls. Instead of asserting otherwise,
just don't provide a completion for that decl.

Swift SVN r19421
2014-07-01 18:51:23 +00:00
Dmitri Hrybenko
a83eb20500 Code completion: skip parameters that are defaulted to either of __FILE__,
__LINE__, __COLUMN__, or __FUNCTION__

rdar://16906142


Swift SVN r18746
2014-06-09 15:47:40 +00:00