Commit Graph

8015 Commits

Author SHA1 Message Date
Hamish Knight
c23de594fc Merge pull request #84981 from hamishknight/give-me-closure
[ASTScopes] Avoid relying on `in` SourceLoc for closures
2025-10-18 12:44:12 +01:00
Hamish Knight
ffd3a4849c [test] Include signatures in crasher filenames 2025-10-17 20:22:28 +01:00
Hamish Knight
8232345b68 [ASTScopes] Avoid relying on in SourceLoc for closures
Missed this in my previous patch, avoid relying on the `in` location
for closures with parameters and capture lists. Instead, form scopes
that start at the first element of the body. This fixes a crasher
uncovered by the fuzzer.
2025-10-17 15:21:53 +01:00
Hamish Knight
e0e71183b2 [Sema] Quick fix for non-copyable type resolution crash
Add a guard to make sure we don't attempt to check for Copyable
conformance if the type contains type variables. This matches the
existing behavior where we won't check for unbound generic types.
Neither behavior is correct since we won't do the proper check once
the generic type is opened, but this at least makes the behavior
consistent and fixes the crash. It's also a very low risk fix that
can be cherry-picked.

rdar://152287178
2025-10-16 16:17:49 +01:00
Slava Pestov
72e861d8c9 Merge pull request #84922 from slavapestov/fix-flaky-scale-test
We need at least 7 samples for scale-test to produce a reliable result
2025-10-15 21:27:09 -04:00
Anthony Latsis
3ffbcfd1be Merge pull request #84886 from swiftlang/jepa-main2
[test] Add crasher for https://github.com/swiftlang/swift/issues/84884
2025-10-15 23:01:39 +01:00
Slava Pestov
0aece0c28e We need at least 7 samples for scale-test to produce a reliable result
One test was miscategorized as 'fast' because of this issue, but it
would occasionally fail. It turns out it always fails once you ask
for 7 points or more, so let's fix that and move it back to 'slow'.

Fixes rdar://162597936.
2025-10-15 16:13:25 -04:00
eeckstein
79960d4f58 Merge pull request #84888 from eeckstein/remove-access-path-verification
Optimizer: don't run AccessPathVerification
2025-10-15 13:18:35 +02:00
Slava Pestov
faf38d7de1 Sema: A few more type_checker_perf tests 2025-10-14 14:42:56 -04:00
Slava Pestov
ce9e7cc656 Sema: A couple of type checker tests were incorrectly in the 'slow' directory
They're actually fast.

