Commit Graph

22610 Commits

Author SHA1 Message Date
Slava Pestov
4d977535ff Merge pull request #82011 from slavapestov/clang-importer-assert
AST: Add assertion to BuiltinLiteralExpr::setBuiltinInitializer()
2025-06-06 02:50:57 -04:00
John Hui
f9e71d6770 [NFC] Silence unused variable warning in assert()
Clang complains that paramIndicesLength is unused. This block is already
guarded by CONDITIONAL_ASSERT_enabled(), so promoting assert() to
ASSERT() should not affect the behavior of assertions-disabled builds.
2025-06-05 17:01:05 -07:00
Pavel Yaskevich
3495c61840 [Diagnostics] Use contains instead of has when non-Sendable type appears inside of a member type 2025-06-05 11:14:55 -07:00
John McCall
b3493bfa23 Prevent PrintOptions from being implicitly copied.
NFC *except* that I noticed a bug by inspection where we suppress
`@escaping` when print enum element types. Since this affects
recursive positions, we end up suppressing `@escaping` in places
we shouldn't. This is unlikely to affect much real code, but should
still obviously be fixed.

The new design is a little sketchy in that we're using `const` to
prevent direct use (and allow initialization of `const &` parameters)
but still relying on modification of the actual object.  Essentially,
we are treating the `const`-ness of the reference as a promise to leave
the original value in the object after computation rather than a
guarantee of not modifying the object. This is okay --- a temporary
bound to a `const` reference is still a non-`const` object formally
and can be modified without invoking UB --- but makes me a little
uncomfortable.
2025-06-05 12:52:01 -04:00
Mykola (Nickolas) Pokhylets
87e536ebec Merge pull request #80440 from nickolas-pohilets/mpokhylets/weak-let 2025-06-05 09:59:33 +02:00
Slava Pestov
d7d5641487 AST: Add assertion to BuiltinLiteralExpr::setBuiltinInitializer()
I just spent way too long debugging an issue where a null pointer
was passed here, and SILGen crashed much later.
2025-06-04 23:51:46 -04:00
Doug Gregor
c1f7771e84 Merge pull request #81998 from DougGregor/raw-conformance-isolation-cleanup
Make (Raw)ConformanceIsolation requests work on the normal protocol conformance
2025-06-04 20:40:24 -07:00
Artem Chikin
d4abba10a5 Add a new diagnostic group and documentation for the module-not-found failure which specifies that a missing module dependency can be found on a search path serialized in another Swift binary module dependency. 2025-06-04 16:57:01 -07:00
Artem Chikin
aedc2fadb3 [Dependency Scanning] Serialized Swift binary module serialized search paths 2025-06-04 16:55:45 -07:00
Artem Chikin
90f2fba2ae [Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module.
Unlike with implicitly-built modules (prior to Swift 6 mode), explicitly-built modules require that all search paths be specified explicitly and no longer inherit search paths serialized into discovered Swift binary modules. This behavior was never intentional and is considered a bug. This change adds a diagnostic note to a scan failure: for each binary Swift module dependency, the scanner will attempt to execute a dependency scanning query for each serialized search path inside that module. If such diagnostic query returns a result, a diagnostic will be emitted to inform the user that the dependency may be found in the search path configuration of another Swift binary module dependency, specifying which search path contains the "missing" module, and stating that such search paths are not automatically inherited by the current compilation.
2025-06-04 16:55:37 -07:00
Doug Gregor
68914528db Make (Raw)ConformanceIsolation requests work on the normal protocol conformance
Reduce the burden on the evaluator's caching mechanism by handling the
unwrapping of a conformance down to its normal protocol conformance
outside of these requests. Thanks, Slava!
2025-06-04 14:26:18 -07:00
Doug Gregor
704cb81d93 Merge pull request #81963 from DougGregor/non-sendable-metatype-diag-group
Add a diagnostic group for the diagnostic about non-Sendable metatypes.
2025-06-04 09:41:51 -07:00
Slava Pestov
c61a4fe333 Merge pull request #81949 from slavapestov/missing-part-of-se-0346
Sema: Implement missing part of SE-0346
2025-06-04 09:24:19 -04:00
Doug Gregor
9f0dda5417 Add a diagnostic group for the diagnostic about non-Sendable metatypes.
This is a new restriction that folks are sure to run into, so provide
it with some actionable documentation. Fixes rdar://152450956.
2025-06-03 16:45:28 -07:00
Doug Gregor
9957f5240f Merge pull request #81933 from DougGregor/break-isolated-conformance-reference-cycle 2025-06-03 14:54:16 -07:00
Slava Pestov
cd5ecbee16 Sema: Implement missing part of SE-0346
The proposal states that this should work, but this was never
implemented:

    protocol P<A> {
      associatedtype A
    }

    struct S: P<Int> {}

- Fixes https://github.com/swiftlang/swift/issues/62906.
- Fixes rdar://91842338.
2025-06-03 17:28:19 -04:00
eeckstein
50c6824263 Merge pull request #81935 from eeckstein/min-pointer-value-option
IRGen: add an option `-min-valid-pointer-value` to override the target's LeastValidPointerValue
2025-06-03 19:21:58 +02:00
Meghana Gupta
d1a97f1b0d Merge pull request #81879 from meg-gupta/fixdeserialization
Fix deserialization of lifetime dependencies on ast function types
2025-06-03 08:56:54 -07:00
Susana Monteiro
e910d9b2f8 Merge pull request #81709 from swiftlang/susmonteiro/ambiguous-use-of-method
[cxx-interop] Fix ambiguous methods in long chains of inheritance
2025-06-03 15:50:28 +01:00
Erik Eckstein
c02bc2d421 IRGen: add an option -min-valid-pointer-value to override the target's LeastValidPointerValue
The LeastValidPointerValue is hard-coded in the runtime.
Therefore this option is only available in embedded swift - which doesn't have a runtime.

rdar://151755654
2025-06-03 09:27:35 +02:00
Doug Gregor
7472a0ca38 Split conformance isolation request to eliminate a reference cycle
Inference of conformance isolation needs to check whether all of the
witnesses are nonisolated. However, witness checking looks at
conformance isolation. To break this reference cycle, split the
conformance isolation request into two requests: a "raw" request that
looks at explicitly-specified isolation, and the existing one that
also performs inference. The existing one builds on the "raw" one, as
does a separate path for the conformance checker.

Fixes rdar://152461344.
2025-06-02 23:37:58 -07:00
Allan Shortlidge
f4b4dc9889 AST/Sema: Fix remapping of iOS availability in diagnostics for visionOS.
When compiling for visionOS, iOS availability attributes are remapped into the
visionOS availability domain automatically. While the version remapping was
being performed correctly, there was a regression that caused the platform name
to be printed incorrectly in many diagnostics. Whenever an iOS version is
remapped to a visionOS version, availability diagnostics will now present
those versions as visionOS versions instead of iOS versions.

Resolves rdar://146293165.
2025-06-02 17:55:38 -07:00
Meghana Gupta
36f3574f9c Fix deserialization of lifetime dependencies on ast function types
While deserializing AST function types FunctionType and GenericFunctionType which include
lifetime dependencies and an implicit self parameter, we don't correctly populate
ASTExtInfoBuilder.lifetimeDependencies.  We end up reading one dependency less due to
incorrect index calculation.

Unlike SILFunctionType, AST function types FunctionType and GenericFunctionType
do not include implicit self in their param list. They represent methods with
implicit self as like: `(Self) -> (Args...) -> Result` and don't have any information
to indicate they may have implicit self. Since we use number of parameters while
deserializing lifetime dependencies, we go wrong for such function types.

Serialize the length of parameter indices, so that lifetime dependencies can be
deserialized to that length.

rdar://151768216
2025-06-02 17:29:05 -07:00
Meghana Gupta
ba678b5518 Merge pull request #81893 from meg-gupta/lifetimediagnostics
Fix diagnostic messages for some cases of invalid lifetime dependencies
2025-06-02 16:01:00 -07:00
Michael Chiu
84ee0af416 CLongDouble should map to Float128 (which is yet supported) on arm64, and trivial copy ctor is yet available even on 14 2025-06-02 13:39:50 -04:00
Michael Chiu
7bbafc599d Merge branch 'main' into mchiu/freebsd 2025-06-02 13:33:18 -04:00
Pavel Yaskevich
e1e9f04398 Merge pull request #81863 from xedin/using-for-default-isolation-in-file-context
[AST/Sema] SE-0478:  Implement `using` declaration under an experimental flag
2025-06-02 09:56:29 -07:00
susmonteiro
79227e7a09 [cxx-interop] Fix ambiguous methods in long chains of inheritance 2025-06-02 16:51:58 +01:00
Allan Shortlidge
d5ef256b40 Merge pull request #81751 from tshortli/migratable-member-import-visibility 2025-06-01 08:49:01 -07:00
Meghana Gupta
cbe253326b Fix diagnostic messages for some cases of invalid lifetime dependencies 2025-06-01 07:55:07 -07:00
Pavel Yaskevich
21ec5924f7 [AST] NFC: Capitalize UsingSpecifier::nonisolated for consistency 2025-05-31 10:49:50 -07:00
Pavel Yaskevich
ec9132cb5a [Diagnostics] Tailor using diagnostic to current use-case - default isolation 2025-05-31 10:49:50 -07:00
Pavel Yaskevich
c246a7a372 [AST/Sema] Hide using declaration behind DefaultIsolationPerFile experimental feature 2025-05-31 10:49:50 -07:00
Pavel Yaskevich
36b77116bd [Concurrency] Add a request to retrieve default isolation of a file
The default isolation is computed based on `using` declaration
found in the file, if any.
2025-05-31 10:49:50 -07:00
Pavel Yaskevich
4ad27ba61e [Parse] Implement parsing for using declarations 2025-05-31 10:49:45 -07:00
Slava Pestov
f6f0d75263 Merge pull request #81843 from slavapestov/hamish-fuzzer-fixes
Hamish fuzzer fixes
2025-05-31 12:28:56 -04:00
Hamish Knight
dde37c0f01 Merge pull request #81868 from hamishknight/x-of-hearts
Change InlineArray sugar separator `x` -> `of`
2025-05-31 10:05:26 +01:00
Artem Chikin
bb6967bcb9 Merge pull request #81850 from artemcm/BridgeHeaderScanDiagnostics
[Dependency Scanning] Bridge diagnostics emitted during bridging header scanning
2025-05-30 18:36:16 -07:00
Pavel Yaskevich
4b5105df5e [ASTGen] Implement bridging for using declaration 2025-05-30 15:52:09 -07:00
Allan Shortlidge
aca604660f AST/Sema: Make MemberImportVisibility a migratable feature.
The migration to `MemberImportVisibility` can be performed mechanically by
adding missing import declarations, so offer automatic migration for the
feature.

Resolves rdar://151931597.
2025-05-30 15:34:08 -07:00
Allan Shortlidge
d258fa783b AST: Simplify the interface of DiagnosticEngine::getBestAddImportFixItLoc().
For clarity, it should just take a `SourceFile`.
2025-05-30 15:34:08 -07:00
Artem Chikin
8ec341eac4 [Dependency Scanning] Bridge diagnostics emitted during bridging header scanning
Instead of simply dumping them to stderr.

Resolves rdar://151993075
2025-05-30 13:50:37 -07:00
Slava Pestov
2f6b45dc7d AST: Add an assertion to ProtocolConformanceRef::getAbstract() 2025-05-30 16:27:01 -04:00
Slava Pestov
0e1561f05a Sema: Change a couple of Identifier usages to DeclName instead 2025-05-30 14:43:48 -04:00
Hamish Knight
5d1f219acb Change InlineArray sugar separator x -> of 2025-05-30 13:50:22 +01:00
Pavel Yaskevich
aabfebec03 [AST] Add new declaration - using
Initially this declaration is going to be used to determine
per-file default actor isolation i.e. `using @MainActor` and
`using nonisolated` but it could be extended to support other
file-global settings in the future.
2025-05-30 00:39:06 -07:00
Artem Chikin
74e207b7bb Merge pull request #81713 from artemcm/ClangRemapsForDepScanQueries
[Dependency Scanning] Add ClangImporter's mandatory path remaps to dependency scanning query filesystem
2025-05-29 18:25:30 -07:00
Alexis Laferrière
7d6447be20 Merge pull request #81519 from xymus/cdecl-diags
Sema: Update more diagnostics for `@cdecl` and representability in the C language
2025-05-29 13:37:29 -07:00
Artem Chikin
a9e0a58b46 [Dependency Scanning] Add ClangImporter's mandatory path remaps to dependency scanning query filesystem
On creation, 'ClangImporter' adds overlay modulemap files for non-modular platform libraries (e.g. glibc, libstdc++), which allows Swift code to import and use those libraries.

This change adds the same filesystem overlay to dependency scanning queries by applying them to the filesystem instantiated for each depndency scanning worker. Without these overlays EBM builds cannot discover and use non-modular system libraries on non-Darwin platforms.

Resolves rdar://151780437
2025-05-29 13:33:36 -07:00
Hamish Knight
c287f53580 Merge pull request #81809 from hamishknight/range-expansion
[SourceKit] Properly handle cursor info range for macro expansions
2025-05-29 20:23:54 +01:00