Commit Graph

2134 Commits

Author SHA1 Message Date
Emil Pedersen
299cf2972e [test] Add missing colons for FileCheck 2024-02-26 13:31:04 -08:00
Alex Hoppen
0b580f7155 Merge pull request #71587 from ahoppen/ahoppen/nested-call-completion
[CodeCompletion] Always suggest call pattern for nested function calls
2024-02-26 09:14:15 -08:00
Alex Hoppen
0b613cf959 [SourceKit] Test adjustments for improved formatting in BasicFormat
Companion of https://github.com/apple/swift-syntax/pull/2511
2024-02-25 19:36:50 -08:00
Alex Hoppen
873ed19786 [SourceKit] Add the raw doc comment to the cursor info response
SourceKit-LSP currently parses the XML comment to generate Markdown again but round-tripping a (probably markdown) doc comment to XML to Markdown is lossy in many cases and unnecessary work. Include the comment as it is spelled in source in the cursor info response so that sourcekit-lsp can display it.

Part of rdar://120685874
2024-02-24 08:41:08 -08:00
Alex Hoppen
17520dcf6d [CodeCompletion] Always suggest call pattern for nested function calls
When completing in cases like `bar(arg: foo(|, option: 1)`, we don’t know if `option` belongs to the call to `foo` or `bar`. Be defensive and also suggest the signature.
2024-02-21 18:53:07 -08:00
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00
Slava Pestov
4f61ec33d3 Merge pull request #71764 from slavapestov/ncgenerics-xfail
Fix some NoncopyableGenerics test failures and mark remaining as XFAIL
2024-02-21 05:36:01 -05:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Ben Barham
0755fd3259 Merge pull request #69076 from barinsim/local-symbols
[SourceKit] Add option to index local symbols to IndexSource request
2024-02-20 14:54:07 -08:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Kavon Farvardin
75bff92b62 IDE: fix printTypeInterface
The missing module was causing not only a crash in conformance lookup,
but full qualification for a generic parameter, which shouldn't ever be
needed.
2024-02-11 12:54:35 -08:00
Hamish Knight
05612bffe2 Remove special case for stdlib in IsNonUserModuleRequest
It's possible this may be the main module, or a
"local" dependency within the same project, and
should be treated as a user module in such cases.
2024-02-09 11:30:52 +00:00
Guillaume Lessard
114f235d17 Merge pull request #71167 from vanvoorden/vanvoorden/inclusive-language
[Inclusive Language][Comments][Documentation] migrate "sanity" checks to "soundness" checks
2024-02-02 10:27:34 -08:00
Nate Chandler
367d71d74f Revert "[stdlib] Uncheck pointers' conf to BitwiseCopyable"
This reverts commit 4dc9713a7a.
2024-01-31 17:11:54 -08:00
nate-chandler
a43faf89c8 Merge pull request #71242 from nate-chandler/bitwise-copyable/not-for-unchecked
[BitwiseCopyable] Don't derive on @unchecked field
2024-01-31 05:55:38 -08:00
Hamish Knight
27c08b130a Merge pull request #71123 from hamishknight/sema-expr-return
Move the single-expr return transform from Parse to Sema
2024-01-31 10:13:24 +00:00
Nate Chandler
4dc9713a7a [stdlib] Uncheck pointers' conf to BitwiseCopyable
The pitch calls for such types to obstruct inference of _BitwiseCopyable
in aggregates containing them.
2024-01-30 14:38:07 -08:00
Alex Hoppen
3682d8e766 Merge pull request #71227 from ahoppen/ahoppen/related-idents-self
[SourceKit] Fix a crash when performing related identiifers request on `self`
2024-01-30 08:30:33 -08:00
Hamish Knight
f4a6b95d24 Move single-expr return transform from Parse to Sema
Rather than doing the transform in the parser, and
then potentially undoing it in Sema, move the
entire transform into Sema. This also lets us
unify the logic between function decls and
closures, and allows ASTGen to benefit from it.
2024-01-30 14:08:53 +00:00
Alex Hoppen
f0ea24dd29 [SourceKit] Fix a crash when performing related identifers request on self
Performing a related identifiers request on `self` returns an empty result because `self` is not an identifier. We thus can’t retrieve the first location to compute the old name.

rdar://121668042
2024-01-29 15:51:27 -08:00
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -08:00
Egor Zhdan
8c807d9b33 [cxx-interop] Fix tests with split libc++ module
rdar://119869070
2024-01-25 20:07:40 +00:00
Alex Hoppen
2ab9f63810 Merge pull request #71049 from ahoppen/ahoppen/dont-realpath-solver-based-cursor-info
[SourceKit] Don't realpath the primary file path
2024-01-23 07:33:18 -08:00
Alex Hoppen
8625b3f119 [SourceKit] Don't realpath the primary file path
If the file didn’t exist on disk, `fileSystem->getRealPath` returns an empty string, which means we can’t find the `InputBuffer` and thsu won’t run solver-based cursor info. There’s no reason to realpath `PrimaryInputPath`, `getMemoryBuffer` already does that.

