Commit Graph

310 Commits

Author SHA1 Message Date
Ramon Asuncion
8c4371fe42 [Test] Add TODO to try making disabled tests work on Windows 2026-02-06 02:04:34 -05:00
Ramon Asuncion
5dea047d5e [Test][SourceKit] Use lit DEFINE directive for shared compiler args 2026-02-02 11:21:20 -05:00
Ramon Asuncion
ae16863916 [Test] Replace REQUIRES:shell with UNSUPPORTED: OS=windows-mscv 2026-02-01 20:56:50 -05:00
Henrik G. Olsson
f0677a67f5 Merge pull request #86494 from ramonasuncion/complete-checkdeps-remove-shell2
[Test][SourceKit] Use lit DEFINE directive for compiler args in checkdeps tests
2026-01-30 12:51:44 -08:00
Ramon Asuncion
f7ab493484 [Test][SourceKit] Use lit DEFINE directive for shared compiler args 2026-01-29 15:23:13 -05:00
Ramon Asuncion
a4691fd25b [Test][SourceKit] Remove tee from complete_checkdeps_vfs_open.swift for Windows 2026-01-14 13:25:55 -05:00
Ramon Asuncion
d47de5827d [Test][SourceKit] Fix UNSUPPORTED directive placement in checkdeps tests 2026-01-14 07:37:52 -05:00
Ramon Asuncion
12f33654b6 [Test][SourceKit] Skip checkdeps bridging test on Windows 2026-01-13 06:20:06 -05:00
Ramon Asuncion
363f79a83e [Test][SourceKit] Use %{fs-sep} for cross-platform VFS paths 2026-01-13 06:04:43 -05:00
Ramon Asuncion
e8d629088a [Test][SourceKit] Inline COMPILER_ARGS in checkdeps tests (part 2) 2026-01-12 16:29:45 -05:00
Ramon Asuncion
77efbb547d [Test][SourceKit] Inline COMPILER_ARGS and remove shell REQUIRES
Inlines bash array and variable expansion in checkdeps tests for
internal shell compatibility
2026-01-12 16:18:49 -05:00
Ramon Asuncion
353513cf94 [Test][SourceKit] Remove REQUIRES shell directive 2026-01-12 14:04:42 -05:00
Ahmed Elrefaey
1bc96857a8 Merge pull request #82464 from a7medev/feat/full-documentation-in-code-completion
[IDE] Add full documentation to code completion result
2025-09-04 10:06:21 +01:00
Ahmed Mahmoud
491b3a0fbc [IDE] Erase archetypes with no declaration generic signature
This generalization enables curried functions with generic parameters coming from the initial declaration to be printed with the archetype's upperbound rather than '_' unresolved type.

As an added benefit, T.self and T.Type for generic parameters now get shown as the upperbound of the generic parameter provided
2025-08-29 13:39:58 +03:00
Hamish Knight
a3edf17b24 [SourceKit] Fix assertion failure in sortTopN
With the unqualified fallback we start to hit this assertion for
`return nil` in failable intializers. We ought to be able to just
skip over literal buckets though.
2025-08-25 11:13:40 +01:00
Anthony Latsis
0a1b8b0d50 [test] Fix misspelled FileCheck directives 2025-05-29 15:09:36 +01:00
Hamish Knight
54e0607091 [Sema] Add missing null check for Type
`getType` here can return a null type if the queried expression isn't
part of the solution, which can currently happen for code completion.
I'm working on a more principled fix for this, but until then this is
a low-risk fix that will unblock the stress tester and can be
cherry-picked to 6.2.

rdar://149759542
2025-04-23 12:58:28 +01:00
Hamish Knight
7061a20edd [CS] Remove ConstraintSystem::getVarType
The logic here for completion wasn't actually
helping things since it would result in adding the
var overload to the system, which would result
in an ErrorType binding. We could turn the ErrorType
into a placeholder when resolving the overload,
but the simpler solution is to just allow CSGen
to turn the reference into a PlaceholderType. This
matches what we do for regular solving, and fixes
a crash with an IUO completion.

rdar://89369091
2024-11-04 17:08:20 +00:00
Allan Shortlidge
af84818e5c IDETool: Register SourceFile for replaced function body.
This prevents a nullptr dereference in `ASTScope::unqualifiedLookup()` after
querying for the `SourceFile` containing a give source location.

