Commit Graph

7604 Commits

Author SHA1 Message Date
Pavel Yaskevich
43c3e4a539 Merge pull request #81719 from xedin/rdar-151720646
[TypeChecker] Improve diagnostics for access to actor-isolated values…
2025-05-23 09:58:16 -07:00
Eric Miotto
6adc1870b2 Merge pull request #81723 from edymtt/edymtt/disable-some-sanitizers-tests-on-ios-arm64e
Disable tests that require arm64e slices for iOS sanitizers
2025-05-23 06:44:48 -07:00
Pavel Yaskevich
9e562881fe [TypeChecker] Improve diagnostics for access to actor-isolated values outside of the actor
Replaces generic `expression is 'async' but is not marked with 'await`
diagnostic with a tailed one for cases where there is an access to an
actor-isolated value outside of its actor without `await` keyword.

This makes the diagnostics for async and sync contexts consistent
and actually identifies a problem instead of simply pointing out
the solution.

Resolves: rdar://151720646
2025-05-23 00:20:18 -07:00
Michael Gottesman
d816f0fe99 Merge pull request #81691 from gottesmm/pr-9f39c3c00daaa015dbbad351349202f5f9238db6
[sema] Change non-sendable -> non-Sendable in diagnostics.
2025-05-22 21:20:37 -07:00
Eric Miotto
00334acf37 Disable tests that require arm64e slices for iOS sanitizers
We started building iOS sanitizers when switching to
`LLVM_ENABLE_RUNTIMES` to build compiler-rt, and turns out they
currently provide only the arm64 slice.

Addresses rdar://151782340
2025-05-22 14:40:07 -07:00
Michael Gottesman
3ed4059a60 [sema] Change non-sendable -> non-Sendable in diagnostics.
This matches send non sendable but importantly also makes it clear that we are
talking about something that doesn't conform to the Sendable protocol which is
capitalized.

rdar://151802975
2025-05-22 11:37:58 -07:00
nate-chandler
393465262b Merge pull request #81581 from nate-chandler/rdar147207926
[TypeLowering] Record packs used in signatures.
2025-05-21 13:37:10 -07:00
Nate Chandler
aa49b8540d [TypeLowering] Record packs used in signatures.
To determine whether an instruction may require pack metadata, the types
of its operands are examined.

Previously, the top level type was checked for having a pack in its
signature, and the whole type was checked for having a type anywhere in
its layout (via TypeLowering).  This didn't account for the case where
the metadata was required for a resilient type which uses a pack in its
signature.

Here, during type lowering, a type having a pack in its signature is
counted towards the type having a pack.

Fixes a compiler crash.

rdar://147207926
2025-05-20 16:53:28 -07:00
nate-chandler
8959f60ab1 Merge pull request #81566 from nate-chandler/rdar151325025
[MoveOnlyChecker] Don't complete phis.
2025-05-19 07:21:21 -07:00
Nate Chandler
9b3db3646a [MoveOnlyChecker] Don't complete phis.
Apply the MoveOnlyAddressChecker change from
https://github.com/swiftlang/swift/pull/73358 to the
MoveOnly[Value]Checker.

After 7713eef817, before running value
checking, all lifetimes in the function are completed.  That doesn't
quite work because lifetime completion expects not to encounter
reborrows or their adjacent phis.

rdar://151325025
2025-05-16 11:58:44 -07:00
nate-chandler
f4a2e46e39 Merge pull request #81541 from nate-chandler/rdar139666145
[MoveOnly] Fix consume of addr with mutated field.
2025-05-16 06:55:31 -07:00
Nate Chandler
1765f0b1e0 [MoveOnly] Fix consume of addr with mutated field.
Don't fail out of use visitation when encountering an apply which uses a
field of the value as an inout parameter.

rdar://139666145
2025-05-15 15:19:26 -07:00
Hamish Knight
110f11493a [IDE] Avoid uses of isBeforeInBuffer in TypeCheckASTNodeAtLocRequest
Use the higher level APIs on SourceManager that handle locations in
parent vs child buffers. This then allows us to fix `walkToDeclPre`
such that we don't set the found DeclContext unless the location is
actually within that decl (here the location may well be in a
separate buffer as we may have a replaced function body).
2025-05-14 11:15:42 +01:00
Anthony Latsis
55e5618eab [test] Match nocapture to succeed both on main and rebranch
Both the syntax and relative order of the LLVM `nocapture` parameter
attribute changed upstream in 29441e4f5fa5f5c7709f7cf180815ba97f611297.
To reduce conflicts with rebranch, adjust FileCheck patterns to expect
both syntaxes and orders anywhere the presence of the attribute is not
critical to the test. These changes are temporary and will be cleaned
up once rebranch is merged into main.
2025-05-08 23:52:43 +01:00
Anthony Latsis
2faa94712a [test] IRGen: Adjust FileCheck pattern for new initializes attribute in upstream LLVM
The parameter attribute was introduced in
5ece35df8586d0cb8c104a9f44eaae771de025f5 (llvm-project) and is expected
here according to the lowered function body.

Match it using a wildcard regex, since it is not relevant to this test.

