Commit Graph

2143 Commits

Author SHA1 Message Date
Alex Hoppen
ada3076628 [SourceKit] Share implemention of local rename and related idents
Local rename and related identifiers were sufficiently similar that we can implement related identifiers in terms of local rename.
2023-11-16 16:05:07 -08:00
Alex Hoppen
65aa892d1d Merge pull request #69872 from ahoppen/ahoppen/migrate-rename-tests
[SourceKit] Migrate rename test to only check rename ranges and not the application of the rename
2023-11-16 16:02:59 -08:00
Rintaro Ishizaki
47f18d492e [ASTGen] Move regex literal parsing from SwiftCompilerSources to ASTGen
ASTGen always builds with the host Swift compiler, without requiring
bootstrapping, and is enabled in more places. Move the regex literal
parsing logic there so it is enabled in more host environments, and
makes use of CMake's Swift support. Enable all of the regex literal
tests when ASTGen is built, to ensure everything is working.

Remove the "AST" and "Parse" Swift modules from SwiftCompilerSources,
because they are no longer needed.
2023-11-16 10:59:23 -08:00
Alex Hoppen
5ed83ff616 [SourceKit] Update tests to use find-local-rename-ranges instead of invoking the local rename refactoring action
The local rename refactoring action will be removed in a follow-up commit.
2023-11-15 11:20:26 -08:00
Alex Hoppen
d0f9346efa [SourceKit] Change rename-mismatch to define input spec and expected output inline with the test file 2023-11-10 11:46:59 -08:00
Alex Hoppen
4c1d875cf8 Remove the syntacticrename request
`source.request.find-syntactic-rename-ranges` should be used instead.
2023-11-10 11:46:47 -08:00
Rintaro Ishizaki
93aa7e3137 Merge pull request #69354 from rintaro/macros-peer-declendloc-rdar117098598
[Macros] Adjust insertion position of peer macros for var decls
2023-10-24 11:31:20 -07:00
Alex Hoppen
fdc8e7d387 Merge pull request #69294 from ahoppen/ahoppen/semantic-tokens
[SourceKit] Add a request to get the semantic tokens of a file
2023-10-24 08:07:41 -07:00
Rintaro Ishizaki
ac1443ada6 [Macros] Adjust insertion position of peer macros for var decls
When the target decl is a VarDecl, peer macro should expand at the end
of the pattern binding decl, instead of the end of the VarDecl which
only covers the name.

