Commit Graph

103252 Commits

Author SHA1 Message Date
Allan Shortlidge
f774d4a3b3 Merge pull request #82151 from tshortli/rhombicuboctahedron-6.2
[6.2] Upstream support for the Xcode 26 SDKs
2025-06-10 21:57:12 -07:00
Anthony Latsis
5b71a7dd7a Merge pull request #82156 from AnthonyLatsis/camellia-sinensis-6.2
[6.2] Sema: Never record argument label mismatches for unlabeled trailing closures
2025-06-11 04:49:31 +01:00
Slava Pestov
4b3943a1fc Merge pull request #82131 from slavapestov/get-superclass-for-decl-6.2
[6.2] AST: More robust TypeBase::getSuperclassForDecl()
2025-06-10 18:38:43 -04:00
Henrik G. Olsson
993929c3e1 Merge pull request #81752 from hnrklssn/swiftify-sized-sizedby
[Swiftify] Support __sized_by on byte-sized pointee types

(cherry picked from commit 89b09a69e4)
2025-06-10 21:49:52 +02:00
Steven Wu
15f9e0ecda Merge pull request #82069 from cachemeifyoucan/eng/PR-152441866-release
[6.2][CAS] Allow uncached job from CAS based dependency scanning
2025-06-10 11:24:44 -07:00
QuietMisdreavus
879cbf67fc [6.2] [SymbolGraphGen] distinguish between headers of the same name in different modules (#82120)
- **Explanation**: Makes SymbolGraphGen use fully-qualified module names
when comparing modules for determining symbol sources.
- **Scope**: Fixes an uncommon bug when extending an Objective-C type
using a header with the same name as the source module's header.
- **Issues**: rdar://152676102
- **Original PRs**: #82112
- **Risk**: Low. The change does not affect normal compilation, and the
change will only affect which symbol graph a symbol is sorted into, and
shouldn't introduce any crashes.
- **Testing**: Automated tests verify the change.
- **Reviewers**: @franklinsch
2025-06-10 10:11:46 -07:00
Pavel Yaskevich
27cd5eef15 Merge pull request #82114 from xedin/rdar-150689994-6.2
[6.2][Diagnostics] Correctly diagnose situations when immutable value is passed to `inout` parameter
2025-06-10 09:11:10 -07:00
Pavel Yaskevich
dfd21ba699 Merge pull request #82130 from xedin/rdar-151943924-6.2
[6.2][TypeCheckEffects] Fix `AbstractFunction::getType` to look through al…
2025-06-10 08:44:12 -07:00
Allan Shortlidge
aa1bce262c ModuleInterface: Canonicalize OS version numbers in loaded swiftinterfaces. 2025-06-10 08:22:38 -07:00
Allan Shortlidge
6882649397 AST: Canonicalize version numbers in @_originallyDefinedIn attributes. 2025-06-10 08:22:38 -07:00
Allan Shortlidge
d775fddf36 AST: Warn for non-existent platform versions in @available attributes. 2025-06-10 08:22:38 -07:00
Allan Shortlidge
003576c613 AST: Re-map macOS 16 aligned availability versions to 26.
- watchOS 12 -> 26
- visionOS 3 -> 26
- macos 16 -> 26
- iOS 19 -> 26
- tvOS 19 -> 26

The version numbers for `if #available(...)` queries are intentionally not
re-mapped.
2025-06-10 08:22:38 -07:00
Hamish Knight
bd4c3adb92 [CS] Make CSRanking change slightly less risky for 6.2
Check for `isSolverAllocated` rather than
`hasTypeVariableOrPlaceholder`, and downgrade an `ASSERT` to
`CONDITIONAL_ASSERT`.
2025-06-10 16:18:24 +01:00
Hamish Knight
cc66fc886f [CS] Avoid solver-allocated inputs with typesSatisfyConstraint
Escaping solver-allocated types into a nested allocation arena is
problematic since we can e.g lazily compute the `ContextSubMap` for a
`NominalOrBoundGenericNominalType`, which is then destroyed when we
exit the nested arena. Ensure we don't pass any types with type
variables or placeholders to `typesSatisfyConstraint`.

rdar://152763265
2025-06-10 16:08:00 +01:00
Andrew Trick
f861c2f2a8 Merge pull request #82138 from atrick/62-fix-moveonly-storeborrow
[6.2] Fix MoveOnlyWrappedTypeEliminator handling of store_borrow.
2025-06-10 07:54:30 -07:00
Anthony Latsis
da1922f0bf Sema: Never record argument label mismatches for unlabeled trailing closures
Fixes a crash on invalid. The previous logic was causing a label
mismatch constraint fix to be recorded for an unlabeled trailing closure
argument matching a variadic paramater after a late recovery argument
claim in `matchCallArgumentsImpl`, because the recovery claiming skips
arguments matching defaulted parameters, but not variadic ones. We may
want to reconsider that last part, but currently it regresses the
quality of some diagnostics, and this is a targeted fix.

The previous behavior is fine because the diagnosis routine associate
with the constraint fix (`diagnoseArgumentLabelError`) skips unlabeled
trailing closures when tallying labeling issues — *unless* there are no
other issues and the tally is zero, which we assert it is not.

Fixes rdar://152313388.

(cherry picked from commit f2e1420a90)
2025-06-10 15:28:41 +01:00
Alex Hoppen
3780aba7df Merge pull request #82054 from ahoppen/6.2/dont-verify-mangle
[6.2][Indexing] Don't verify mangling of USRs
2025-06-10 13:58:38 +02:00
Pavel Yaskevich
3ed55703e1 Merge pull request #82036 from xedin/rdar-151911135-6.2
[6.2][Concurrency] Fix `SendableMetatype` conformance failures to behave l…
2025-06-09 21:26:55 -07:00
Andrew Trick
48ba887e6b Fix MoveOnlyWrappedTypeEliminator handling of store_borrow.
Defer visiting an instruction until its operands have been visited. Otherwise,
this pass will crash during ownership verification with invalid operand
ownership.

Fixes rdar://152879038 ([moveonly] MoveOnlyWrappedTypeEliminator ownership
verifier crashes on @_addressableSelf)

