Commit Graph

3980 Commits

Author SHA1 Message Date
Hamish Knight
32f840631c [6.2] [SourceKit] Fix raw identifier handling for semantic tokens
The logic here was unnecessary, the SourceRange gets converted to a
CharSourceRange in the function being called, which handles raw
identifiers correctly. 6.2-only since this is already fixed on main.

rdar://152273926
2025-07-10 15:28:01 +01:00
Hamish Knight
c562306c8d [Completion] Downgrade a couple of ASSERTs for 6.2 2025-07-09 13:07:56 +01:00
Hamish Knight
91222b9ebe [Completion] Avoid using unbound contextual type in argument completion
Match the logic in `getTypeForCompletion` and avoid using an unbound
generic type as the expected type for a completion.

rdar://155420395
2025-07-09 13:02:32 +01:00
Hamish Knight
9671ed9d85 [Completion] Map failable initializer result type into context
Make sure we don't pass an interface type to `setTypeContext`.

rdar://155038769
2025-07-04 13:59:07 +01:00
Pavel Yaskevich
e5501d485a [AST] NFC: Capitalize UsingSpecifier::nonisolated for consistency
(cherry picked from commit 21ec5924f7)
2025-06-04 13:22:34 -07:00
Pavel Yaskevich
38ce1c230e [CodeCompletion] Implement completions in using declaration's specifier position
(cherry picked from commit 816ea9fda6)
2025-06-04 13:16:55 -07:00
Hamish Knight
6f437241f8 Merge pull request #81721 from hamishknight/macrotrail-6.2
[6.2] [IDE] Better handle macro trailing closures
2025-05-23 10:37:44 +01:00
Hamish Knight
fee6c5aee2 [Completion] Suggest trivial trailing closures for macros
Follow the same logic as function decl completion and suggest a
trailing closure for trivial cases.

rdar://150550747
2025-05-22 20:17:17 +01:00
Hamish Knight
c28d706fe6 [Completion] NFC: Factor out addMacroCallArguments 2025-05-22 20:17:17 +01:00
Pavel Yaskevich
e12201769d [AST/Sema/SIL] Implement @_inheritActorContext(always)
- Extend `@_inheritActorContext` attribute to support optional `always` modifier.
  The new modifier will make closure context isolated even if the parameter is not
  captured by the closure.
- Implementation `@_inheritActorContext` attribute validation - it could only be
  used on parameter that have `@Sendable` or `sending` and `@isolated(any)` or
  `async` function type (downgraded to a warning until future major Swift mode
  to avoid source compatibility issues).
- Add a new language feature that guards use of `@_inheritActorContext(always)` in swift interface files
- Update `getLoweredLocalCaptures` to add an entry for isolation parameter implicitly captured by `@_inheritActorContext(always)`
- Update serialization code to store `always` modifier

(cherry picked from commit 04d46760bb)
(cherry picked from commit c050e8f75a)
(cherry picked from commit c0aca5384b)
(cherry picked from commit a4f6d710cf)
(cherry picked from commit 6c911f5d42)
(cherry picked from commit 17b8f7ef12)
2025-05-22 11:32:35 -07:00
Ben Barham
d829fcf2eb Merge exported modules with the same public name in generated interface
If a module has the same `public-module-name` as the module being
generated and its import is exported, merge it into the same generated
interface.

Fix various always-imported modules from being printed while here and
update all the tests that checked for them.

Resolves rdar://137887712.

(cherry picked from commit ddddc667c8)
2025-05-02 12:52:44 -07:00
Konrad `ktoso` Malawski
8d1429ccf0 [IDE] Add nonisolated(nonsending) to completion lookup
Seems we perhaps missed adding the completion for `nonsending` here?

cc @xedin

[IDE] Tests: That that `nonisolated` has `nonsending` completion
2025-04-26 17:14:24 +09:00
Hamish Knight
bbc714d6dd [CodeComplete] Use ASTScope lookup in getStmtLabelCompletions
Use the same lookup logic that we use for regular compilation.
2025-04-02 23:09:17 +01:00
Hamish Knight
f0c38616d0 [Completion] Handle unbound generics in typealiases
The underlying type for a typealias can be an unbound generic type,
replace these with the bound generic equivalent. This avoids crashing
when attempting to compute the type relation (in the future we'll
want to open these type parameters for the comparison).

