Commit Graph

3976 Commits

Author SHA1 Message Date
Hamish Knight
52d8b36af4 [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 11:16:10 +01:00
Hamish Knight
352caa4ddc [Completion] NFC: Factor out addMacroCallArguments 2025-05-21 18:06:54 +01:00
Pavel Yaskevich
04d46760bb [AST] Extend @_inheritActorContext attribute to support optional always modifier
By default (currently) the closure passed to a parameter with `@_inheritActorContext`
would only inherit isolation from `nonisolated`, global actor isolated or actor
context when "self" is captured by the closure. `always` changes this behavior to
always inherit actor isolation from context regardless of whether it's captured
or not.
2025-05-14 20:07:57 -07:00
Hamish Knight
839e20b8ca [Completion] Assert we have a type in getClosureActorIsolation
Previously we could end up in cases where we pick the wrong
DeclContext in `TypeCheckASTNodeAtLocRequest` since we previously
weren't checking source ranges, which could result in skipping the
type-checking of an outer closure. Now that we correctly pick the
DeclContext, we should no longer hit that case, so we should be able
to fall into `getTypeForCompletion` and assert that the solution has
a type. Also while here let's upgrade that assert to a
`CONDITIONAL_ASSERT`.
2025-05-14 11:15:42 +01:00
Ben Barham
0bf1c1f3e1 Merge pull request #80958 from bnbarham/merge-modules
Merge exported modules with the same public name in generated interface
2025-05-05 13:49:12 -07:00
Ben Barham
ddddc667c8 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.
2025-05-02 10:59:15 -07:00
Egor Zhdan
b51cfa5c76 [cxx-interop] Remove symbolic import mode
Importing C++ class templates in symbolic mode has proven to be problematic in interaction with other compiler features, and it isn't used widely. This change removes the feature.

rdar://150528798
2025-05-02 18:43:09 +01:00
Konrad `ktoso` Malawski
3e36c42ec5 Add nonisolated(nonsending) to completion lookup
Seems we perhaps missed adding the completion for `nonsending` here?


cc @xedin
2025-04-25 19:46:30 +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
Allan Shortlidge
6daea78ccf AST: Remove AvailabilitySpec.h include from Stmt.h.
Include it where it's actually used instead to improve compile times.
2025-02-11 20:03:01 -08:00
Slava Pestov
17d8c820dc Merge pull request #79220 from slavapestov/fix-rdar143950572
AST: Source range of FuncDecl/ConstructorDecl should include the thrown type
2025-02-10 13:49:37 -05:00
Slava Pestov
a6a96da558 AST: Source range of FuncDecl/ConstructorDecl should include the thrown type
When a function declaration has a body, its source range ends at the
closing curly brace, so it includes the `throws(E)`. However, a
protocol requirement doesn't have a body, and due to an oversight,
getSourceRange() was never updated to include the extra tokens
that appear after `throws` when the function declares a thrown
error type. As a result, unqualified lookup would fail to find a
generic parameter type, if that happened to be the thrown type.

Fixes rdar://problem/143950572.
2025-02-10 09:17:40 -05:00
Michael Gottesman
7e350bb4ce Revert "[concurrency] Add Concurrent/ConcurrentUnsafe and use it instead of ActorIsolation::Nonisolated."
This reverts commit 0cb64638d0.
2025-02-06 14:05:06 -08:00