Commit Graph

1958 Commits

Author SHA1 Message Date
Anton Korobeynikov
797f500286 Add basic boilerplate for AST coroutines and yields 2025-11-12 21:02:25 -08:00
Anthony Latsis
8992ea82a2 Merge pull request #85433 from swiftlang/jepa-main4
AST: Rename `GenericContext::isGeneric` to `hasGenericParamList`
2025-11-11 21:12:34 +00: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
Hamish Knight
33e6c0fb6c [AST] Also cache protocol kind in getBuiltinInitDecl
Make sure we don't return the wrong witness if you query with 2
different builtin protocol kinds.
2025-11-10 15:57:33 +00:00
Hamish Knight
92e5e7b5b7 [AST] Remove asserts from getBuiltinInitDecl
Allow querying for types that may not conform. Failures here should
be asserted downstream (e.g in `setBuiltinInitializer`).
2025-11-10 15:57:33 +00:00
Joe Groff
e002d96ac9 Merge pull request #85169 from jckarter/builtin-generic-base-class
Add a BuiltinGenericType base class.
2025-10-31 12:45:58 -07:00
Becca Royal-Gordon
393965090e Merge pull request #34556 from beccadax/mod-squad-2
[SE-0491] Implement lookup and diagnostics for module selectors (MyMod::someName)
2025-10-28 16:00:26 -07:00
Joe Groff
cf5f7c8637 Add a BuiltinGenericType base class.
Builtin.FixedArray was introduced as the first generic builtin type, with
special case handling in all the various recursive visitors. Introduce
a base class, and move the handling to that base class, so it is easier
to introduce other generic builtins in the future.
2025-10-28 12:48:18 -07:00
Becca Royal-Gordon
64d8b70942 Make DeclNameRef able to store a module selector
In this commit, this change affects certain diagnostics but doesn’t actually alter name lookup behavior yet.
2025-10-24 16:23:33 -07:00
Adrian Prantl
c91211a5d2 Serialize explicit module dependencies in swift module files
For clients, such as the debugger, who do not have access the full
output of the dependency scanner, it is a huger performance and
correctness improvement if each explicitly built Swift module not just
serialized all its Clang .pcm dependencies (via the serialized Clang
compiler invocation) but also its direct Swift module dependencies.

This patch changes the Swift module format to store the absolute path
or cas cache key for each dependency in the INPUT block, and makes
sure the deserialization makes these available to the ESML.

rdar://150969755
2025-10-21 09:08:58 -07:00
Allan Shortlidge
3151bcb1d8 Merge pull request #84943 from tshortli/silgen-swift-runtime-availability
stdlib/SILGen: Emit SIL for Swift runtime availability queries
2025-10-16 15:08:09 -07:00
Hamish Knight
73710e3eef [AST] Introduce Decl::addAttribute
Introduce a convenience entrypoint that also calls `attachToDecl` on
the attribute, and migrate all existing uses of `getAttrs().add` onto
it.
2025-10-16 11:21:54 +01:00
Allan Shortlidge
085f8ecca9 stdlib/SILGen: Emit SIL for Swift runtime availability queries.
When emitting SIL for `if #available(Swift ..., *)` queries, call the new
`_isSwiftRuntimeVersionAtLeast()` function in the stdlib to check the
condition. To support back deployment, the implementation of
`_isSwiftRuntimeVersionAtLeast()` is `@_alwaysEmitIntoClient` and performs its
comparison against the result of `_SwiftStdlibVersion.current`, which is
pre-existing ABI that the stdlib exposes for querying the Swift runtime
version.