This is intended to reduce future conflicts with rebranch.
2025-05-08 23:46:05 +01:00
Anthony Latsis
d42c3999ae [test] IRGen: Adjust FileCheck patterns for new nuw attribute in upstream LLVM
This attribute was introduced in
7eca38ce76d5d1915f4ab7e665964062c0b37697 (llvm-project).

Match it using a wildcard regex, since it is not relevant to these
tests.

This is intended to reduce future conflicts with rebranch.
2025-05-08 23:44:13 +01:00
Hamish Knight
3022270150 Merge pull request #81281 from hamishknight/you-get-a-buildable-folder 2025-05-05 08:58:27 +01:00
Hamish Knight
8ce61eb411 [xcodegen] Bump dependencies 2025-05-04 20:46:20 +01:00
Dario Rexin
7634b82109 Merge pull request #81151 from drexin/wip-149985633
[IRGen] Use at least Int8 for extra tag bits
2025-05-01 16:03:51 -07:00
Dario Rexin
48ee212303 [IRGen] Use at least Int8 for extra tag bits
rdar://149985633

Using at least Int8 here allows LLVM to apply more optimizations, reducing code size, avoiding stack allocations and as a result often eliminating complete stack frames.
2025-04-30 15:55:17 -07:00
Eric Miotto
26bdff8fe5 Merge pull request #80253 from edymtt/edymtt/use-runtimes-build-quater-enabled-by-default
Use LLVM_USE_RUNTIMES to build compiler-rt by default
2025-04-30 12:05:13 -07:00
Erik Eckstein
ec4d40cdbe tests: increase the timeout for large_nested_array.swift.gyb
This fixes a timeout failure in CI. It looks like that some CI machines are slower than expected.
I could not reproduce this locally. There doesn't seem to be a compile time regression.
2025-04-24 09:27:37 +02:00
Hamish Knight
ae1f9d9437 Merge pull request #81029 from hamishknight/null-ext
[ASTPrinter] Add missing null check in `isNonSendableExtension`
2025-04-23 22:45:42 +01:00
nate-chandler
3e35fa423d Merge pull request #81015 from nate-chandler/rdar141279635
[MoveOnly] Fix consumption of opened existentials.
2025-04-23 13:26:47 -07:00
Hamish Knight
247dda9639 [ASTPrinter] Add missing null check in isNonSendableExtension
The extended nominal may not be present for an invalid extension.

rdar://149032713
2025-04-23 15:26:10 +01:00
Nate Chandler
4786bede68 [MoveOnly] Fix consumption of opened existentials.
Enable walking into `TypeOffsetSizePair`s from an existential into an
archetype.  And set the access kind on `open_existential_addr`
instructions which are the sources of rewritten `copy_addr`s to mutable.

rdar://141279635
2025-04-22 17:59:37 -07:00
Anthony Latsis
2cd90bdd69 AST: Quote attributes more consistently in DiagnosticsSema.def 2025-04-22 18:23:36 +01:00
Eric Miotto
c983cac3a9 Use LLVM_ENABLE_RUNTIMES to build compiler-rt by default
Addresses rdar://113972453
2025-04-22 08:13:33 -07:00
Eric Miotto
7b001765bd Merge pull request #80174 from edymtt/edymtt/use-runtimes-build-quater
build-script: Permit to build compiler-rt with `LLVM_ENABLE_RUNTIMES`
2025-04-22 06:48:17 -07:00
Nate Chandler
041851e799 [CoroutineAccessors] Infer same lifetime deps.
When the feature is enabled, a read2 accessor is generated when a
mutating getter is declared.

rdar://149385088
2025-04-16 16:03:54 -07:00
Hamish Knight
805f25d50c [Sema] Try limit kicking interface type in filterForEnumElement
Kicking the interface type request of the base decl here is wrong
if the decl is e.g a `self` capture in a closure, since we'll be in
the middle of type-checking the closure. I'm planning on properly
fixing this by folding the lookup into the constraint system, but for
now let's at least avoid kicking the request if we don't have an enum
case or enum var. That at least prevents it from affecting cases where
e.g you're pattern matching against a property in a class.

We could potentially tighten up the checking here even further, but
that could potentially impact source compatibility for ambiguous
cases. I'd like to keep this patch low risk, and then deal with any
fallout as part of the pattern type-checking work.

rdar://146952007
2025-04-09 14:56:49 +01:00
Hamish Knight
6ceb9c1bdd Merge pull request #80634 from hamishknight/lifetime-variance
[Sema] Ignore types with type variables in `filterEscapableLifetimeDependencies`
2025-04-09 01:40:42 +01:00
Hamish Knight
9114aad02c [Sema] Ignore types with type variables in filterEscapableLifetimeDependencies
If the type still has type variables, avoid trying to check if it's
escapable.

