Commit Graph

2426 Commits

Author SHA1 Message Date
Rintaro Ishizaki
5d6298ad05 Merge pull request #30996 from rintaro/ide-completion-performcachedoperaiton
[CodeCompletion][NFC] Fix typo
2020-04-13 16:20:09 -07:00
Nathan Hawes
6f50aa4957 Merge pull request #30891 from nathawes/indent-enum-case-decl
[SourceKit/CodeFormat] Column-align enum element decls and the items in their parameter lists.
2020-04-13 12:08:05 -07:00
Rintaro Ishizaki
2bf9dde17b [CodeCompletion][NFC] Fix typo 2020-04-13 11:55:34 -07:00
Nathan Hawes
b3b7aa8ecf Merge pull request #30964 from nathawes/syntactic-rename-for-callAsFunction
[IDE][Refactoring] Handle 'callAsFunction' specially in syntactic rename
2020-04-13 11:36:53 -07:00
Nathan Hawes
bce68fa4e5 [IDE][Refactoring] Handle 'callAsFunction' specially in syntactic rename.
This change makes us treat it exactly as we do 'init'. We don't allow renaming the base name,
and don't fail if the basename doesn't match for calls.

Also:
  - explicit init calls/references like `MyType.init(42)` are now reported with
    'init' as a keywordBase range, rather than nothing.
  - cursor info no longer reports rename as available on init/callAsFunction
    calls without arguments, as there's nothing to rename in that case.
  - Improved detection of when a referenced function is a call (rather than
    reference) across syntactic rename, cursor-info, and indexing.

Resolves rdar://problem/60340429
2020-04-12 17:14:15 -07:00
Rintaro Ishizaki
14fbb8286b Merge pull request #29854 from rintaro/ide-completion-keypathfunc-paramty
[CodeCompletion] Use AnyFunctionType::Param::getParameterType()
2020-04-10 19:26:15 -07:00
Nathan Hawes
13d5a8addb Merge pull request #30870 from nathawes/mutiple-catch-pattern-indentation
[SourceKit/CodeFormat] Column-align multiple patterns in catch clauses
2020-04-10 19:07:44 -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
de6a402116 [CodeCompletion] Add pretty stacktrace for completion operation 2020-04-10 09:28:40 -07:00
Nathan Hawes
8e527ed7fa Merge pull request #30894 from nathawes/avoid-multiline-string-indent
[SourceKit/CodeFormat] Don't modify multiline string indentation regardless of it being column-aligned or not.
2020-04-09 12:48:10 -07:00
Nathan Hawes
df3b6a83bb [SourceKit/CodeFormat] Don't modify multiline string indentation regardless of it being column-aligned or not.
Resolves rdar://problem/61463947
2020-04-08 12:11:48 -07:00
Nathan Hawes
c6a06e0feb [SourceKit/CodeFormat] Column-align enum element decls and the items in their parameter lists.
Resolves rdar://problem/61461022
2020-04-08 10:16:59 -07:00
Nathan Hawes
19d6effc5e [SourceKit/CodeFormat] Column-align multiple patterns in catch clauses.
Catch clauses now support mutliple patterns. Like 'case' patterns, these
should be column-aligned if split across multiple lines.

do {
  ...
} catch MyErr.a(let x),
        MyErr.b(let x) {
  print("hello")
}
2020-04-08 09:46:09 -07:00
Rintaro Ishizaki
496c303ab5 Merge pull request #30865 from rintaro/sourcekit-completion-rdar61367416
[SourceKit] Don't use diagnostics to indicate fast-completion
2020-04-07 17:58:19 -07:00
Rintaro Ishizaki
4870d1c017 [SourceKit] Don't use diagnostics to indicate fast-completion
Add 'key.reusingastcontext: 1' to the response instead.
Using diagnostics can be a noise to indexing log clients.

rdar://problem/61367416
2020-04-07 16:26:00 -07:00
Doug Gregor
78880ffc1a Merge pull request #27776 from owenv/catch_revamp_take_4
[SE-0276] Support multiple patterns in catch clauses
2020-04-07 12:31:33 -07:00
Rintaro Ishizaki
28de43b7ca [CodeCompletion] Trim whitespaces around the content 2020-04-07 00:50:43 -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
Owen Voorhees
43e2d107e1 [SE-0276] Implement multi-pattern catch clauses
Like switch cases, a catch clause may now include a comma-
separated list of patterns. The body will be executed if any
one of those patterns is matched.

This patch replaces `CatchStmt` with `CaseStmt` as the children
of `DoCatchStmt` in the AST. This necessitates a number of changes
throughout the compiler, including:
- Parser & libsyntax support for the new syntax and AST structure
- Typechecking of multi-pattern catches, including those which
  contain bindings.
