Commit Graph

3993 Commits

Author SHA1 Message Date
Doug Gregor
24a12ebc34 Renable GeneratedSourceInfo::Attribute to GeneratedSourceInfo::AttributeFromClang 2024-11-15 09:02:49 -08:00
Doug Gregor
989c73d014 Ensure that buffers containing Clang swift_attr attributes are parsed as attributes
Previously, they were being parsed as top-level code, which would cause
errors because there are no definitions. Introduce a new
GeneratedSourceInfo kind to mark the purpose of these buffers so the
parser can handle them appropriately.
2024-11-13 21:19:37 -08:00
Hamish Knight
27995eed19 [Completion] Type-check parent closures for local functions
Local functions can capture variables from parent
closures, so we need to make sure we type-check
parent closures when doing completion in a local
function. Ideally we ought to be able to be more
selective about the elements of the parent closure
that we type-check, but that's a more complex change
I'm leaving as future work for now.
2024-11-11 19:34:21 +00: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
Rintaro Ishizaki
d4db99ce9d [Parse] Remove unnecessary dependencies to Parser.h
C++ swift::Parser is going to be replaced with SwiftParser+ASTGen.
Direct dependencies to it should be removed. Before that, remove
unnecessary '#include "swift/Parse/Parser.h"' to clarify what actually
depends on 'swift::Parser'.

Split 'swift::parseDeclName()' et al. into the dedicated files.
2024-11-02 01:23:59 -07:00
Hamish Knight
9ca1157a07 Add cache for USRBasedTypeContext::typeRelation
This brings the time taken for the cached completion:

```
import SwiftUI

Table(#^CC^#
```

down from ~400ms to ~190ms.
2024-10-31 15:42:30 +00:00
Hamish Knight
1a62f36a3a Eliminate recursion from USRBasedType::typeRelation
Use a worklist instead, and bump the size of the
inline set storage. This shaves ~30ms off the
time it takes to do this cached completion:

```
import SwiftUI

Table(#^CC^#
```
2024-10-31 15:42:30 +00:00
Alex Hoppen
2c1ada6f71 Merge pull request #77312 from ahoppen/common-in 2024-10-30 22:13:54 -07:00
Alex Hoppen
73bb2a516e [CodeCompletion] Mark in keyword in closure signatures as CommonKeyword
rdar://138255761
2024-10-30 17:07:22 -07:00
Hamish Knight
499fe6dc48 Merge pull request #77072 from hamishknight/complete-options
[IDE] Pass LangOptions to `ide::isSourceInputComplete`
2024-10-30 20:17:47 +00:00
Ben Barham
f59b2f19e6 Merge branch 'main' into 2024-rebranch-to-main 2024-10-28 13:03:35 -07:00
Slava Pestov
f751d500bf IDE: Fix my own lazyness in SynthesizedExtensionAnalyzer::Implementation::isApplicable()
This routine was never properly updated to handle layout requirements, conditional conformances,
or parameter packs. Let's clear out the FIXMEs and do things properly here.

Fixes https://github.com/swiftlang/swift/issues/76561
2024-10-25 16:09:22 -04:00
Hamish Knight
b840730958 [IDE] Pass LangOptions to ide::isSourceInputComplete
Ensure we account for things like the enablement
of bare slash regex literals.
2024-10-17 14:04:34 +01:00
swift-ci
6b97d95914 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-04 05:01:45 -07:00
Tony Allevato
9eebcbc15e Merge pull request #76815 from allevato/index-closure-attrs
[Index] Record references to global actors in closures and function types.
2024-10-04 07:43:51 -04:00
Tony Allevato
556ab4561b [Index] Record references to global actors in closures and function types. 2024-10-03 16:12:28 -04:00
swift-ci
1f068d3d0b Merge remote-tracking branch 'origin/main' into rebranch 2024-09-30 22:33:31 -07:00
Allan Shortlidge
fb86a721a6 AST: Remove default argument from ModuleDecl::getImportedModules(). 2024-09-30 10:31:43 -07:00
swift-ci
ae4fee5d4e Merge remote-tracking branch 'origin/main' into rebranch 2024-09-19 13:54:31 -07:00
Doug Gregor
5b2520e379 Remove IfConfigDecl from the AST
The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
2024-09-18 20:51:54 -07:00
swift-ci
ed74391004 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-18 12:41:02 -07:00
Alex Hoppen
6ab4f36986 Merge pull request #76441 from vincentisambart/macro-decl-format
[SourceKit] Format macro decl without crashing
2024-09-18 12:25:09 -07:00
swift-ci
5039a2d86c Merge remote-tracking branch 'origin/main' into rebranch 2024-09-18 10:55:29 -07:00
Doug Gregor
49aa0e966f Ensure that SourceFiles always have a backing buffer in the SourceManager
The "buffer ID" in a SourceFile, which is used to find the source file's
contents in the SourceManager, has always been optional. However, the
effectively every SourceFile actually does have a buffer ID, and the
vast majority of accesses to this information dereference the optional
without checking.