rdar://148749815
2025-04-08 14:14:42 +01:00
Slava Pestov
1d25522ceb cmake: Add NO_SWIFTMODULE option to add_swift_target_library() 2025-04-07 21:32:14 -04:00
Hamish Knight
2eff1620a3 [test] Use release mode in swift-xcodegen.test
This takes about twice as long to build in CI, but runs significantly
quicker (~22x). The exact time taken varies quite a bit between runs,
but this brings the worst-case overall run-time down from ~500s to
~200s. While here, make sure we pass `--skip-build` to the second
invocation to ensure we avoid building twice. Also disable using the
dependency cache since we want to test a clean build, and we just
want swiftpm to use the local deps.
2025-04-06 10:55:14 +01:00
Pavel Yaskevich
bf2d01e562 Merge pull request #80419 from xedin/revert-pr-79397
Revert "Sema: Allow optional-to-optional CGFloat <-> Double conversion"
2025-04-02 00:10:23 -07:00
Slava Pestov
4b711b65bd AST: Fix up ReplaceOpaqueTypesWithUnderlyingTypes::operator()
This was constructing abstract conformances with the wrong subject type.
2025-03-31 23:11:21 -04:00
Pavel Yaskevich
35077a01d1 Revert "Sema: Allow optional-to-optional CGFloat <-> Double conversion"
This reverts commit f0f5ffcebf.
2025-03-31 13:58:38 -07:00
Eric Miotto
0c8171f53c build-script: Permit to build compiler-rt with LLVM_ENABLE_RUNTIMES
LLVM-21 plans to remove the legacy method for building compiler-rt
in the same invocation as LLVM using `LLVM_ENABLED_PROJECTS` and
`LLVM_BUILD_EXTERNAL_COMPILER_RT`.

Support the new way of building compiler-rt with a new build-script
opt-in flag `--llvm-build-compiler-rt-with-use-runtimes` --
this will allow a staged introduction, and will ensure we can revert
back to the old behaviour temporarily in case of unforeseen regression.

Since this flag is meant to be short lived, in an attempt to keep the
logic simple we are gating on it only the
CMake cache entries that strictly control the compilation mode, all the
other entries used for configuring are added in both modes.

Take this chance to remove some stale code from `build-script-impl`, and
move some code in the generic CMake product to the LLVM one.

Addresses rdar://147505298
2025-03-31 13:53:08 -07:00
Pavel Yaskevich
62d19c5d45 [ConstraintSystem] Use findSelectedOverloadFor in isArgumentGenericFunction
Fixes a crash when existing logic cannot properly determine whether
argument is resolved or not.

Instead of ad-hoc code that checks `ResolvedOverloads` directly, let's
use a method that would reach of a callee locator to determine whether
argument is a reference to a generic function or not.

Resolves: rdar://137825558
2025-03-28 00:41:13 -07:00
Pavel Yaskevich
6082173b8a Merge pull request #80280 from xedin/rdar-131732245
[TypeChecker] Avoid dropping pre-check diagnostics in `typeCheckParam…
2025-03-27 08:59:43 -07:00
Pavel Yaskevich
d656f74652 [TypeChecker] Avoid dropping pre-check diagnostics in typeCheckParameterDefault
`typeCheck{Expression, Target}` has a pre-check phase which would
replace some invalid AST nodes (i.e. name references that are not
available in the given declaration context) with `ErrorExpr`s and
emit a diagnostic. Such diagnostics were then dropped by `abort()`
call to a diagnostic transaction. This results in invalid code being
accepted by Sema and forwarded to SILGen.

Resolves: https://github.com/swiftlang/swift/issues/73986
Resolves: rdar://131732245
2025-03-26 14:22:32 -07:00
Slava Pestov
c200b0ba44 Add regression test for fixed crasher
This was fixed by 89f5066fb4.
2025-03-26 10:55:46 -04:00
Gábor Horváth
ea225d5485 Merge pull request #80247 from swiftlang/gaborh/partially-enable-test
Partially reenable test
2025-03-25 07:29:17 +00:00
Gabor Horvath
61520d28cf Partially reenable test
A big test was disabled due to one module failing to verify with
sil-opt. This PR reenables the test for all other modules to catch
errors while this particular problem is being looked into.

rdar://143050566
2025-03-24 18:53:29 +00:00
Daniel Rodríguez Troitiño
b0a199e1b8 [test] Isolate swift_build_support.swift testing (#80192)
The test was using the default value for SWIFT_BUILD_ROOT, which tried
to write into `.build_script_log`. Use an environment variable so the
tests use their own directory and write files that do not append to the
actual `.build_script_log`.

Follow up to #80102
2025-03-21 03:36:44 -07:00
Guillaume Lessard
922a01d2ad Merge pull request #80149 from glessard/rdar99047401-sendability-test
[test] sendability of POSIXErrorCode
2025-03-20 11:04:00 -07:00
Alexis Laferrière
461561595d Serialization: Update test that doesn't crash anymore 2025-03-19 16:25:48 -07:00
Alejandro Alonso
25b10ebf76 Merge pull request #78092 from Azoy/enumerated-collection
[stdlib] Conditionally conform EnumeratedSequence to Collection(s)
2025-03-18 09:24:08 -07:00
Ben Barham
8c7f24adff Merge pull request #79950 from bnbarham/re-enable-completion-tests
[Test] Re-enable completion tests that are now fixed
2025-03-14 08:58:36 -07:00