Commit Graph

1207 Commits

Author SHA1 Message Date
Nathan Hawes
244dc4a768 [AST] Rename PlatformKind::OSX to PlatformKind::macOS
Because the names are coming from a .def file used for printing too, this
simplifies the printing logic as well.
2020-07-08 16:29:31 -07:00
Nathan Hawes
9bcb54910e [AST] Prefer the 'macOS' spelling over 'OSX' when printing the platform kind.
This affects module interfaces, interface generation in sourcekitd, and
diagnostics. Also fixes a fixit that was assuming the 'OSX' spelling when
computing the source range to replace.

Resolves rdar://problem/64667960
2020-07-08 13:51:25 -07:00
Rintaro Ishizaki
f50b66689e [CodeCompletion] Fallback to nominal member completion after trailing closure
After trailing closure, we perform "Labeled trailing closure" completion
and fall back to other completion depending on the position.

If the completion happens at a newline position, it used to fallback to
global expression completion, but in type context, we should do override
completion instead.

Also, we didn't use to propagate 'hasCodeCompletion()' status properly.

rdar://problem/64650782
2020-06-24 01:04:33 -07:00
Robert Widmann
0da060e95e Merge pull request #32447 from martinboehme/option-set-initializer-list
Give OptionSet an initializer_list constructor
2020-06-23 10:36:57 -07:00
Martin Boehme
d806ba53f6 Give OptionSet an initializer_list constructor.
This makes it easier to specify OptionSet arguments.

Also modify appropriate uses of ModuleDecl::ImportFilter to take
advantage of the new constructor.
2020-06-22 06:57:29 +02:00
Rintaro Ishizaki
d4da603960 [CodeCompeltion] Suggest 'macOS' instead of 'OSX'
'macOS' is the preferred name for specifying the platform. Since 'OSX'
is deprecated, we don't need to suggest 'OSX' variants.

rdar://problem/64379019
2020-06-17 14:09:25 -07:00
Rintaro Ishizaki
5db0f1a40b [CodeCompletion] Typecheck without CodeCompletionExpr
when falling back to "postfix expression completion" after labeled
trailing closure completion.

rdar://problem/64176730
2020-06-15 21:40:40 -07:00
Rintaro Ishizaki
552134a06d Merge pull request #32276 from rintaro/ide-conformingmethods-disablelabeledtrailingclosure-rdar63781922
[SourceKit] Disable labeled trailing closure completion support except code completion
2020-06-11 08:59:37 -07:00
Rintaro Ishizaki
67e88f4f26 [SourceKit] Disable labeled trailing closure support except code completion
Don't insert CodeCompletionExpr at the cursor position in
"conforming method list" or "typecontext" mode. This increase the chance
of successful type checking.

rdar://problem/63781922
2020-06-09 13:02:03 -07:00
Rintaro Ishizaki
38d8b13520 [CodeCompletion] Add keypath apply subscript after open bracket
rdar://problem/61016147
2020-06-09 11:04:02 -07:00
Rintaro Ishizaki
f21279efad Merge pull request #32053 from rintaro/ide-completion-sself-rdar61307680
[CodeCompletion] Suggest 'Self' inside struct, enum and classe
2020-06-02 17:27:01 -07:00
Rintaro Ishizaki
65b8cf76f3 Merge pull request #32086 from rintaro/ide-completion-skipbody-rdar58687608
[CodeCompletion] Skip type checking unrelated statements in function body
2020-06-02 17:10:07 -07:00
Rintaro Ishizaki
3b97b8647c [CodeCompletion] Suggest 'Self' inside struct, enum and classe
In 'protocol', 'Self' is implicitly declared as a generic parameter.
In 'struct' and 'enum', 'Self' is just an alias for the nominal type.
In 'class', 'Self' is a dynamic type and usable only in result types and
inside function bodies.