Update the handful of call sites that provided `nullopt` as the buffer
ID to provide a proper buffer instead. These were mostly unit tests
and testing programs, with a few places that passed a never-empty
optional through to the SourceFile constructor.

Then, remove optionality from the representation and accessors. It is
now the case that every SourceFile has a buffer ID, simplying a bunch
of code.
2024-09-16 21:46:42 -07:00
swift-ci
22caa59910 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-16 20:34:39 -07:00
Doug Gregor
4c4a70f042 Remove unused shouldWalkInactiveConfigRegion 2024-09-16 16:30:57 -07:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Vincent Isambart
a48ff77a75 Format macro decl without crashing 2024-09-13 14:38:19 +09:00
Allan Shortlidge
da14b3c83c IDE: Remove dead code in SyntaxModel.cpp. 2024-09-11 16:42:47 -07:00
Dmitrii Galimzianov
a8b71ea97f Add -print-diagnostic-groups flag
This change adds the `-print-diagnostic-groups` flag as described by SE-0443.
2024-09-11 13:34:42 +02:00
Doug Gregor
8ec800d35e Remove bespoke handling of IfConfigDecl within code formatting
The SourceKit code formatting tools have effectively been replaced
by swift-syntax's basic formatting functionality and more full-featured
formatters like swift-format and SwiftFormat. Remove the special
handling of IfConfigDecl as staging for the removal of IfConfigDecl.
2024-09-07 21:48:18 -07:00
Doug Gregor
9936f64c2a Ignore inactive IfConfigDecls in SourceKit's syntax model
Clients that need syntactic information should use SourceKit-LSP or
swift-syntax.
2024-09-07 21:36:39 -07:00
swift-ci
f624072420 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-29 03:33:30 -07:00
Hamish Knight
4987c3b970 Merge pull request #76122 from hamishknight/platform-2
[AST] Account for non-user modules in `isPrivateStdlibDecl`
2024-08-29 11:25:54 +01:00
swift-ci
87196fd210 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-28 13:32:49 -07:00
Hamish Knight
1cb0f8fdd5 [AST] Rename isPrivateStdlibDecl -> isPrivateSystemDecl
This better reflects what we're actually checking
here.
2024-08-28 18:31:51 +01:00
Hamish Knight
3c16ecf568 [Sema] Remove preCheckExpression
There are only a couple of clients left using this,
migrate them onto `preCheckTarget`.
2024-08-28 15:09:40 +01:00
swift-ci
b08f7a1307 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-20 13:58:19 -07:00
Slava Pestov
0c2f28fd3d AST: Remove GenericSignature parameter from OpenedArchetypeType::get() 2024-08-20 12:15:27 -04:00
swift-ci
97eaf355ae Merge remote-tracking branch 'origin/main' into rebranch 2024-08-19 18:34:33 -07:00
Slava Pestov
9a5408c571 IDE: Remove a usage of ArchetypeType::getRoot() 2024-08-19 16:55:11 -04:00
swift-ci
a5ec343a08 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-17 06:14:34 -07:00
Slava Pestov
0e853a358e Merge pull request #75935 from slavapestov/remove-transform
AST: Replace remaining uses of Type::transform() with transformRec()
2024-08-17 09:11:52 -04:00
swift-ci
f445b8e95a Merge remote-tracking branch 'origin/main' into rebranch 2024-08-12 18:17:04 -07:00
Alex Hoppen
bdc6fc60d2 Merge pull request #75666 from ahoppen/share-is-static
[IDE] Call into `matchWitnessStructure` to check if we should inherit a comment from an overridden declaration
2024-08-12 18:02:56 -07:00
Slava Pestov
b601c294ac AST: Replace remaining uses of Type::transform() with transformRec() 2024-08-12 16:05:43 -04:00
Ben Barham
467e528200 Merge remote-tracking branch 'origin/main' into manual-rebranch-merge
Conflicts:
  - `lib/Serialization/ModuleFormat.h` bumped version to account for
    differences between main and rebranch.
2024-08-09 15:22:39 -07:00
Alex Hoppen
3ed457ab3b [Sema] Move getDocCommentProvidingDecl and getCascadingDocComment from AST to Sema
This allows use to re-use logic from Sema in those requests.

This commit just moves functions around and does not change any functionality.
2024-08-09 11:38:26 -07:00
Slava Pestov
375363a473 AST: Move global conformance lookup entry points to ConformanceLookup.h 2024-08-08 23:35:58 -04:00
swift-ci
1ec21e989a Merge remote-tracking branch 'origin/main' into rebranch 2024-08-02 14:15:56 -07:00