(cherry picked from commit 16fffd1704)
2025-06-09 19:49:36 -07:00
Allan Shortlidge
7436be514a Merge pull request #82083 from tshortli/diagnose-unrecognized-availability-domains-as-errors-6.2
[6.2] AST: Diagnose unrecognized platforms as errors with `CustomAvailability` enabled
2025-06-09 18:16:02 -07:00
Pavel Yaskevich
1e463281b5 Merge pull request #82066 from xedin/rdar-152665294-6.2
[6.2][Demangle] Implement missing `Node::Kind::OutlinedInitializeWithTakeNoValueWitness`
2025-06-09 18:02:28 -07:00
Slava Pestov
27a2396a2f AST: More robust TypeBase::getSuperclassForDecl()
This can return ErrorType if the AST is invalid.

A handful of callers handle the ErrorType result, but most don't,
blindly assuming the result is always a nominal type. This resulted
in a crash in at least one test case.

Lift the burden from callers by always returning a nominal type here.
2025-06-09 20:23:12 -04:00
Pavel Yaskevich
f8a3c3b1ff [TypeCheckEffects] Fix AbstractFunction::getType to look through all levels of optional
A member and a parameter could be wrapped in an arbitrary number
of `Optional`, we need to look through all of them to get to the
underlying function type.

Resolves: rdar://151943924
(cherry picked from commit 86390ab91f)
2025-06-09 17:18:11 -07:00
Konrad `ktoso` Malawski
2e368ce31c Merge pull request #82010 from ktoso/pick-wip-fix-computed-variables-arm64-protocol-dist
[6.2][Distributed] Fix computed properties in protocols on arm64e
2025-06-10 09:08:59 +09:00
Pavel Yaskevich
a9e5a8a07a [Diagnostics] Correctly diagnose situations when immutable value is passed to inout parameter
Currently the note is going to point to the "callee" but that is
incorrect when the failure is related to an argument of a call.

Detect this situation in `RValueTreatedAsLValueFailure::diagnoseAsNote`
and produce a correct note.

Resolves: rdar://150689994
(cherry picked from commit 6bbc101a98)
2025-06-09 09:39:12 -07:00
Pavel Yaskevich
3ca6228246 [ConstraintSystem] Look through ArgumentAttribute element when computing a callee
This element is used purely for diagnostic purposes and locator
should behavior as if it's completely transparent.