rdar://problem/61307680
2020-06-02 14:58:10 -07:00
Rintaro Ishizaki
e6ce361042 [CodeCompletion] Rename typeCheckContextUntil to typeCheckContextAt 2020-06-01 12:36:39 -07:00
Anthony Latsis
9fd1aa5d59 [NFC] Pre- increment and decrement where possible 2020-06-01 15:39:29 +03:00
Rintaro Ishizaki
3e200b7783 [CodeCompletion] Skip typechecking unrelated statements in func bodies
rdar://problem/58687608
2020-05-29 14:45:04 -07:00
Rintaro Ishizaki
af27e8f183 [CodeCompletion] Avoid suggesting duplicated module names
in global completion result. Overly modules have the same name as the
shadowed modules. We should not list both names because they are
identical.

Maintain a set of seen module names to avoid suggesting duplicated
names.

rdar://problem/63370253
2020-05-19 15:18:34 -07:00
Anthony Latsis
44a92a926c [NFC] GenericSignatureImpl: Spell conformsToProtocol & getConformsTo in terms of requirements 2020-05-14 22:51:44 +03:00
Rintaro Ishizaki
7e170ded66 [CodeCompletion] Remove unused parameter from a couple of lambda 2020-05-12 10:42:04 -07:00
Rintaro Ishizaki
ecfd369f35 [CodeCompletion] Typo: 'getAnnnoateResult' -> 'getAnnotateResult' 2020-05-12 10:33:45 -07:00
Rintaro Ishizaki
7086ffb79f [CodeCompletion] Annotated result type
Introduced 'TypeAnnotationBegin' chunk kind for grouping the result type
name chunks.

rdar://problem/62617558
2020-05-11 22:56:22 -07:00
Rintaro Ishizaki
75a0c9f819 [CodeCompletion] Add 'IsSystem' flag to code completion result item
'key.is_system: 1' is added if the associated declaration is from a
system module.

rdar://problem/62617558
2020-05-11 12:24:36 -07:00
Ben Langmuir
37b98af4e6 [CodeCompletion] Pre-expand closures in argument completion
When completing a single argument for a trailing closure, pre-expand the
closure expression syntax instead of using a placeholder. It's not valid
to pass a non-closure anyway.

rdar://62189182
2020-05-06 01:56:41 -04:00
Rintaro Ishizaki
7407a8092d [CodeCompletion] Postfix expr completion after trailing closures 2020-05-06 01:56:41 -04:00
Rintaro Ishizaki
1cbb1e76d4 [CodeCompletion] Update for braceless multiple trailing closure 2020-05-06 01:56:41 -04:00
Rintaro Ishizaki
fd68f092f2 [CodeCompletion] Completion inside multiple trailing closure
rdar://problem/59688477
2020-05-06 01:56:40 -04:00
Rintaro Ishizaki
e9c438cdd5 [CodeCompletion] Dont mark type mismatching items 'not recommended'
func foo() {}
let a: Int = #^HERE^#

Previously, we marked 'foo()' as 'NotRecommented' because 'Void' doesn't
have any member hence it cannot be 'Int'. But it wass confusing with
'deprecated'.

Now that we output 'typerelation' which is 'invalid' in this case. So clients
can deprioritize results, or even filter them out.