Resolves rdar://162726037.
2025-10-15 22:42:53 -07:00
Hamish Knight
a83ea3c8bb Merge pull request #84745 from hamishknight/fishmonger
[Evaluator] Enforce consistent results for cyclic requests
2025-10-09 17:08:04 +01:00
Hamish Knight
48ac5126d9 [AST] Fold away nested ErrorTypes
Remove the now-unnecessary hack where we could build recursive
ErrorTypes.
2025-10-08 21:16:02 +01:00
Hamish Knight
e7c7239587 [Sema] Insert ErrorType same-type constraints for placeholder signatures
This helps avoid producing more downstream errors. This changes
`GenericSignature::forInvalid` to produce the same signature as e.g
`<T where T == Undefined>`. This subsumes the need to introduce
conformance requirements for invertible protocols.
2025-10-08 21:16:02 +01:00
Hamish Knight
f7e459a9b5 [AST] Factor out GenericSignature::forInvalid
Factor out the common logic from `getPlaceholderGenericSignature`.
2025-10-08 21:16:02 +01:00
Slava Pestov
8cf491f825 AST: Allow non-canonical opaque archetypes 2025-10-08 15:15:50 -04:00
Slava Pestov
0d90b62491 AST: Clean up in preparation for non-canonical archetypes 2025-10-08 15:15:43 -04:00
Becca Royal-Gordon
60b3b088d5 Merge pull request #84358 from beccadax/common-concurrency 2025-10-07 12:21:50 -07:00
Hamish Knight
954b08cae5 [AST] Remove UnresolvedType
We have now removed all uses of this type.
2025-10-03 09:50:42 +01:00
Hamish Knight
21141f466c [AST] Add queries for 'bare' error types
Add `hasBareError` and `isBareErrorType` to check whether a type is
an ErrorType without an underlying original type (i.e prints as `_`).
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
7b3444a39f Merge remote-tracking branch 'origin/main' into rebranch 2025-09-29 10:58:38 -07:00
Hamish Knight
1c4132f005 [AST] Remove the use of UnresolvedType in replacingTypeVariablesAndPlaceholders
Now that ErrorType prints as `_`, we can use that instead of UnresolvedType
here since the original type is only really used for type printing and
debugging.
2025-09-28 15:13:55 +01:00
swift-ci
9e3d4161b5 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 05:03:55 -07:00
Hamish Knight
5e1acf5d32 [AST] Preserve HasPlaceholder recursive property for GenericFunctionType 2025-09-17 20:41:20 +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
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
1be6ce5e99 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-01 01:35:51 -07:00
Hamish Knight
ff200137a8 [AST] Add ErrorType originator for PlaceholderType 2025-08-30 16:05:01 +01:00
swift-ci
f64228c158 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-28 07:17:04 -07:00
Slava Pestov
1716832a7a AST: Remove most usages of AbstractFunctionDecl::hasDynamicSelfResult() 2025-08-27 15:34:26 -04:00
swift-ci
fdc5b2bc73 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 19:55:30 -07:00
Allan Shortlidge
0bba9bbc26 AST: Make the decl associated with an AvailabilityDomain a ValueDecl.
A decl that represents an `AvailabilityDomain` should always be a `ValueDecl`.
2025-08-14 11:35:00 -07:00
swift-ci
78dcb4dd45 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-12 03:16:32 -07:00
Allan Shortlidge
dacd986f1b AST: Introduce a warning group for a versioned #if canImport diagnostic.
This allows developers to control whether these diagnostics are considered
errors when `-warnings-as-errors` is specified.

Resolves rdar://157694667.
2025-08-11 16:06:06 -07:00
swift-ci
4838c6e954 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-01 23:15:28 -07:00
John McCall
9a3ba0e0fc Assert immediately if someone tries to build a SILFunctionType with
multiple isolated parameters.
2025-07-31 18:21:09 -04:00
Anthony Latsis
15f534deb1 AST: Adjust llvm::TinyPtrVector -> llvm::ArrayRef conversion after API change
See 8b3e345002.
2025-07-19 02:00:41 +01:00
Anthony Latsis
c1d794364b Adjust code after changes to llvm::TrailingObjects API
See:
- https://github.com/llvm/llvm-project/pull/138970
- https://github.com/llvm/llvm-project/pull/144930
2025-07-19 01:48:18 +01:00
Slava Pestov
ee440f3c91 AST: Remove MakeAbstractConformanceForGenericType
While the intent behind this functor was noble, it has grown in complexity
considerably over the years, and it seems to be nothing but a source of
crashes in practice. I don't want to deal with it anymore, so I've decided
to just subsume all usages with LookUpConformanceInModule instead.
2025-07-15 16:34:11 -04:00
Allan Shortlidge
96d0450d62 Merge pull request #82940 from tshortli/silgen-custom-availability-domain-query
ClangImporter: Generate and call custom availability domain predicates
2025-07-10 13:16:14 -07:00
Allan Shortlidge
3d722e1919 ClangImporter: Generate and call custom availability domain predicates.
When importing custom availability domains with dynamic predicates from Clang
modules, synthesize predicate functions for `if #available` queries and call
them when generating SIL.

Resolves rdar://138441312.
2025-07-10 08:15:01 -07:00
Slava Pestov
3c6b2a20a5 AST: Allocate BuiltinFixedArrayType in the solver arena if needed 2025-07-09 22:16:14 -04:00
Anthony Latsis
ad8c52237c Sema: Fix the insertion location for conformances attributes 2025-06-24 14:49:03 +01:00
Hamish Knight
6257828593 [AST] Replace type variables and placeholders in original ErrorTypes
Turns out we can also get solver-allocated original ErrorTypes through
type resolution. Given the original type is only used for
printing/debugging, let's just fold away any type variables and
placeholders into UnresolvedType (which print as placeholders). This
matches what `Solution::simplifyType` does.
2025-06-17 12:09:25 +01:00
Hamish Knight
215d63923b [AST] Enforce we don't get solver-allocated ErrorTypes
I don't believe we ever form these types, and if we did we aren't
correctly handling them in `Solution::simplifyType`. Let's just
enforce we don't get them.
2025-06-12 12:11:19 +01:00
Slava Pestov
0e1561f05a Sema: Change a couple of Identifier usages to DeclName instead 2025-05-30 14:43:48 -04:00
Hamish Knight
edca7c85ad Adopt ABORT throughout the compiler
Convert a bunch of places where we're dumping to stderr and calling
`abort` over to using `ABORT` such that the message gets printed to
the pretty stack trace. This ensures it gets picked up by
CrashReporter.
2025-05-19 20:55:01 +01:00