rdar://120737244
2024-01-22 14:36:24 -08:00
Alex Hoppen
695e69e09e [CodeComplete] Suggest single argument labels if code completion is invoked at start of function call with exiting parameters
This removes the distinction between argument completions and postfix expr paren completions, which was meaningless since solver-based completion.

It then determines whether to suggest the entire function call pattern (with all argument labels) or only a single argument based on whether there are any existing arguments in the call.

For this to work properly, we need to improve parser recovery a little bit so that it parsers arguments after the code completion token properly.

This should make call pattern heuristics obsolete.

rdar://84809503
2024-01-22 12:21:04 -08:00
Doug Gregor
be2466c72d Updates for new freestanding macro discriminators 2024-01-11 08:19:15 -08:00
Sam Kortekaas
c84ab103be [SourceKit] Don't duplicate coverage in test/Index for indexing local symbols 2024-01-11 17:13:12 +01:00
Simon Barinka
4c7e02d80a [SourceKit] Fix test 2023-12-23 08:02:12 +01:00
Daniel Rodríguez Troitiño
e60785e1ef [test] Mark some tests as requiring Swift Syntax (#70493)
Some of the tests now depend on features provided by Swift Syntax, and
will fail to pass if building without Swift Syntax support.

This commits marks all the tests I know fail to pass when Swift Syntax
is disabled.

- #70281 modified `ASTGen/verify-parse.swift`
- #70287 created `refactoring/SyntacticRename/operator.swift` and `SourceKit/RelatedIdents/operator.swift`
- #70389 modified `SourceKit/Refactoring/basic.swift` and indirectly
  modified all `refactoring/ExtractFunction/*` tests.
2023-12-15 13:33:14 -08:00
Alex Hoppen
32e366a98a [SourceKit] Migrate renameAvailabilityInfo to use the SwiftSyntax NameMatcher
The `NameMatcher` implemented in swift-syntax as slightly different semantics because it consideres `(callable.|callAsFunction)(x: 78)` as a reference to `callAsFunction` instead of a call with argument labels `(x: 78)`, which means that one test needs to be updated.
2023-12-12 12:49:16 -08:00
Alex Hoppen
516836cb98 [SourceKit] Don't handle labels when renaming operators
This allows us to at least rename the base of operators. The labels don’t matter too much since they only occur on the function definition.
2023-12-07 13:12:12 -08:00
Alex Hoppen
ddf4a2e3fb [SourceKit] Return the old name from the related identifiers response 2023-12-07 13:12:11 -08:00
Alex Hoppen
143dccbdf5 [SourceKit] Return RenameLocUsage in related identifiers response
This will allow us to get syntactic rename ranges from the locations returned by related identifiers.
2023-12-07 09:04:24 -08:00
Rintaro Ishizaki
406d5434c1 [SourceKit] Alway dump the input for FileCheck in a cancellation test
To get more information when failed.

rdar://116486638
2023-12-06 09:45:24 -08:00
Doug Gregor
fbd5cb42cd Merge pull request #70247 from DougGregor/body-macro-as-brace-stmt
Macro expansion refactoring for preamble and body macros
2023-12-05 21:47:05 -08:00
Doug Gregor
2b7c70997b Macro expansion refactoring for preamble and body macros 2023-12-05 13:30:35 -08:00
Alex Hoppen
a710111001 [SourceKit] Support building sourcekitd without building swift-syntax
This allows building sourcekitd and swift-refactor with `SWIFT_BUILD_SWIFT_SYNTAX=NO`. In these builds, the `relatedidents` and `find-syntactic-rename-ranges` requests will always return an error.
2023-12-04 19:14:01 -08:00
Alex Hoppen
cc858ab253 Merge pull request #70008 from ahoppen/ahoppen/name-matcher-in-swift
Share implementation of local rename and related identifiers + implement `NameMatcher` in Swift
2023-11-30 09:37:53 -08:00
Ben Barham
000a808bf8 [Test] Regex tests depend on host Swift compiler
This test was missed in #69838. Update to depend on swift_swift_parser
(ie. "have a host Swift compiler").
2023-11-28 12:43:54 -08:00
Alex Hoppen
f408619ddc Address Hamish’s review comments 2023-11-27 14:17:04 -08:00
Alex Hoppen
8fd025625b [SourceKit] Use NameMatcher that is rewritten in Swift for syntactic rename 2023-11-17 09:30:04 -08:00
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