rdar://problem/57726512
2020-05-05 10:40:05 -07:00
Daniel Sweeney
ea526c6383 Converting ModuleDecl::ImportedModule from std::pair to a dedicated struct. (#31360) 2020-04-30 20:26:03 -07:00
Rintaro Ishizaki
2b4cc8581e Merge pull request #31316 from rintaro/ide-completion-protocolext-rdar53591636
[CodeCompletion] Don't show protocol extension only members in override
2020-04-28 09:08:39 -07:00
Rintaro Ishizaki
b2a742cb17 Merge pull request #31307 from rintaro/ide-completion-rdar62121221
[CodeCompletion] Prioritize type matching overload for unresovled member
2020-04-27 12:10:19 -07:00
Rintaro Ishizaki
ab7ba4ce79 [CodeCompletion] Don't show protocol extension only members in override
Protocol extension only members are not customization point. Code
completion should not suggest them in override/conformance completion.

rdar://problem/53591636
2020-04-27 11:52:27 -07:00
Rintaro Ishizaki
e947512875 [CodeCompletion] Prioritize type matching overload for unresovled member
For exmaple:

    func foo(_: Int, _: IntOption)
    func foo(_: Float, _: FloatOption)

    foo(intVal, .<HERE>)

Previously code completion suggests static member from 'IntOption' and
'FloatOption' without any prioritization. Prioritize members from
'IntOption' because the user probably wants to input them.

In such cases, 'CodeCompletionExpr' at the cursor position is
pre-typechecked to 'IntOption'. So mark results with matching type with
'ExprSpecific'.

rdar://problem/62121221
2020-04-24 18:01:59 -07:00
Anthony Latsis
74252028ca AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl 2020-04-23 05:16:55 +03:00
Rintaro Ishizaki
0f1cffd2d2 [CodeCompletion] Completion for control trasfer target
Completion after 'break' and 'continue'

rdar://problem/57016218
2020-04-17 14:18:33 -07:00
Rintaro Ishizaki
315f65f962 [CodeCompletion] Use AnyFunctionType::Param::getParameterType()
instead of getOldType() in KeyPath as funtions completion.
Also, don't think keypath's are convertible to functions that receives
variadic parameters.
2020-04-10 15:55:32 -07:00
Rintaro Ishizaki
c633da047d [CodeCompletion] Add IDE test case for annotated description 2020-04-07 00:50:43 -07:00
Rintaro Ishizaki
d54e70cd70 [CodeCompletion] Option to swift-ide-test to test annotated results 2020-04-07 00:50:43 -07:00
Rintaro Ishizaki
ad8415a5c2 [CodeCompletion] Include 'annotated' to cache key 2020-04-07 00:46:14 -07:00
Rintaro Ishizaki
773a464e83 [CodeCompletion] Add an option to emit annotated description 2020-04-07 00:46:14 -07:00
Nathan Hawes
1a65b84a42 [IDE] Completion after a qualifying module should return symbols from its shadowing cross-import overlays. 2020-04-03 16:04:32 -07:00
Nathan Hawes
9f6f76308e Add method to ModuleDecl to lazily compute the underlying module for cross-import overlays
Also update code completion, indexing, interface generation and doc info to use it.
2020-04-03 16:04:32 -07:00
Robert Widmann
630d0f631a Merge pull request #30606 from AnthonyLatsis/rename-getfullname
[NFC] Preparations to address the «Rename to getName?» TODO on ValueDecl::getFullName
2020-04-01 09:00:04 -07:00
Anthony Latsis
d0ae3ee580 [AST] Replace FuncDecl::getName & EnumElementDecl::getName with ValueDecl::getBaseIdentifier 2020-03-29 00:35:51 +03:00
Anthony Latsis
41fe367a7e [CodeCompletion] Don't skip derived conformance members on override completion lookup 2020-03-28 23:59:18 +03:00
Hamish Knight
6f212634c8 Add getOperatorDecls to FileUnit and ModuleDecl
Query the SourceLookupCache for the operator decls,
and use ModuleDecl::getOperatorDecls for both
frontend stats and to clean up some code
completion logic.

In addition, this commit switches getPrecedenceGroups
over to querying SourceLookupCache.
2020-03-27 09:44:55 -07:00
Nathan Hawes
8b03b05f1d [Index] Add index support for cross import overlays.
Resolves rdar://problem/59445445
2020-03-25 10:04:41 -07:00
swift-ci
41301c2597 Merge pull request #30542 from marcrasi/fix-autocomplete-crash-callasfunction 2020-03-20 16:57:49 -07:00
Marc Rasi
5772ddda7e fix autocomplete crash 2020-03-20 14:43:46 -07:00
Rintaro Ishizaki
80848682cc [LookupVisibleDecls] Tweak unquialified lookup
- Show static var decls in non-qualified metatype lookup
- Show enum element decls in non-qualified metatype lookup
- Never show initializers in non-qualified lookup
- Perform instance lookups in lazy var initializer
- Perform non-qualified metatype lookup inside static func

rdar://problem/57622639
2020-03-20 10:44:24 -07:00
Robert Widmann
21cfcfef2c Merge pull request #30505 from CodaFi/ligated-legacy
[NFC] Remove the Legacy Semantic Queries Bit
2020-03-19 13:45:27 -07:00