- SILGen support
- Code completion updates
- Profiler updates
- Name lookup changes
2020-04-04 09:28:26 -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
Hamish Knight
d2434e1bf7 NFC: Rename NameBinding to ImportResolution 2020-03-29 18:43:58 -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
Robert Widmann
987cd55f50 [NFC] Drop llvm::Expected from Evaluation Points
A request is intended to be a pure function of its inputs. That function could, in theory, fail. In practice, there were basically no requests taking advantage of this ability - the few that were using it to explicitly detect cycles can just return reasonable defaults instead of forwarding the error on up the stack.

This is because cycles are checked by *the Evaluator*, and are unwound by the Evaluator.

Therefore, restore the idea that the evaluate functions are themselves pure, but keep the idea that *evaluation* of those requests may fail. This model enables the best of both worlds: we not only keep the evaluator flexible enough to handle future use cases like cancellation and diagnostic invalidation, but also request-based dependencies using the values computed at the evaluation points. These aforementioned use cases would use the llvm::Expected interface and the regular evaluation-point interface respectively.
2020-03-26 23:08:02 -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
Nathan Hawes
7811f531cb Merge pull request #30521 from nathawes/cross-import-interface-gen
[SourceKit/InterfaceGen] Also print the cross-import overlays of a module in its interface.
2020-03-24 10:28:55 -07:00
Nathan Hawes
a7e1cb3925 [SourceKit] Update cursor info to report symbols from cross-import overlays as coming from the underylying module.
Also refactor some of the interface generation cross-import support code to be
shared.
2020-03-20 21:49:51 -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
Nathan Hawes
b3f296d590 [SourceKit/InterfaceGen] Also print the cross-import overlays of a module in its interface.
When printing the generated interface of a module, also print the decls from
any underscored cross-import overlays it is the direct, or indirect underlying
module of. Declarations are grouped by overlay, with a descriptive `MARK:`
comment introducing each overlay, and a regular comment above each decl listing
the required bystander modules that must be imported for the decl to be
available.

In addition in each overlay:
- import declarations of any underlying modules are filtered out, since they
  are either other underscored cross-import overlays, or the target module they
  are being presented as being part of.
- import declarations that are also in the target module are filtered out, since
  the overlay is being presented as a conditional part of the target module.

Resolves rdar://problem/59445385
2020-03-19 18:15:42 -07:00
Rintaro Ishizaki
4bd753c141 Merge pull request #30506 from rintaro/ide-completion-rdar51504896
[CodeCompletion] Don't ignore CovariantReturnConversionExpr
2020-03-19 14:57:25 -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
Rintaro Ishizaki
cbeffb69cd [CodeCompletion] Don't ignore CovariantReturnConversionExpr
in typechecked AST. This is needed to correctly get the type of the
parsed expression when the expression is a calling to a method in super
class returning 'Self'.

rdar://problem/51504896
2020-03-19 11:05:04 -07:00
Robert Widmann
6d60d01420 [NFC] Remove the Legacy Semantic Queries Bit
Clients that wish to avoid semantic requests should decline to register
those requests.
2020-03-19 11:04:12 -07:00
Nathan Hawes
fd82d87db0 Merge pull request #30402 from nathawes/cross-import-code-completion
[IDE/CodeCompletion] Add code completion support for cross import overlays.
2020-03-18 18:16:03 -07:00
Nathan Hawes
63636100be [IDE/CodeCompletion] Add code completion support for cross import overlays.
If a cross-import overlay shadows another module and has a name starting with
'_', don't present that overlay in places where module name completions are
offered and present symbols comining from that module as if they came from
the shadowed module instead.

Resolves rdar://problem/59445688
2020-03-18 12:02:20 -07:00
Slava Pestov
4caa6d7003 IDE: Fix indexing for Sema-built curry thunks 2020-03-17 19:03:03 -04:00
Slava Pestov
b45f70d8b0 IDE: Clean up traversal logic in SourceEntityWalker
Try to make this a bit more self-documenting.
2020-03-17 19:03:03 -04:00
Dmitri Gribenko
841eeb05b0 Merge pull request #30403 from MForster/forster/string-fixes
Cherry-pick StringRef->std::string conversion fixes into `master`
2020-03-17 12:09:36 +01:00
Robert Widmann
70b6bbcb13 Remove swift::createTypeChecker
Replace it with the "legacy semantic queries" bit. The remaining client
of this bit is SourceKit, which appears to require this bit be set
conditionally so certain semantic property wrapper requests return
a sentinel value.

We should migrate these requests to a syntactic interface as soon as
possible.

rdar://60516325
2020-03-16 19:20:22 -07:00
Ben Langmuir
dbbe45e256 Merge pull request #30389 from benlangmuir/index-caf
[index] Add implicit callAsFunction reference to index
2020-03-13 14:44:26 -07:00
Michael Forster
345a9147ec Explicit SmallString->std::string conversion.
This is only needed temporarily until commit d7049213 from upstream
LLVM hits the swift/master branch.
2020-03-13 19:16:49 +01:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00