(cherry picked from commit 622475bf15)
2025-06-09 09:39:12 -07:00
Gábor Horváth
e700c6b8d4 [6.2][cxx-interop] Support _LIBCPP_PREFERRED_OVERLOAD
Explanation: Some functions are implemented both in libc and libc++.
Clang uses the enable_if attribute to resolve otherwise ambiguous
functions calls. This PR makes the name lookup aware of this attribute.
Issue: rdar://152192945
Risk: Low, only C/C++ APIs with enable_if attributes are affected.
Testing: Regression test added.
Original PR: #82019
Reviewer: @hnrklssn
2025-06-09 13:40:34 +01:00
Gábor Horváth
7548cbf71a [6.2][cxx-interop] Avoid swiftifying private and protected methods
Explanation: We do not serialize the private macro generated swift
method's bodies which crashes the compiler. This PR skips generating
swiftified overloads to these private/protected method to work around
the crash.
Issue: rdar://152181531
Risk: Low, the change is straightforward.
Testing: Regression test added.
Original PR: #82016
Reviewer: @hnrklssn
2025-06-09 13:15:55 +01:00
Allan Shortlidge
f5bae411ca AST: Diagnose unrecognized platforms as errors with CustomAvailability enabled.
When the CustomAvailability experimental feature is enabled, make it an error
to specify an unrecognized availability domain name. Also, add these
diagnostics to a diagnostic group so that developers can control their behavior
when they are warnings.

Resolves rdar://152741624.
2025-06-06 22:44:12 -07:00
Michael Gottesman
80ce07ca66 [silgen] Teach SILGen how to emit a forced dynamic member ref given nonisolated(nonsending) casts.
Specifically, I taught SILGen how to emit an AST like the following:

```
(force_value_expr implicit type="nonisolated(nonsending) (Date?) async -> Void" implicit_iuo_unwrap
  (open_existential_expr implicit type="(nonisolated(nonsending) (Date?) async  -> Void)?"
    (opaque_value_expr implicit type="AnyObject")
    (declref_expr type="AnyObject" decl="test.(file).repro().anyObject@test.swift:6:7" function_ref=unapplied)
    (optional_evaluation_expr type="(nonisolated(nonsending) (Date?) async -> Void)?"
      (inject_into_optional type="(nonisolated(nonsending) (Date?) async -> Void)?"
        (function_conversion_expr type="nonisolated(nonsending) (Date?) async -> Void"
          (bind_optional_expr type="(Date?) async -> Void" depth=0
            (dynamic_member_ref_expr type="((Date?) async -> Void)?" decl="__ObjC.(file).Foo.start(at:)"
              (opaque_value_expr type="AnyObject"))))))))
```

Since we are emitting an objc async function, there isn't an extra implicit
parameter like if we were using a swift async function. So, I just reused code
that was already used locally to look through these sorts of conversions. I
just had to add to that code support for conversions that add
nonisolated(nonsending). Previously it only supported looking through global
actor conversions.

rdar://152596823
(cherry picked from commit 662dbdb55a)
2025-06-06 23:34:40 -04:00
nate-chandler
4051ea2e78 Merge pull request #82044 from nate-chandler/cherrypick/release/6.2/rdar152580661
6.2: [TypeLowering] Record pack used in aggregate signature.
2025-06-06 14:53:18 -07:00
Arnold Schwaighofer
423fef048e Merge pull request #82027 from aschwaighofer/fix_looprotate_densemap_subscript_bug_6.2
[6.2] LoopRotate: Fix a by reference map bug under reallocation
2025-06-06 12:56:21 -07:00
Slava Pestov
fa4c30ed6f Merge pull request #82051 from slavapestov/fix-rdar127120469-6.2
[6.2] ASTPrinter: Fix printing of let properties inside @objc @implementation extensions
2025-06-06 14:11:38 -04:00
Steven Wu
cc0af1d4f8 [CAS] Allow uncached job from CAS based dependency scanning
Create a path that swift-frontend can execute an uncached job from
modules built with CAS based explicit module build. The new flag
-import-module-from-cas will allow an uncached build to load module
from CAS, and combined with source file from real file system to build
the current module. This allows quick iterations that bypasses CAS,
without full dependency scanning every time in between.

rdar://152441866
2025-06-06 11:08:44 -07:00
Pavel Yaskevich
fd79a85981 [Demangle] Implement missing Node::Kind::OutlinedInitializeWithTakeNoValueWitness
Implements de/remangler support for `WOB` manglings.

