Commit Graph

16 Commits

Author SHA1 Message Date
Slava Pestov
75cf2c1df5 Sema: Remove a usage of replaceCovariantResultType() 2025-08-27 15:34:25 -04:00
Hamish Knight
b82271ecd6 [test] Add test for issue 57916 2024-03-22 21:22:11 +00:00
Ben Barham
39c0afcff1 [Completion] Addd constructors from the completion cache back
31dee1ce1c refactored the completion
filter, accidentally dropping initializers when found from the cache.
Add these back in and also modify the existing test to load from the
cache as well.

Resolves rdar://107807707.
2023-04-09 09:34:51 -07: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
Rintaro Ishizaki
89761de82a [CodeCompletion] Don't suggest initializers on existential types
Existential types cannot be instantiated.

rdar://94369218
2022-06-09 20:15:13 -07:00
Rintaro Ishizaki
154cd88c86 [CodeCompletion] Use 'Flair' to describe "is argument labels" 2021-06-07 17:25:01 -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
Ben Langmuir
b6d5a1f1a5 [code-complete] Do not insert rparen after a call pattern completion
When completing
  Foo(<here>
We will now provide
  bar: <#value#>
instead of
  bar: <#value#>)

Inserting the rparen caused some problems in practice:
* the old behaviour optimized for typing Foo(<complete> instead of
  Foo(<complete>), which can conflict with user behaviours or ...
* in editors with automatic brace-matching, we often conflicted with the
  editor, leading to extraneous closing parens

And in general, it is much more predictable for tooling to either insert
matching ( and ) or to not insert either.  While this change may not be
ideal For users of editors that do not do automatic brace-matching, I
believe it is still better overall to have to type a missing paren than
to have to delete an extraneous one.

rdar://31113161
2017-12-18 11:59:49 -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
Slava Pestov
cfe9e6a3de IDE: Use GenericSignatures and interface types (mostly)
There was a ton of complicated logic here to work around
two problems:

- Same-type constraints were not represented properly in
  RequirementReprs, requiring us to store them in strong form
  and parse them out when printing type interfaces.

- The TypeBase::getAllGenericArgs() method did not do the
  right thing for members of protocols and protocol extensions,
  and so instead of simple calls to Type::subst(), we had
  an elaborate 'ArchetypeTransformer' abstraction repeated
  in two places.

Rewrite this code to use GenericSignatures and
GenericFunctionType instead of old-school GenericParamLists
and PolymorphicFunctionType.

This changes the code completion and AST printer output
slightly. A few of the changes are actually fixes for cases
where the old code didn't handle substitutions properly.
A few others are subjective, for example a generic parameter
list of the form <T : Proto> now prints as <T where T : Proto>.

We can add heuristics to make the output whatever we want
here; the important thing is that now we're using modern
abstractions.
2016-10-02 23:49:15 -04:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07: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
practicalswift
9eb2ee0638 [gardening] Fix accidental double spaces 2016-02-14 17:30:44 +01:00
Xi Ge
08eda102ed [CodeComplete] Finish transforming archetypes to actual types in code completion results and update tests.
Swift SVN r31635
2015-09-02 20:18:16 +00:00
Xi Ge
3e9357a9bb [CodeCompletion] When completing init calls, stick to the type alias name given by the user instead of (smartly) showing the underlying type name. rdar://18586415
Swift SVN r30723
2015-07-28 20:45:12 +00:00
Ben Langmuir
f778836934 Add initializers to postfix-expr code completions
Previously, the only way to get initializers was completing after the
name of the type:
    Foo#^complete_here^#
    Foo(#^or_here^#

And now it will also work in unadorned expressions:
    #^a_top_level_completion^#
    bar(a, #^walked_into_a_bar^#

Unfortunately, not all our clients handle this well yet, so it's
protected by a language option.
    -code-complete-inits-in-postfix-expr

Swift SVN r27275
2015-04-14 14:54:08 +00:00