Commit Graph

2161 Commits

Author SHA1 Message Date
Mykola Pokhylets
50b1313175 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	lib/SILGen/SILGenDistributed.cpp
#	lib/Sema/TypeCheckConcurrency.cpp
2024-08-15 16:58:43 +02:00
Alex Hoppen
bc9f3f33a5 [SourceKit] Enable Misc/embedded_no_wmo.swift 2024-08-14 11:21:37 -07:00
Becca Royal-Gordon
58ba7046c0 Merge pull request #75849 from beccadax/rebranch-modulemap
Rename module.map -> module.modulemap in tests
2024-08-13 02:17:36 -07:00
Becca Royal-Gordon
fd84e7273d Rename module.map -> module.modulemap in tests
The legacy `module.map` spelling of module map files was deprecated by llvm/llvm-project#75142 and clang expects to remove support for them in the future. Switch all tests to use the supported spelling.

Fixes rdar://128431478.
2024-08-12 17:47:26 -07:00
Kuba Mracek
30d1fe6f88 [embedded] Explicitly pass a -target in SourceKit/Diagnostics/embedded_non_wmo.swift 2024-08-12 17:43:11 -07:00
Kuba Mracek
3ad777b942 [embedded] Don't produce PerfDiags when in non-WMO mode (e.g. when building during indexing) 2024-08-10 14:48:24 -07:00
Alex Hoppen
8edb57c756 Merge pull request #75667 from ahoppen/build-issues-live-issues
[Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
2024-08-07 17:24:47 -07:00
Alex Hoppen
66104395d7 [Sema/SourceKit] Emit same diagnostics for missing protocol requirements on the command line and in SourceKit
Some editors use diagnostics from SourceKit to replace build issues. This causes issues if the diagnostics from SourceKit are formatted differently than the build issues. Make sure they are rendered the same way, removing most uses of `DiagnosticsEditorMode`.

To do so, always emit the `add stubs for conformance` note (which previously was only emitted in editor mode) and remove all `; add <something>` suffixes from notes that state which requirements are missing.

rdar://129283608
2024-08-07 14:01:30 -07:00
Alex Hoppen
000298cbc7 [Macros] Test adjustment because we no longer trim whitespace from macro expansions
Companion of https://github.com/swiftlang/swift-syntax/pull/2776
2024-08-07 09:14:49 -07:00
Alex Hoppen
eec3d752cb Inherit doc comments from default implementations of inherited protocols
For example when we have

```swift
protocol BaseProtocol {}

extension BaseProtocol {
  /// Say hello
  func hello() { }
}
struct MyStruct: BaseProtocol {
  func hello() {}
}
```

Then `MyStruct.hello` should inherit the doc comment from the implementation of `BaseProtocol.hello`. Currently no doc comment is associated with `MyStruct.hello`.

rdar://126240546
2024-08-02 11:26:51 -07:00
Alex Hoppen
c5e201dd07 Merge pull request #75490 from ahoppen/swiftparser-on-deep-stack
[SourceKit] Run SwiftParser on a deep stack for the related identifiers request
2024-07-29 15:52:43 -07:00
Alex Hoppen
3bffa7970d [SourceKit] Run SwiftParser on a deep stack for the related identifiers request
We ran SwiftParser in `handlePrimaryAST` for related identifiers. That function is called on a dispatch queue with reduced stack size and could cause the parser to stack overflow if the program is very nested.

Run `handlePrimaryAST` on a deep stack for this request to fix the issue.

rdar://129960285
2024-07-25 16:57:08 -07:00
Allan Shortlidge
ecc1a2de2c Tests: Drop maccatalyst_support requirement for several tests.
As much as possible, we should avoid using `REQUIRES: maccatalyst_support`
since tests restricted this way are not run in PR tests. Many tests that
exercise macCatalyst behaviors can be run in a macOS configuration, without
full macCatalyst standard library support.

Also, adopt `%target-cpu` lit substitution where appropriate to avoid needless
standard library module rebuilds when running tests locally.
2024-07-19 17:02:28 -07:00
Alex Hoppen
8d236de2c2 Merge pull request #75027 from Sajjon/cyon_typo_batch__test__SourceKit
Typos: `test/SourceKit`
2024-07-18 13:42:33 -07:00
Alexander Cyon
64466cd8b8 Update error_swift_module.swift
Co-authored-by: Alex Hoppen <alex@alexhoppen.de>
2024-07-18 08:11:33 +02:00
Mykola Pokhylets
816d62c972 Merge remote-tracking branch 'upstream/main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/SILGen/SILGenDestructor.cpp
#	test/Concurrency/flow_isolation.swift
#	test/abi/macOS/arm64/concurrency.swift
#	test/abi/macOS/x86_64/concurrency.swift
2024-07-11 13:11:59 +02:00
Mykola Pokhylets
9dcea15d21 Fixed tests on Linux, Windows and older MacOS versions 2024-07-11 13:09:07 +02:00
Mykola Pokhylets
62dbc6c966 Fixed some tests. Using extract_executor SIL instruction instead of custom code. 2024-07-11 13:09:06 +02:00
Slava Pestov
d1847ffde7 Merge pull request #75068 from slavapestov/simplify-sub-map
Simplify and optimize SubstitutionMap
2024-07-10 20:45:56 -04:00
Slava Pestov
26fffae30a AST: Simplify SubstitutionMap representation
There was a bunch of logic to lazily populate replacement types
corresponding to reducible generic parameters. This didn't seem
to have a clear purpose so let's remove it.
2024-07-10 13:28:26 -04:00
Hamish Knight
15bb0616ff Merge pull request #74974 from hamishknight/solvar
[CursorInfo] Resolve solver-based in VarDecls
2024-07-10 01:54:24 +01: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
f26d1e7bd3 [Index] Mark accessors as implicit in modules
These won't have bodies in generated interfaces,
and generally aren't useful things to jump to. The
property ought to be used instead.

rdar://130775560
2024-07-05 16:28:33 +01:00
Hamish Knight
9da87d1b1c [CursorInfo] Resolve solver-based in VarDecls
Previously we would skip resolving any solver-based
cursor info in a VarDecl accessor as the VarDecl
source range does not encompass the AccessorDecl.
Avoid looking at the VarDecl source range in this
case.

rdar://131135631
2024-07-04 22:49:46 +01:00
Erik Eckstein
9360c76cd8 Fix a SourceKitCrash in the VTableSpecializer pass
Replace the assert-check if a vtable is available with a regular error message.
This cannot occur in regular builds - only if built with embedded swift and without wmo.
The command line compiler prevents this combination, but it  can happen in SourceKit.

rdar://130167087
2024-07-03 17:13:53 +02:00
Hamish Knight
eeced060fa [Parse] Handle #if in brace skipping logic
Previously we would strictly match `{` + `}`, but
that ignored the fact that when parsing we consider
`#if` + `#endif` to be a stronger delimiter than
`{` + `}`, so can ignore a stray `}` in a `#if`.
Update the logic to also track opening and closing
`#if` decls, ignoring any braces that happen within
them.

rdar://129195380
2024-06-19 21:39:40 +01:00
Hamish Knight
fe8289c516 Merge pull request #74479 from hamishknight/no-completion-usr-for-local
[Completion] Don’t generate USRs for local decls
2024-06-18 01:26:10 +01: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
Hamish Knight
5ec4d1cc98 [CS] Fill in ErrorTypes for expressions that fail to type-check
Ensure we always produce typed AST, even if we
fail to apply a solution. This fixes a cursor info
issue where we'd to type-check a closure twice
due to it not having a type set.

rdar://129417672
2024-06-17 17:58:52 +01:00
Slava Pestov
b14563f8e8 Merge pull request #74201 from slavapestov/macro-expansion-mangling
Change macro expansion mangling to avoid request cycles
2024-06-14 01:41:45 -04:00
Slava Pestov
9793f77daa AST: New mangling for expansion locations to avoid request cycles
Fixes rdar://127078338.
2024-06-13 17:45:30 -04:00
Alex Hoppen
f5d15f4f60 Merge pull request #74241 from ahoppen/enum-case-rename
Fix renaming enum case parameters with unnamed associated arguments
2024-06-12 14:46:46 -07:00
Alex Hoppen
155773c38e Fix renaming enum case parameters with unnamed associated arguments
We treated enum case parameters the same way as function parameters and weren’t considering that they can be unlabeled. That caused us to insert eg. `_ ` in front of the case’s type, producing `case myCase(_ String)`, which is invalid. When we are inside an enum case parameter and the parameter label is empty, treat it the same as a function call, which will leave the label untouched if it isn’t modified and insert a label including a colon if a new label is introduced.

https://github.com/apple/sourcekit-lsp/issues/1228
2024-06-11 19:18:59 -07:00
Hamish Knight
d98cb9e2b3 [Mangler] Mangle function type for invalid enum element
Previously we would mangle a single ErrorType as
the type for the element, but that would fail to
demangle since we expect a function type. Use the
same logic as AbstractFunctionDecl, mangling a
function type of ErrorType. While here, also
handle SubscriptDecls and check for error types
rather than `isInvalid()`.

rdar://129065620
2024-06-11 21:24:11 +01:00
Alex Hoppen
2e3d42ee0a Merge pull request #74080 from ahoppen/dynamic-cursor-info-on-decl
[SourceKit] Mark overridable declarations as dynamic
2024-06-03 09:37:45 -07:00
Alex Hoppen
a38e7cce49 [SourceKit] Mark overridable declarations as dynamic
We only set `isDynamic` to `true` if we were inside an expression. Also set `isDynamic` when we are performing cursor info at an overridable declaration. This allows jump-to-definition to jump to declarations that override the one that we performed cursor info on.

rdar://128300752
2024-06-01 22:59:38 -07:00
Alex Hoppen
ccdd62038a [SourceKit] Don’t set DisableModulesValidateSystemDependencies to true
It appears that a6ebd3083d changed the behavior of `-fno-modules-validate-system-headers` (aka. `DisableModulesValidateSystemDependencies`) in conjunction with `-fmodules-validate-once-per-build-session`: Before that change, `-fno-modules-validate-system-headers` needed to be passed for `-fmodules-validate-once-per-build-session` to have any effect (we were always validating system dependencies if `-fno-modules-validate-once-per-build-session` was not set). After the change, `-fno-modules-validate-once-per-build-session` causes system dependencies to never be validated, independent of the build session timestamp.

This change should have no effect on Xcode because it adds `-fmodules-validate-system-headers` to the compiler arguments for Swift files, which overrides `SearchPathOpts.DisableModulesValidateSystemDependencies = true;`
2024-05-31 16:00:26 -07:00
Doug Gregor
2388acdfd3 [SE-0415] Enable function body macros by default
Preamble macros are *not* part of the revised SE-0415, so leave them
experimental.

Tracked by rdar://119687390.
2024-05-20 22:08:33 -07:00
Pavel Yaskevich
b3ea46a955 Merge pull request #73314 from saehejkang/update-c-style-for-stmt-removed-string
[Diagnostics-Qol]: Update c_style_for_stmt_removed error string
2024-05-16 23:57:33 -07:00
Alex Hoppen
39886be6a3 Merge pull request #73468 from ahoppen/related-idents-of-invalid-decls-with-same-base-name
[RelatedIdents] Fix an assertion failure if two invalid declarations have the same base name
2024-05-08 15:25:25 -07: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
1a67c61d19 [RelatedIdents] Fix an assertion failure if two invalid declarations have the same base name
For example, the following declarations have the same USR with a single ERROR_TYPE parameter despite being distinct declarations.

```swift
func bar(body: Invalid) {}
func bar(ignoreCase: Bool, body: Invalid) {}
```

We originally intended to check the USR so that local rename behaves more like global rename, which also looks symbols up by USR. But the above example proves that assumption wrong.

rdar://126803702
2024-05-07 18:17:11 -07:00