Also, change -solver-expression-time-threshold=1 into a scope limit to make it
deterministic.
2025-10-14 14:42:02 -04:00
Erik Eckstein
7dc4952b98 Revert "[test] Disable test to unblock CI"
This reverts commit e3a125a43f.
2025-10-14 20:17:43 +02:00
Anthony Latsis
1ea58c47a8 [test] Add crasher for https://github.com/swiftlang/swift/issues/84884 2025-10-14 19:04:36 +01:00
Hamish Knight
b14dc227f7 Merge pull request #84855 from hamishknight/loc-ness-monster
[Parse] Avoid setting closure `in` SourceLoc if missing
2025-10-14 09:16:12 +01:00
Anthony Latsis
e3a125a43f [test] Disable test to unblock CI 2025-10-14 02:15:10 +01:00
Hamish Knight
b83cf1eaa5 [Parse] Avoid setting closure in SourceLoc if missing
Clients should be able to handle closures without a valid `in`
SourceLoc, let's avoid setting it to a recovery location. This avoids
crashing in cases where we set an `in` loc that's after the closure's
end loc.
2025-10-13 15:34:57 +01:00
Hamish Knight
a8be69f33b [test] Add some more known crashers 2025-10-13 10:00:10 +01:00
Hamish Knight
109383a9ac [test] Update some crasher signatures 2025-10-13 00:30:19 +01:00
Anthony Latsis
c6e814fccf Merge pull request #84823 from lexiippolito/validation-test
Add regression test for https://github.com/swiftlang/swift/issues/74609
2025-10-11 06:49:27 +01:00
Lexi Ippolito
f76a7a16e7 validation-test: Add regression test for https://github.com/swiftlang/swift/issues/74609 2025-10-10 15:59:00 -05:00
Hamish Knight
452b99ab62 Merge pull request #84799 from hamishknight/round-objects
[AST] Avoid computing `getValueType` in `GenericTypeParamType`'s decl constructor
2025-10-10 14:56:33 +01:00
Hamish Knight
d165b6fa17 [AST] Avoid computing getValueType in GenericTypeParamType's decl constructor
Doing so can result in a request cycle for the interface type, which
results in an ErrorType, which violates the assumption that a
`GenericTypeParamDecl` always has a `GenericTypeParamType` interface
type. We already have the code in place to defer the query to the decl,
so we don't actually need to set it at all.
2025-10-09 23:17:31 +01:00
nate-chandler
f2188f6ff5 Merge pull request #84776 from nate-chandler/rdar162237650
[DeadObjectElim] Bail on invalid access path.
2025-10-09 14:36:25 -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
Nate Chandler
52822ded70 [DeadObjectElim] Bail on invalid access path.
rdar://162237650
2025-10-09 06:34:08 -07:00
Hamish Knight
57557dec8e [Evaluator] Enforce consistent results for cyclic requests
Record when we encounter a request cycle, and enforce that the outer
step of the cycle also returns the default value. This fixes a couple
of crashers where we were ending up with conflicting values depending
on whether the request was queried from within the cycle or from
outside it.
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
Anthony Latsis
537353074d Merge pull request #84730 from swiftlang/jepa-main2
RequirementMachine: Diagnose unsupported value generic parameter definitions properly
2025-10-08 21:12:00 +01:00
Anthony Latsis
58fa8bf762 RequirementMachine: Diagnose unsupported value generic parameter definitions properly
The flow was such that we recorded subtype constraints regardless of the
subject type's nature. Extract value generics handling out of the
devious `else if` chain, and never record any subtype constraints if the
subject type is a non-type parameter.

While we're here, generalize the diagnostic message for user-written
subtype constraints on value generic parameters and emit it
consistently, not just if the right-hand side contains a protocol type.
2025-10-08 02:13:03 +01:00
Becca Royal-Gordon
60b3b088d5 Merge pull request #84358 from beccadax/common-concurrency 2025-10-07 12:21:50 -07:00
Hamish Knight
11d299c212 Merge pull request #84698 from hamishknight/carousel
[Evaluator] Avoid emitting duplicate "through reference here" notes
2025-10-07 20:14:52 +01:00
Henrik G. Olsson
d3214de950 Merge pull request #84685 from hnrklssn/verify-all
This adds the -verify-ignore-unrelated flag. When -verify is used without -verify-ignore-unrelated, diagnostics emitted in buffers other than the main file and those passed with -verify-additional-file (except diagnostics emitted at <unknown>:0) will now result in an error. They were previously ignored. The old behaviour is still available as opt-in using -verify-ignore-unrelated, but by being strict by default it should make it harder to accidentally miss diagnostics.