rdar://147789214
2025-04-01 20:11:48 +01:00
Anthony Latsis
631a04e56c Merge pull request #80159 from AnthonyLatsis/danaus-plexippus-5
Sema: Extend adoption mode for `AsyncCallerExecution` to storage declarations
2025-03-26 04:40:58 +00:00
Anthony Latsis
a95785c5b2 Merge pull request #80260 from AnthonyLatsis/eutrema-japonicum
DiagnosticEngine: Print the ID of the wrapped, not wrapper, diagnostic
2025-03-25 23:14:43 +00:00
Anthony Latsis
77e673a723 DiagnosticEngine: Print the ID of the wrapped, not wrapper, diagnostic 2025-03-25 02:25:39 +00:00
Anthony Latsis
3d3b1ca50a [NFC] AST: Turn getParameterList into a method on ValueDecl 2025-03-19 18:49:15 +00:00
Amritpan Kaur
978a5215d5 [Expr/AST] Add apply component to handle resolved method arguments. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
0c614e09d1 [Expr/AST] Add unresolvedApply component to handle method arguments. 2025-03-19 08:56:03 -07:00
Amritpan Kaur
811d54901b [NFC] Rename unresolvedProperty to unresolvedMember
to generalize for both properties and method members.
2025-03-19 08:53:18 -07:00
Amritpan Kaur
8f71f5c780 [NFC] Rename property to member to generalize
for both properties and method members.
2025-03-19 08:53:18 -07:00
Alex Hoppen
829e03c104 Merge pull request #79974 from a7medev/feature/complete-single-option-decl-attrs 2025-03-17 15:40:00 -07:00
Ahmed Mahmoud
c74e2710e9 [IDE] Remove invalid assertion in completeDeclAttrParam 2025-03-14 13:20:47 +02:00
Doug Gregor
0e873e723c [Isolated conformances] Change syntax to @<global actor type> P
Instead of using the `isolated P` syntax, switch to specifying the
global actor type directly, e.g.,

   class MyClass: @MainActor MyProto { ... }