rdar://117098598
2023-10-23 18:56:39 -07:00
Rintaro Ishizaki
55144fb302 [Macros] Add test for macro expansion printing
* Macro expanded member decls in .swiftinterface (rdar://117374821)
* cursor-info on a decl with peer macro attribute (rdar://117374966)
2023-10-23 15:21:33 -07:00
Alex Hoppen
2507e0e9ee [SourceKit] Support getting semantic tokens for macro expansion buffers 2023-10-23 11:06:49 -07:00
Alex Hoppen
4bc03f8392 [SourceKit] Add a request to get the semantic tokens of a file
We need this request for semantic highlighting in LSP. Previously, we were getting the semantic tokens using a 0,0 edit after a document update notification but that will no longer be possible if we open the documents in syntactic only mode.
2023-10-20 10:38:08 -07:00
Simon Barinka
23cde9b2e0 [SourceKit] Move the option to IndexToStore request 2023-10-20 12:55:41 +02:00
Alexis Laferrière
8b098ab487 [Tests] Remove the flag AccessLevelOnImport from all tests but one 2023-10-10 09:09:22 -07:00
Simon Barinka
b918345910 [SourceKit] Add tests 2023-10-09 21:09:25 +02:00
Egor Zhdan
041005af7c [cxx-interop] Use more correct type names in C++ template parameters
When importing a C++ class template instantiation, Swift translates the template parameter type names from C++ into their Swift equivalent.

For instance, `basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>` gets imported as `basic_string<Scalar, char_traits<Scalar>, allocator<Scalar>>`: `wchar_t` is imported as `CWideChar`, which is a typealias for `Scalar` on most platforms including Darwin. Notice that Swift goes through the `CWideChar` typealias on the specific platform. Another instantiation `basic_string<uint32_t, char_traits<uint32_t>, allocator<uint32_t>>` also gets imported as `basic_string<Scalar, char_traits<Scalar>, allocator<Scalar>>`: `uint32_t` is also imported as `Scalar`. This is problematic because we have two distinct C++ types that have the same name in Swift.

This change makes sure Swift doesn't go through typealiases when emitting names of template parameters, so `wchar_t` would now get printed as `CWideChar`, `int` would get printed as `CInt`, etc.

This also encourages clients to use the correct type (`CInt`, `CWideChar`, etc) instead of relying on platform-specific typealiases.

rdar://115673622
2023-10-09 14:57:10 +01:00
Alex Hoppen
8dec9addfc [ASTGen] Relax assertion on BridgedSourceLoc initializer
We do allow `SourceLoc` to point to the address right after the buffer ends to point to the end of a file.
2023-09-26 15:46:54 -07:00
Mishal Shah
5b73dd6929 Bump the Swift version to 5.11 2023-09-18 09:37:38 -07:00
Slava Pestov
fd06bd87aa AST: Allow the extended type of an extension to refer to be a tuple type
Either directly, or via a type alias.
2023-09-05 23:21:26 -04:00
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
Nishith Shah
8e2e625543 [Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
This commit changes fixit messages from a question/suggestion to an
imperative message for protocol conformances and switch-case. Addresses
https://github.com/apple/swift/issues/67510.
2023-08-13 22:34:26 -07:00
Alex Hoppen
bba2f476ab Merge pull request #67613 from barinsim/my-main
[SourceKit] Report cursor info information for literals
2023-08-08 20:54:00 -07:00
Simon Barinka
9342e78e3e [SourceKit] Fix support for interpolated strings 2023-08-08 23:36:16 +02:00
Hamish Knight
c0e2d5ecbb Merge pull request #67015 from skrtks/sk-fix-incorrect-optional-types 2023-08-03 19:44:29 +01:00
Simon Barinka
06af7494e9 [SourceKit] Report type decl info instead of hidden inits 2023-08-02 23:40:08 +02:00
Simon Barinka
b7ee6e4c1d [SourceKit] Remove unnecessary open request 2023-08-01 19:16:41 +02:00
Simon Barinka
944a81836c [SourceKit] Remove sourcekit-test_plain 2023-08-01 19:13:20 +02:00
Alex Hoppen
b92530f50b Merge pull request #67500 from ahoppen/ahoppen/accessor-refactoring
Adjustments for refactoring of representation of Accessors in SwiftSyntax
2023-08-01 06:34:24 -07:00
Simon Barinka
d0cf2e4bf3 [SourceKit] Fix formatting issues 2023-08-01 13:26:14 +02:00
Simon Barinka
e32a20a55c [SourceKit] Report init info instead of the type decl info
Addresses PR review comments.
2023-08-01 12:51:39 +02:00
Alex Hoppen
cf81bab67d [Macros] Adjust test case because accessors are only separated by a single line 2023-07-31 21:53:24 -07:00
Simon Barinka
fcd084f9dd [SourceKit] Report cursor info information for literals
Adds literals support for the CursorInfo request.
Previously CursorInfo just returned error for literals.
Implements issue #57725
2023-07-30 14:22:08 +02:00
Alex Hoppen
992398b211 Merge pull request #67584 from ahoppen/ahoppen/de-duplicate-cursor-info-results
[CursorInfo] De-duplicate reported cursor info results
2023-07-28 07:33:52 -07:00
Alex Hoppen
862e14e084 [CursorInfo] De-duplicate reported cursor info results
The constraint system might produce multiple solutions that all reference the same declaration. We should only report the declaration once in those cases instead of multiple times.

rdar://111814276
2023-07-27 16:48:28 -07:00
Ben Barham
7e8a33097e Merge pull request #67488 from bnbarham/better-note-locations
[Diagnostics] Improve diagnostics involving macros
2023-07-26 17:48:02 -07:00
Ben Barham
18cb5f4f3d [Diagnostics] Update in_macro_expansion note for attached macros
Use the attached atttribute's location as the location of the macro,
rather than the location of the declaration it's attached to. Also add
the kind and name of that declaration to the note itself.
2023-07-25 16:03:52 -07:00
Kavon Farvardin
b5e0f95a18 eliminate pipes in favor of shlex
This solves deprecation warnings in build-script:

```
DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
```

This change assumes that the minimum version
of Python3 is 3.3, which has `shlex.quote`.

Since our build bots currently use 3.6 as their
Python version, we can't yet use `shlex.join`
to further simplify some of the code using
quote.
2023-07-25 15:24:54 -07:00
Sam Kortekaas
c210a08afb [SourceKit] Don't report types for implicit expressions
Fixes incorrectly reporting an optional type for an expression when the contextual type is optional.

fixes #66882
rdar://111462279
2023-07-25 10:12:14 +02:00
Holly Borla
61e5811d73 [NFC] Update IDE, Index, ModuleInterface, and SourceKit tests to remove
conformance macros.
2023-07-19 12:38:52 -07:00
QuietMisdreavus
2565925f88 [SymbolGraphGen] allow cursor symbol graphs from function params (#67267)
rdar://105516823
2023-07-13 13:48:12 -06:00
Ben Barham
6e93ac1627 Merge pull request #66958 from DavidGoldman/main
Add source.request.index_to_store to sourcekitd
2023-07-12 13:53:33 -07:00
David Goldman
bce6490e44 Fix indexstore test paths on Windows 2023-07-11 17:14:52 -04:00
Alex Hoppen
c7e0bfae02 [IDE] Adjust test cases for migrating all completion kinds to solver-based 2023-07-07 19:51:01 +02:00
Holly Borla
67b30a406a [NFC] Fix formatting of expanded extensions in SourceKit tests. 2023-06-30 22:54:22 -07:00
David Goldman
af81adb63c sourcekitd source.request.index_to_store fixes - new test and minor changes 2023-06-30 15:55:43 -04:00
David Goldman
d618233166 Add source.request.index_to_store to sourcekitd
This requests performs an index store index of the given file using the
given index store path and index unit output path. All other options are
derived from the index store related compiler flags.

This will allow IDEs like Xcode to index the file directly inside of
sourcekitd and potentially reuse an already built AST.
2023-06-28 14:24:20 -04:00
Ben Barham
ab95dba720 [CursorInfo] Pass primary path to allow comparing previous ASTs
Update the cursor requests to also pass in their primary file. Snapshots
should be compared using this file, not the input buffer name. This
fixes AST re-use when the AST is usable with snapshots.

Resolves rdar://110344363.
2023-06-23 20:00:19 -07:00
Ben Barham
037ddc92ee [CursorInfo] Re-use already built ASTs ahead of currently building ones
Resolves rdar://110344363.
2023-06-22 14:12:48 -07:00
Kim de Vos
28df294e00 Remove spacing 2023-06-21 10:56:57 +02:00
Hamish Knight
a9f9bd1394 [SourceKit] Record module loading errors when generating interfaces
Record up to two errors emitted when we fail to
load a module for interface generation, and include
these errors in the message we pass back to the
editor. This should help us better pin down the
reason why interface generation failed.

rdar://109511099
2023-06-15 23:55:07 +01:00