Commit Graph

2171 Commits

Author SHA1 Message Date
swift-ci
763c61f92f Merge remote-tracking branch 'origin/main' into rebranch 2024-08-30 18:13:35 -07:00
Jim M. R. Teichgräber
f2e57d8c76 [SourceKit] Add optional declarations array to interface gen request (#75802)
Introduces the new DeclarationsArrayBuilder and adds it to the
EditorConsumer. Declaration info always includes a kind, offset, and
length, and includes a USR where applicable.
As the USR is already available for editor.open.interface type requests,
this doesn't compute any new information, it just exposes more of what's
there already.
2024-08-30 18:04:12 -07:00
swift-ci
1c7d7d56c9 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-29 20:14:36 -07:00
Doug Gregor
6a310074c4 Ensure that the source buffer passed to #if evaluation contains the condition
The implementation of `#if` configuration evaluation assumed that the
SourceFile instance within the `Parser` contained all of the source ranges
for code parsed within that `Parser` instance. This is not always the case,
so avoid using the SourceFile directly and instead use the source buffer
that directly contains the condition.

Fixes https://github.com/swiftlang/swift/issues/76137. Big thank you
to Alex Hoppen and the stress tester for finding this.
2024-08-29 14:31:48 -07:00
Mykola Pokhylets
e0ad7bde82 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/AST/ASTPrinter.cpp
#	lib/AST/FeatureSet.cpp
2024-08-29 11:28:43 +02:00
swift-ci
bf588f0b48 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-20 23:14:01 -07:00
Mishal Shah
3ac0dff27d Bump the Swift version to 6.1 2024-08-19 23:09:31 -07:00
swift-ci
c19582ba53 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-16 21:34:46 -07:00
Alex Hoppen
d47c50e1a7 Merge pull request #75741 from ahoppen/indent-no-format
[Macros] Test adjustment because we no longer trim whitespace from macro expansions
2024-08-16 21:26:50 -07:00
Alex Hoppen
21070b5770 Merge pull request #75888 from ahoppen/enable-test
[SourceKit] Enable `Misc/embedded_no_wmo.swift`
2024-08-16 21:25:39 -07:00
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