Commit Graph

4076 Commits

Author SHA1 Message Date
Slava Pestov
7cd06a5088 Sema: Split off TypeVariableType.h/.cpp 2026-02-05 09:19:01 -05:00
Kavon Farvardin
4a7cedcf1e Reparenting: introduce new attributes
A protocol that's been reparented declares it
by writing `@reparented` in its inheirtance clause
for each new parent. You can introduce a `@reparented`
parent to a pre-existing ABI-stable protocol's
inheritance hierarchy.

Only protocols declared to be  `@reparentable` can be
used to reparent other protocols. Adding or removing
the `@reparentable` attribute is ABI-breaking, as it
effects the type metadata layout. Thus, reparentable
protocols must be born as such to use them with
protocols that are already ABI-stable.

This set of changes does not include the actual
implementation of ABI-stable reparenting.
2026-02-03 16:39:19 -08:00
Elsa Keirouz
f7c21941b8 [AST] ForEachStmt: rename sequence getter/setter 2026-01-23 15:17:29 +00:00
Elsa Keirouz
d54a572f7f [Sema] desugar ForEachStmt at AST level 2026-01-23 15:17:29 +00:00
Ian Leitch
2d803ef3d2 [IDE] Reference appendInterpolation calls in string interpolation (#86166)
Fix missing references to `appendInterpolation` functions called
implicitly in string interpolations.

Fixes #56189
2026-01-10 19:45:44 -08:00
Ian Leitch
bbeac5b8c2 [Index] Fix incorrect setter references for subscript keys (#86119)
Properties used as subscript keys (e.g., `dictionary[key] = 42`) were
incorrectly indexed as writes, referencing setters instead of getters.
Fix by forcing subscript arguments to be treated as reads, except for
dynamic member lookup subscripts where the argument represents the
member being accessed.

Resolves #56541
2026-01-10 17:34:33 -08:00
Rintaro Ishizaki
dffd88ee51 [Parser] Eliminate 'CommentRetentionMode::None' in Lexer
Lexer should always set `Token.CommentLength` correctly because it
necessary for restoring to the token position with comments.
Otherwise, 'Token::isAtStartOfLine()' might not correctly set.
2025-12-10 10:10:51 -08:00
Pavel Yaskevich
d8549ec6da Merge pull request #85501 from xedin/prevent-printModuleInterface-from-printing-extensions-twice
[IDE] Avoid printing some Swift extensions twice in mixed source fram…
2025-11-14 07:12:27 -08:00
Pavel Yaskevich
700d9fd669 [IDE] Avoid printing some Swift extensions twice in mixed source frameworks
`printModuleInterfaceDecl` printes extensions right after the type
they are associated with is printed. Extensions associated with a
type that appears in the "target" module shouldn't be added to
`SwiftDecls` because that would lead to double printing them.
2025-11-13 15:03:35 -08:00
Slava Pestov
819738c83e AST: Rename mapTypeIntoContext() => mapTypeIntoEnvironment(), mapTypeOutOfContext() => mapTypeOutOfEnvironment() 2025-11-12 14:48:19 -05:00
Anthony Latsis
bda6edb85c AST: Rename GenericContext::isGeneric to hasGenericParamList
`isGeneric` is a misleading name because this method checks for the
existence of a `GenericParamList`, which is not implied by genericity.
2025-11-11 15:55:16 +00:00
Allan Shortlidge
9b7c531fd8 AST/IDE/Sema: Remove unnecessary AvailabilityInference.h includes.
NFC.
2025-10-24 16:14:49 -07:00
Hamish Knight
364eba482d [AST] Use CustomAttr's DeclContext for ResolveMacroRequest
Remove the DeclContext parameter from ResolveMacroRequest, we can now
retrieve the DeclContext either from the CustomAttr or macro expansion
expr/decl directly.
2025-10-16 11:21:54 +01:00
Becca Royal-Gordon
60b3b088d5 Merge pull request #84358 from beccadax/common-concurrency 2025-10-07 12:21:50 -07:00
Hamish Knight
5171b84dba [CS] Replace UnresolvedType with ErrorType in simplifyType/resolveType
This means we now either produce a bare ErrorType, or an ErrorType
with a generic parameter original type for a generic parameter hole.
We ought to further consolidate this logic by sinking the generic
parameter original type replacement into `simplifyType` itself, but
I'm leaving that for a future patch since it affects completion
results and I want to try keep this close to NFC.
2025-10-03 09:50:42 +01:00
Becca Royal-Gordon
3abbfaa9cb Introduce separately-imported stdlib overlays
The `_Concurrency` and `_StringProcessing` modules are implementation details of the standard library; to developers, their contents should behave as though they are declared directly within module `Swift`. This is the exact same behavior we expect of cross-import overlays, so treat these modules as though they are cross-import overlays with no bystanding module.

Because these modules don’t re-export the standard library, it’s also necessary to treat `Swift` as a separately imported overlay of itself; do so and make that actually work.
2025-10-02 12:05:12 -07:00
swift-ci
499f4ff714 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-29 06:15:20 -07:00
Hamish Knight
a7dd04ed6f Merge pull request #84403 from a7medev/refactor/signature-help-to-ide
[IDE] Move signature help formatting to IDE instead of SourceKit
2025-09-29 14:05:02 +01:00
Ahmed Mahmoud
6f6b9d8a61 [IDE] Simplify createSignatureString parameters 2025-09-26 22:39:46 +03:00
swift-ci
6b28979fb4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-25 16:24:58 -07:00
Allan Shortlidge
2467b931a7 ConstraintSystem: Move key path type utilities to AST. 2025-09-25 07:13:17 -07:00
swift-ci
06fb7384ce Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 03:14:56 -07:00
Hamish Knight
14a125c2ca [IDE] Use consistent PrintOptions in swift-ide-test
Use the same set of PrintOptions when printing the results for
different requests.
2025-09-21 23:19:06 +01:00
Ahmed Mahmoud
0b123340ba [IDE] Move CodeCompletionStringBuilder.h to lib/IDE 2025-09-19 21:24:30 +03:00
Ahmed Mahmoud
2f6064675e [IDE] Move signature help formatting to IDE instead of SourceKit 2025-09-19 18:24:57 +03:00
swift-ci
781d0fdfd9 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-11 08:37:41 -07:00
Hamish Knight
9beb2e3e36 [Completion] Simplify opened function type in tryResolveDoubleAppliedFunction 2025-09-11 10:31:46 +01:00
swift-ci
95736f8e88 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-10 01:39:11 -07:00
Hamish Knight
d3be024a54 [IDE] Introduce ReadyForTypeCheckingCallback
This avoids the layering violation of calling `bindExtensions` from
parser code.
2025-09-09 23:18:52 +01:00
Hamish Knight
92f2acaa67 [IDE] Remove redundant extension binding logic
I missed this in my previous patch that moved extension binding until
after we've mutated the AST for IDE inspection, this ad-hoc extension
binding logic is no longer necessary.
2025-09-09 23:18:52 +01:00
Anthony Latsis
e1450e011e Manually merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
*	utils/build_swift/build_swift/defaults.py
2025-09-04 14:07:50 +01:00
Ahmed Elrefaey
9d1436c1c8 [IDE] [Signature Help] Add basic signature help request to SourceKit (#83378) 2025-09-04 10:09:02 +01: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
swift-ci
35ae6d8866 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-01 03:14:00 -07:00
Hamish Knight
0c3be92c10 Merge pull request #83652 from a7medev/feat/generalize-erase-archetypes
[IDE] Erase archetypes without declaration generic signature
2025-09-01 11:01:54 +01:00
swift-ci
69e3469a9f Merge remote-tracking branch 'origin/main' into rebranch 2025-08-31 03:55:05 -07:00
Hamish Knight
d7fea157a1 [IDE] Remove fallback type-checking logic
This should no longer be necessary, rip it out.
2025-08-30 14:08:42 +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
swift-ci
5ed4b2a070 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-28 13:06:19 -07:00
Hamish Knight
44ba366759 Merge pull request #83662 from hamishknight/unqualified-fallback
[Completion] Fall back to unqualified lookup on solver failure
2025-08-28 20:39:11 +01:00
swift-ci
9a46a42e72 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-28 11:35:27 -07:00
Hamish Knight
4f010f0fc7 Merge pull request #83646 from a7medev/refactor/extract-code-completion-string-builder
[IDE] [Signature Help] Extract primitive `CodeCompletionString` creation into `CodeCompletionStringBuilder`
2025-08-28 19:35:21 +01:00
swift-ci
68a3d56c8d Merge remote-tracking branch 'origin/main' into rebranch 2025-08-28 05:15:09 -07:00
Hamish Knight
0eae70cd84 Merge pull request #83961 from hamishknight/null-and-void
[IDE] Use `nullableTypesEqual` in `AfterPoundExprCompletion::sawSolutionImpl`
2025-08-28 13:06:53 +01:00
swift-ci
591d0502e6 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-28 04:15:50 -07:00
Hamish Knight
4aeb7e1b52 [IDE] Use nullableTypesEqual in AfterPoundExprCompletion::sawSolutionImpl
Avoid crashing if we can't compute the expected type.
2025-08-28 00:33:54 +01:00
Hamish Knight
7e22297b71 [AST] Walk ErrorExpr's original expr in ASTWalker
We set an original expression on ErrorExpr for cases where we have
something semantically invalid that doesn't fit into the AST, but is
still something that the user has explicitly written. For example
this is how we represent unresolved dots without member names (`x.`).
We still want to type-check the underlying expression though since
it can provide useful diagnostics and allows semantic functionality
such as completion and cursor info to work correctly.

rdar://130771574
2025-08-27 15:27:06 +01:00
Ahmed Mahmoud
ec1b146581 [IDE] Move CodeCompletionString building into CodeCompletionStringBuilder
[IDE] Move primitive completion function label into CodeCompletionStringBuilder

[IDE] NFC: Remove unneeded string builder methods on CodeCompletionResultBuilder

[IDE] Move addValueBaseName into CodeCompletionStringBuilder

[IDE] Make CodeCompletionResultBuilder a CodeCompletionStringBuilder

[IDE] Explicitly pass DeclContext in CodeCompletionStringBuilder

[IDE] Reduce includes in CodeCompletionStringBuilder.h
2025-08-27 00:40:20 +03:00
Hamish Knight
a63ab6d161 [Completion] Fall back to unqualified lookup on solver failure
Even if the solver fails we can still do an unqualified lookup without
a contextual type.
2025-08-25 11:13:40 +01:00
swift-ci
3181aeff9a Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 06:35:33 -07:00