(cherry picked from commit 8e49860349)
2025-06-06 10:05:56 -07:00
Allan Shortlidge
7bf1b0a5bc Merge pull request #82047 from tshortli/back-deployed-attr-remap-6.2
[6.2] AST: Fix iOS -> visionOS version remap for `@backDeployed` attrs
2025-06-06 09:09:26 -07:00
Pavel Yaskevich
47925188ba [Concurrency] Fix SendableMetatype conformance failures to behave like Sendable ones
No warnings with minimal checking, warnings with `strict-concurrency=complete` and
if declaration is `@preconcurrency` until next major swift version.

Resolves: rdar://151911135
Resolves: https://github.com/swiftlang/swift/issues/81739
(cherry picked from commit e326cd00930ff042ba1595e7793af9aaf0208b97)
2025-06-06 08:51:05 -07:00
Pavel Yaskevich
2a3e2d0800 Merge pull request #82037 from xedin/rdar-146027395-6.2
[6.2][Concurrency] Downgrade errors to warnings when Sendable requirement is inferred from a preconcurrency protocol
2025-06-06 08:49:20 -07:00
Henrik G. Olsson
fc67649b46 Merge pull request #82003 from hnrklssn/ignore-unused-bounds-attributes-6.2
[ClangImporter] Look through __ended_by and __null_terminated (#81630)
2025-06-06 08:37:17 -07:00
Gábor Horváth
2b33c44796 [6.2][cxx-interop] Support Swiftifying C++ constructors
Explanation: We did not have support to generate swiftified overload for
initializers. This PR adds that support.
Issue: rdar://152112660
Risk: Low, the feature is localized to swiftified overloads.
Testing: Regression test added.
Original PR: #81947
Reviewer: @hnrklssn
2025-06-06 15:34:15 +01:00
Alex Hoppen
558644f7fa [Indexing] Don't verify mangling of USRs
Verifying USR mangling adds ~30% overhead to indexing times. Since an incorrect USR mangling doesn't result in a correctness issue at the same level as a miscompile, save those 30% in non-assert builds.
2025-06-06 08:37:43 +02:00
Allan Shortlidge
c9d5e4b26c Merge pull request #82038 from tshortli/language-modes-and-features-in-module-trace-6.2
[6.2] Frontend: Add language mode and enabled features to `.SWIFT_TRACE`
2025-06-05 23:35:32 -07:00
Slava Pestov
2c53876c19 ASTPrinter: Fix printing of let properties inside @objc @implementation extensions
A `let` here is really just a `var` with a `{ get }`.

Fixes rdar://problem/127120469.
2025-06-06 00:25:02 -04:00
Allan Shortlidge
339ab824a8 AST: Fix iOS -> visionOS version remap for @backDeployed attrs.
The version remapping for `@backDeployed` regressed due to a bug introduced by
https://github.com/swiftlang/swift/pull/81922.

Also, fix some visionOS tests that have gotten out of date because we don't
seem to be running them in CI.

Resolves rdar://152542983.
2025-06-05 19:20:38 -07:00
Artem Chikin
ed8d696395 Merge pull request #82026 from artemcm/DiagnoseMissingModulesSeenInSerializedSearchPaths_62
[6.2 🍒][Dependency Scanning] On failure to locate a module, attempt to diagnose if binary dependencies contain search paths with this module.
2025-06-05 18:32:12 -07:00
Nate Chandler
d8c6f9817c [TypeLowering] Record pack used in aggregate sig.
Every `LowerType::visit*` function eventually calls through to a
`LowerType::handle*` function.  After
https://github.com/swiftlang/swift/pull/81581, every
`LowerType::handle*` needs to set the `hasPack` flag based on the
passed-in type by calling `mergeHasPack`.  Add the missing call in the
`handleAggregateByProperties` function.

rdar://152580661
2025-06-05 17:45:14 -07:00
Arnold Schwaighofer
cf81104407 Merge pull request #80989 from aschwaighofer/loadable_by_address_fix_yields_pattern_subst_6.2
[6.2] LoadableByAddress: Fix shouldTransformYields to use (properly) substituted types
2025-06-05 17:16:31 -07:00
Allan Shortlidge
f82c0b71a2 Sema: Fix an unused variable warning. 2025-06-05 15:44:27 -07:00
Allan Shortlidge
4c34f08b99 SILOptimizer: Fix an unused variable warning. 2025-06-05 15:40:30 -07:00
Erik Eckstein
7435a0366a IRGen: Fix an unused static function warning.
Move a static inline function into the cpp file.

NFC.
2025-06-05 15:39:33 -07:00