Fixes rdar://137652856 and https://github.com/swiftlang/swift/issues/76944.
2024-10-10 17:24:17 -07:00
Alex Hoppen
7691569344 [SourceKit] Update completion cancellation test to a harder type checking example
https://github.com/swiftlang/swift/pull/63585 will resolve rdar://80582770 and the type checker performance problem that we were relying on. Use a harder example (stolen from https://github.com/swiftlang/swift/blob/main/unittests/SourceKit/SwiftLang/CloseTest.cpp#L131-L151), that’s unlikely to get a significant performance improvement soon.
2024-09-16 14:48:18 -07:00
Alexander Cyon
c822965379 [test/SourceKit] Revert incorrect typo changes ('CHECKD'). 2024-07-08 20:37:04 +02:00
Alexander Cyon
ba43236def Update test/SourceKit/CodeComplete/complete_typerelation.swift.identical.response
Co-authored-by: Ben Barham <b.n.barham@gmail.com>
2024-07-08 20:33:23 +02:00
Alexander Cyon
906585ba74 Update test/SourceKit/CodeComplete/complete_typerelation.swift.identical.response
Co-authored-by: Ben Barham <b.n.barham@gmail.com>
2024-07-08 20:33:17 +02:00
Alexander Cyon
44fea1f810 Update test/SourceKit/CodeComplete/complete_typerelation.swift.identical.response
Co-authored-by: Ben Barham <b.n.barham@gmail.com>
2024-07-08 20:33:10 +02:00
Alexander Cyon
27ff8b9480 Update test/SourceKit/CodeComplete/complete_typerelation.swift.convertible.response
Co-authored-by: Ben Barham <b.n.barham@gmail.com>
2024-07-08 20:33:02 +02:00
Alexander Cyon
b85054907a Update test/SourceKit/CodeComplete/complete_typerelation.swift.convertible.response
Co-authored-by: Ben Barham <b.n.barham@gmail.com>
2024-07-08 20:32:56 +02:00
Alexander Cyon
bda8314044 Update test/SourceKit/CodeComplete/complete_typerelation.swift.convertible.response
Co-authored-by: Ben Barham <b.n.barham@gmail.com>
2024-07-08 20:32:48 +02:00
Alexander Cyon
10447c32d2 [test/SourceKit] Fix typos 2024-07-06 13:28:59 +02:00
Hamish Knight
ddd1bde60e [Completion] Don’t generate USRs for local decls
Doing so can cause issues since we cannot guarantee
that e.g any parent closures have been type-checked.

rdar://128294522
2024-06-17 22:20:57 +01:00
Alex Hoppen
743d29ced3 Merge pull request #73473 from ahoppen/import-extern-c-from-bridging-header
[ClangImporter] Import `extern "C"` declarations from the bridging header
2024-05-08 15:06:30 -07:00
Alex Hoppen
9fdbb86cbd [ClangImporter] Import extern "C" declarations from the bridging header
We do iterate into extern C declarations when building the Swift lookup table during PCH generation.

0fad799f51/lib/ClangImporter/SwiftLookupTable.cpp (L2140-L2146)

However, we don’t import `extern "C"` declarations while parsing the bridging header (eg. when no `-pch-output-dir` is specified during code completion). This caused us to miss functions annotated as `extern "C"` in code completion.

rdar://127512985
2024-05-08 11:01:21 -07:00
Alex Hoppen
0c24f3f71c [Lexer] Fix an assertion failure when invoking code completion inside a single-quoted string literal
rdar://126924962
2024-05-06 15:25:00 -07:00
Alex Hoppen
7ce41252e7 [SourceKit] Print compilerargs and sourcetext keys last
That way, when the request gets truncated by os_log in sourcekit-lsp, we see most of the request. Most likely the sourcetext and the compiler args wouldn't have made it into the log message completely anyway.

rdar://121322828
2024-02-29 20:45:55 -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
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -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
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
Alexis Laferrière
8b098ab487 [Tests] Remove the flag AccessLevelOnImport from all tests but one 2023-10-10 09:09:22 -07:00
Alex Hoppen
c7e0bfae02 [IDE] Adjust test cases for migrating all completion kinds to solver-based 2023-07-07 19:51:01 +02:00
Anthony Latsis
7f6d3bcd41 ASTPrinter: Turn on explicit any printing for everything and remove the option to disable it 2023-05-13 02:55:49 +03:00
Hamish Knight
be31c22e58 Update to use --leading-lines for split-file 2023-04-26 12:38:38 +01:00
Hamish Knight
4606b14fea Refactor a couple of tests
Match the format of the spi and package variants of
these tests.
2023-04-26 12:38:38 +01:00
Hamish Knight
4e838e0a26 Serialize package and SPI doc comments in swiftsourceinfo
Previously we were using the same set of conditions
for serializing as for swiftdoc, so excluded them.
However it's reasonable to have them in the
swiftsourceinfo.
2023-04-26 12:38:38 +01:00
Ben Barham
31dee1ce1c [Completion] Only provide macro completions when they are valid
Only return macros that are valid in their current position, ie. an
attached macro is not valid on a nominal.

Also return freestanding expression macros in code block item position
and handle the new freestanding code item macros.

Resolves rdar://105563583.
2023-04-07 18:43:06 -07:00
Doug Gregor
68b367b266 Disable macros-related tests harder 2023-03-29 16:32:32 -07:00
Doug Gregor
30f17940f9 Require the Swift swift parser for a few tests affected by macros 2023-03-29 16:32:32 -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
Doug Gregor
56bf3dfa05 Update tests 2023-03-02 22:17:23 -08:00
Hamish Knight
a40f1abaff Introduce if/switch expressions
Introduce SingleValueStmtExpr, which allows the
embedding of a statement in an expression context.
This then allows us to parse and type-check `if`
and `switch` statements as expressions, gated
behind the `IfSwitchExpression` experimental
feature for now. In the future,
SingleValueStmtExpr could also be used for e.g
`do` expressions.

For now, only single expression branches are
supported for producing a value from an
`if`/`switch` expression, and each branch is
type-checked independently. A multi-statement
branch may only appear if it ends with a `throw`,
and it may not `break`, `continue`, or `return`.

The placement of `if`/`switch` expressions is also
currently limited by a syntactic use diagnostic.
Currently they're only allowed in bindings,
assignments, throws, and returns. But this could
be lifted in the future if desired.
2023-02-01 15:30:18 +00:00
Doug Gregor
5936b7b585 Add test that started crashing with my initial rework of closure discriminators.
Thanks to Alex Hoppen for providing this test!
2023-01-02 21:22:05 -08:00