Commit Graph

7723 Commits

Author SHA1 Message Date
Slava Pestov
02ee1a317b Add regression test for fixed crasher 2025-06-02 23:24:13 -04:00
Slava Pestov
dc813a08ca Add regression test for fixed crasher 2025-06-02 22:58:29 -04: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
Slava Pestov
66177e9b9a These tests require asserts 2025-06-02 13:15:01 -04:00
Hamish Knight
59588bc105 [test] Add a few more known type-checker crashers 2025-06-01 17:20:26 +01: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
ea63d04b6c Merge pull request #81866 from hamishknight/fuzzy
[test] Add a couple more known test-checker crashers
2025-05-31 00:15:38 +01:00
Slava Pestov
4e6352d5d9 Sema: Handle bogus DeclNameRefs in translateExprToDeclRefTypeRepr() 2025-05-30 16:27:01 -04:00
Slava Pestov
a3444a0c87 Sema: Handle invalid conformance in ApplyClassifier::classifyApply() 2025-05-30 16:27:01 -04:00
Slava Pestov
d3cf1a42b9 Sema: getBaseIdentifier() => isSimpleName() in synthesizeCodingKeysIfNeededForUnqualifiedLookup() 2025-05-30 16:27:01 -04:00
Slava Pestov
401f527bbb Sema: Don't construct TupleType with InOutType inside 2025-05-30 16:27:01 -04:00
Slava Pestov
6d0c73935b Parse: An empty escaped identifier is entirely whitespace 2025-05-30 16:27:00 -04:00
Slava Pestov
ff941bc4f3 Sema: Fix crash when any is followed by something that doesn't parse as a type 2025-05-30 14:44:58 -04:00
Slava Pestov
0a0019ba76 Sema: Fix null pointer dereference with invalid ParamDecl 2025-05-30 14:44:24 -04:00
Slava Pestov
0e1561f05a Sema: Change a couple of Identifier usages to DeclName instead 2025-05-30 14:43:48 -04:00
Pavel Yaskevich
f31cdb3fec Merge pull request #81852 from xedin/rdar-151943924
[TypeCheckEffects] Fix `AbstractFunction::getType` to look through al…
2025-05-30 11:03:40 -07:00
Hamish Knight
c81f0a868e [test] Add a couple more known test-checker crashers 2025-05-30 16:27:32 +01:00
Pavel Yaskevich
86390ab91f [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
2025-05-29 13:49:15 -07:00
Hamish Knight
b7d26fdfde [test] Add some known type-checker + parser crashers 2025-05-29 16:23:50 +01:00
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