No functionality change at this point
2025-03-12 23:18:10 -07:00
Ahmed Mahmoud
78b4e851a7 [IDE] Complete unowned, nonisolated, access-control parameter 2025-03-13 02:19:18 +02:00
Ahmed Mahmoud
673d6a1d9f [IDE] Rename CustomSyntaxAttributeKind to ParameterizedDeclAttributeKind 2025-03-13 02:19:17 +02:00
Tony Allevato
68876a6d4a Merge pull request #76636 from allevato/rich-identifiers
Support raw identifiers (backtick-delimited identifiers containing non-identifier characters).
2025-03-12 14:56:14 -04:00
Tony Allevato
d94bd80c62 Add support for raw identifiers.
Raw identifiers are backtick-delimited identifiers that can contain any
non-identifier character other than the backtick itself, CR, LF, or other
non-printable ASCII code units, and which are also not composed entirely
of operator characters.
2025-03-11 17:18:43 -04:00
Erik Eckstein
d225c47d25 AST: rename OpenArchetypeType -> ExistentialArchetypeType
NFC
2025-03-11 20:21:46 +01:00
Rintaro Ishizaki
002d7d7cdf [Parse/AST] Remove PoundDiagnosticDecl
There is no reson to make a AST node for '#error' and '#warning'
directives. Parser knows the diagnostics should be emitted or not.
2025-03-07 21:48:01 -08:00
Hamish Knight
9edb7f95cb Merge pull request #79790 from hamishknight/expectations
[Completion] Avoid type parameters in expected types
2025-03-07 15:48:33 +00:00
Allan Shortlidge
0bf464b272 AST: Return optional AvailabilityRange from SemanticAvailableAttr queries.
Introduction, deprecation, and obsoleteion ranges should only be returned by
the accessors on `SemanticAvailableAttr` when the attribute actually has an
affect on the corresponding kind of availability.
2025-03-06 13:02:19 -08:00
Hamish Knight
4a2c6121d4 [Completion] Avoid type parameters in expected types
There actually only appears to be a single place where we were
letting interface types into the expected type for a completion,
fix it up to use a contextual type.
2025-03-05 12:59:46 +00:00
Allan Shortlidge
437382507e IDE: Update diagnostics to take AvailabilityRange instead of VersionTuple. 2025-03-04 19:41:04 -08:00
Doug Gregor
ee2450f212 Merge pull request #79724 from DougGregor/isolated-conformances-constraint-system
Prohibit isolated conformances with Sendable(Metatype) constraints
2025-03-01 13:16:32 -08:00
Hamish Knight
3370637c14 Merge pull request #79705 from hamishknight/cursor-of-the-implicit
[IDE] Avoid inferring container type for implicit expressions
2025-03-01 12:16:35 +00:00
Allan Shortlidge
c89df2fc38 AST/Sema: Adopt AvailabilityDomain arguments in more diagnostics.
Update explicit unavailability and deprecation diagnostics to take
`AvailabiiltyDomain` instead of a platform string.
2025-02-28 13:57:00 -08:00
Doug Gregor
ffca6968ed [Isolated conformances] Diagnose conflict with isolated conformances and Sendable 2025-02-28 13:08:35 -08:00
Hamish Knight
f524691cdf [IDE] Avoid inferring container type for implicit expressions
For e.g implicit `buildExpression` calls, we have a location that
matches the argument, but we don't want to consider the result
builder type as the container type.
2025-02-28 21:00:12 +00:00
Hamish Knight
35f79e4c07 Merge pull request #79585 from hamishknight/leaps-and-bounds
[Completion] Remove uses of unbounded generic types
2025-02-27 12:38:51 +00:00
Allan Shortlidge
332d770a5c IDE: Stop requiring availability platforms to be classified as keywords. 2025-02-26 18:02:00 -08:00
Hamish Knight
8975bf6c37 [Completion] Substitute base type for nested types
Ensure we call `getTypeOfMember` for nested nominals and typealiases.
2025-02-25 14:49:13 +00:00
Hamish Knight
be0f6f9491 [Completion] NFC: Factor out getMemberBaseType() 2025-02-25 14:49:12 +00:00
Hamish Knight
f73054ad10 [Completion] Don't suggest nested type in where clause
We allow the unqualifed use of the enclosing nominal type in a where
clause, but only when it isn't a nested type, e.g:

```
struct S<T> {
  typealias T = T
  struct R<U> {
    typealias U = U
  }
}
extension S where S.T == Int {}   // allowed
extension S.R where R.U == Int {} // not allowed
```

Tweak the completion logic such that we don't suggest the type for
the nested case, instead it must be qualified.
2025-02-25 14:49:12 +00:00
Hamish Knight
0fc825b6fb [Completion] Remove uses of unbounded generic types
Ensure we always produce bounded generic type annotations and
contextual types.
2025-02-25 14:49:12 +00:00
Doug Gregor
50801f9c05 [SE-0458] Implement "unsafe" effect for the for-in loop
Memory unsafety in the iteration part of the for-in loop (i.e., the part
that works on the iterator) can be covered by the "unsafe" effect on
the for..in loop, before the pattern.
2025-02-23 22:50:39 -08:00
Slava Pestov
209e266b47 Sema: Banish UnboundGenericType from the constraint system
These should have been opened already, and the logic in
simplifyConstraint(), matchTypes(), etc is just going to do
undefined things if they end up there, so let's guard
against it happening.
2025-02-20 12:06:21 -05:00
Rintaro Ishizaki
73164a0ffd Merge pull request #79353 from rintaro/astgen-magic-ident-literal
[ASTGen] Generate MagicIdentifierLiteralExpr
2025-02-13 06:25:09 -08:00
Rintaro Ishizaki
563ddc47e2 [AST] Eliminate 'SYNTAX_KIND' from MagicIdentifierKinds.def
Nothing is using it.
2025-02-12 23:19:34 -08:00