To avoid unnecessary performance overhead, -verify-additional-file is still required to parse the expected-* directives in files other than the main file.
2025-10-06 18:01:47 -07:00
Slava Pestov
fbad38093e Merge pull request #84716 from slavapestov/fix-test-again
Add -target argument to type_checker_perf/fast/issue-54795.swift
2025-10-06 20:00:45 -04:00
Slava Pestov
3797dd910f Add -target argument to type_checker_perf/fast/issue-54795.swift
Hopefully fixes rdar://161224041.
2025-10-06 14:52:17 -04:00
Hamish Knight
74fcee3982 [test] Add some more known crashers 2025-10-06 11:50:39 +01:00
Hamish Knight
1186721fd3 [test] Update a couple of crasher signatures 2025-10-06 11:50:39 +01:00
Henrik G. Olsson
1ed646efd6 add -verify-ignore-unrelated to some more tests 2025-10-05 14:01:44 -07:00
Hamish Knight
9a9a6a3b98 Merge pull request #84694 from hamishknight/tuple-trouble
[Sema] Reject tuple extensions early when feature is disabled
2025-10-05 20:53:37 +01:00
Hamish Knight
13023de4c4 [Evaluator] Avoid emitting duplicate "through reference here" notes
Filter out any duplicate notes to help cut down on the noise for
request cycle diagnostics. Some of the note locations here still aren't
great, but this at least stops us from repeating them for each
intermediate request.
2025-10-05 20:48:08 +01:00
Slava Pestov
811a201bc1 Merge pull request #84675 from slavapestov/rqm-protocol-failure-bookkeeping
RequirementMachine: New way of propagating failure when building rewrite system for protocol
2025-10-05 14:10:00 -04:00
Hamish Knight
8ec8902e56 [Sema] Reject tuple extensions early when feature is disabled
Tuple extensions are still an experimental feature, but we have a
number of crashers in the repo for them because we still use their
type-checker machinery even when disabled. Change the logic here such
that we reject them early in extension binding when the feature is
disabled. This will ensure we address the crashers before productizing.
2025-10-05 11:22:54 +01:00
Hamish Knight
d06d12632b Merge pull request #84666 from hamishknight/can-opener
[CS] Consolidate placeholder handling logic into `Solution::simplifyType`
2025-10-04 22:55:38 +01:00
Henrik G. Olsson
cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00
Slava Pestov
244d2afea3 RequirementMachine: New way of propagating failure when building rewrite system for protocol
If we failed to construct a rewrite system for a protocol, either because
the Knuth-Bendix algorithm failed or because of a request cycle while
resolving requirements, we would end up in a situation where the resulting
rewrite system didn't include all conformance requirements and associated
types, so name lookup would find declarations whose interface types are
not valid type parameters.

Fix this by propagating failure better and just doing nothing in
getReducedTypeParameter().

Fixes rdar://147277543.
2025-10-04 09:17:46 -04:00
Hamish Knight
669a2ce9b0 [CS] Sink placeholder handling logic into Solution::simplifyType
Move the logic from `FailureDiagnostic::resolveType` into
`Solution::simplifyType` to allow completion to use it too. While
here, also handle cases where the placeholder is from a different
member of the equivalence class to the generic parameter.
2025-10-04 12:56:52 +01:00
Hamish Knight
7e5dfc28fa [CS] Split out element archetype handling in resolveType
Make sure we do this after we transform the type as otherwise we could
skip resolving type variables and let them escape.
2025-10-04 12:56:52 +01:00
nate-chandler
615b2994d8 Merge pull request #84667 from nate-chandler/rdar161606892_2
[VariadicGenerics] Fix memeffect of metadata accessor call.
2025-10-04 03:01:51 -07:00
Daniel Rodríguez Troitiño
e9ca11e669 [test] Add requires for embedded_stdlib for test that uses the stdlib (#84656)
The test enables the Embedded experimental feature, but beside the
compiler support, it also requires loading the stdlib for embedded, but
the test is not marked as such. For configurations that do not build the
embedded stdlibs, this makes the test fail, because the stdlib is not
available. Mark it with the appropriate requires to avoid this problem.

This should not change the results in the swift.org CI because those CI
configurations build the embedded stdlibs by default.
2025-10-03 13:57:33 -07:00
Nate Chandler
8332b7c03f [VariadicGenerics] Fix memeffect of metadata accessor call.
Follow up to https://github.com/swiftlang/swift/pull/84635/.

The metadata accessor for a variadic generic type takes as arguments
packs of metadata records and witness tables, and each such pack is
passed in a buffer. So the call to any such accessor is not correctly
annotated memory(none).

rdar://161606892
2025-10-03 09:13:42 -07:00
nate-chandler
580f2e4fd6 Merge pull request #84635 from nate-chandler/rdar161606892
[VariadicGenerics] Fix memeffect of metadata accessor.
2025-10-02 19:14:52 -07: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