Commit Graph

7889 Commits

Author SHA1 Message Date
finagolfin
4a3ef140d8 [build] Make the new --cross-compile-build-swift-tools flag public (#83422)
This new flag makes it easy to build Swift cross-compilation toolchains,
by disabling cross-compilation of all host tools, like the Swift
compiler and various macros, building on prior pulls #38441 and #82163.

Native compilation has more fine-grained flags like
`--build-swift-tools`, `--build-llvm`, and `--swift-testing-macros`, but
those will disable building them for _all_ platforms (with the exception
of `--build-swift-tools`, which I modified to only apply for the host,
since the initial introduction of this
`--cross-compile-build-swift-tools` flag a couple months ago), so
they're not suited for building a cross-compilation toolchain, where you
want all host tools built for the native host but not for any
cross-compilation SDKs.
2025-08-09 13:51:11 +05:30
Karoy Lorentey
847df728fc [test] Resolve failures detected by CI 2025-08-08 14:01:09 -07:00
Allan Shortlidge
5e246174a9 Merge pull request #83607 from tshortli/allow-obsolete-in-unavailable-contexts
Sema: Rationalize availability checking in unavailable contexts
2025-08-08 13:00:10 -07:00
Allan Shortlidge
4d41db3b5d Sema: Rationalize availability checking in unavailable contexts.
Correct several behaviors of availability checking in unavailable contexts that
were inconsistent with the checking model:

- Avoid diagnosing unintroduced and obsolted declarations in contexts that are
  unavailable in the same domain.
- Diagnose unavailability normally in type signature contexts.
2025-08-08 07:57:44 -07:00
Hamish Knight
5755fb293f Merge pull request #83585 from hamishknight/ext-info
Avoid dropping ExtInfo in `replaceParamErrorTypeByPlaceholder`
2025-08-08 09:53:12 +01:00
Evan Wilde
95dfa3d818 Merge pull request #83579 from etcwilde/ewilde/test-use-module-triple
Tests: Use variant module triple
2025-08-07 10:20:09 -07:00
Hamish Knight
0bd1ff0572 Avoid dropping ExtInfo in replaceParamErrorTypeByPlaceholder
Make sure we preserve the info to avoid hitting an assert.
2025-08-07 12:17:03 +01:00
Anthony Latsis
7acd1043b6 Merge pull request #83577 from swiftlang/jepa-main
[test] Pass cmake location to build-script invocation in test
2025-08-07 09:43:08 +01:00
Evan Wilde
1f06214ce6 Tests: Use variant module triple
This switches from using lit.cfg to attempt to recompute the module
triple to using the triple computed in CMake to ensure consistency.
This is a better source of truth than having many sources everywhere.

In case anyone sees this and is wondering, the "target triple" refers to
the triple that the compiler is built for, while the "variant triple"
refers to the platform that the tests and runtimes are built for.
2025-08-06 18:06:34 -07:00
Anthony Latsis
54322b22d5 [test] Pass cmake location to build-script invocation in test
The test fails without it with Xcode 26 beta
2025-08-07 00:09:10 +01:00
Allan Shortlidge
cadae7db97 Merge pull request #83570 from xedin/make-simd-perf-test-less-flaky
[TypeCHecker] Tests/NFC: Restrict SIMD performance test to macOS only
2025-08-06 14:13:31 -07:00
Evan Wilde
8a06a01577 FreeBSD: XFAIL cmark_crosscompiling_using_toolchain
FreeBSD isn't using toolchain files at the moment so this test is
failing. XFAIL'ing it on FreeBSD. If/when we do switch, the XFAIL should
fail, and we can re-enable it then.
2025-08-06 09:56:56 -07:00
Pavel Yaskevich
3d6ed73429 [TypeCHecker] Tests/NFC: Restrict SIMD performance test to macOS only
The test is flaky in some simulator and x86_64 configurations, let's
try to restrict it even further to minimize CI impact.

Resolves: rdar://157636003
2025-08-06 09:33:18 -07:00
Karoy Lorentey
3e18a07187 [stdlib] Fix implementation of Unicode text segmentation for word boundaries
Carefully overhaul our word breaking implementation to follow the recommendations of Unicode Annex #29. Start exposing the core primitives (as well as `String`-level interfaces), so that folks can prototype proper API for these concepts.

- Fix `_wordIndex(after:)` to always advance forward. It now requires its input index to be on a word boundary. Remove the `@_spi` attribute, exposing it as a (hidden, but) public entry point.
- The old SPIs `_wordIndex(before:)` and `_nearestWordIndex(atOrBelow:)` were irredemably broken; follow the Unicode recommendation for implementing random-access text segmentation and replace them both with a new public `_wordIndex(somewhereAtOrBefore:)` entry pont.
- Expose handcrafted low-level state machines for detecting word boundaries (_WordRecognizer`, `_RandomAccessWordRecognizer`), following the design of `_CharacterRecognizer`.
- Add tests to reliably validate that the two state machine flavors always produce consistent results.

rdar://155482680
2025-08-05 20:04:46 -07:00
Hamish Knight
3db1a66f08 Merge pull request #83514 from hamishknight/add-assert-msgs
[test] Add assertion messages to crasher test cases
2025-08-04 23:05:32 +01:00
Pavel Yaskevich
7d75f712b6 Merge pull request #83511 from xedin/rdar-152553143
[CSSyntacticElement] Remove an assert that is too strict
2025-08-04 14:09:09 -07:00
Hamish Knight
760959f273 [test] Add assertion messages to crasher test cases
If the crasher hits an assertion failure, include the message in the
header.
2025-08-04 13:00:23 +01:00
Pavel Yaskevich
3879a47b52 [CSSyntacticElement] Remove an assert that is too strict
`return` statement withot an expression automatically gets an
implicit `()` which is allowed to be converted to types like
`()?` and `Any` or `Any?`. Let's remove a too strict assertion
that expected a contextual type to always be `()?` even
through in reality any type that `()` is convertible to is valid.

Resolves: rdar://152553143
2025-08-04 00:17:26 -07:00
Hamish Knight
cfa8135261 [test] Add some more known crashers 2025-08-04 00:44:41 +01:00
Hamish Knight
3d6c240aa6 Merge pull request #83504 from hamishknight/update-sigs
[test] Update some crasher signatures
2025-08-02 22:48:02 +01:00
Hamish Knight
a012464566 [test] Update some crasher signatures 2025-08-02 17:35:53 +01:00
finagolfin
09a751f698 [build][android] Use a CMake toolchain file to cross-compile Testing (#83260)
Also, disable a recently failing test for Android armv7 and enable another one
that now passes.
2025-08-02 15:27:45 +05:30
Hamish Knight
fb7f2d0ff2 [CS] Limit the number of chained @dynamicMemberLookup lookups
Set an upper bound on the number of chained lookups we attempt to
avoid spinning while trying to recursively apply the same dynamic
member lookup to itself.

rdar://157288911
2025-08-01 19:08:04 +01:00
Hamish Knight
aac9c4dec6 [test] Add timeout for fd52bd37cd5c96.swift
Make sure we either crash or timeout after a minute.
2025-07-30 15:13:50 +01:00
Hamish Knight
ae0f9f51d8 [test] Add some more known crashers 2025-07-28 11:14:13 +01:00
Hamish Knight
74601b5e58 [test] Remove duplicate test case
This is essentially the same as `4414db6acd8120aa.swift`.
2025-07-28 11:14:13 +01:00
Hamish Knight
d7c30cd965 [test] Update a couple of crasher signatures 2025-07-28 11:14:13 +01:00
Slava Pestov
5866d8a36a Sema: Fix crash with invalid reference to macro 2025-07-24 12:55:47 -04:00
Pavel Yaskevich
3b06d87e90 Merge pull request #83179 from xedin/rdar-128109889
[ASTVerifier] Allow `inout` and `Array` to pointer conversion in vari…
2025-07-23 07:48:58 -07:00
Pavel Yaskevich
24210cf2d4 Merge pull request #83210 from xedin/rdar-143586718
[Concurrency] InferSendableFromCaptures: Rework check to delay lookup
2025-07-23 00:23:18 -07:00
Hamish Knight
860f398162 Merge pull request #83198 from hamishknight/fuzzy
[test] Add some more known crashers
2025-07-22 18:50:30 +01:00
Hamish Knight
cb0a21da2a Merge pull request #83170 from hamishknight/fix-assert
[IDE] Fix assertion failure in `PostfixCompletionCallback::Result::tryMerge`
2025-07-21 18:48:03 +01:00
Pavel Yaskevich
94e28b63d7 [Concurrency] InferSendableFromCaptures: Rework check to delay lookup
The current implementation of the check accounts only for the overload
choices present in the initial lookup but for some situations, like
bridged or optional base types, `performMemberLookup` uses a secondary
lookup as well, results of which are ignored.

Let's fold the check into `addChoice` instead and set the the flag there
to make sure that all of the choices are considered.

Resolves: rdar://143586718
2025-07-21 10:33:46 -07:00
Hamish Knight
994b9d197b [test] Add some more known crashers 2025-07-21 10:47:59 +01:00
Hamish Knight
03f74ff394 [test] Update a couple of crasher signatures 2025-07-21 10:47:59 +01:00
Hamish Knight
347d94bda5 [test] Add some alias crash signatures
The signatures here are bogus, put the correct signatures in as
aliases.
2025-07-20 18:46:18 +01:00
Hamish Knight
a2d707be2a [test] Remove duplicate test case
This is essentially the same as `8668a3eb11f2baf.swift`.
2025-07-20 18:32:45 +01:00
Hamish Knight
7e22f9264b [test] Update some crasher signatures
The signatures have changed here either due to code changes in the
repo or due to improvements to the signature detection, update the
test cases.
2025-07-20 18:32:38 +01:00
Slava Pestov
b70f8a82b1 Sema: Improve the infinite opaque return type check
Now look through other opaque return types that appear in the
underlying type. This catches various forms of recursion that
otherwise would cause a SILGen or SILOptimizer crash.

- Fixes rdar://82992151.
2025-07-18 20:03:03 -04:00
Slava Pestov
7b0ad4a6c8 Sema: Add a type checker test that is now fast
release/6.2 chokes on this file. Nice work @xedin :)
2025-07-18 19:12:33 -04:00
Pavel Yaskevich
b5aa8173ce [ASTVerifier] Allow inout and Array to pointer conversion in variadic parameter positions
Fixes a verifier crash that prevented use of valid conversions.

Resolves: https://github.com/apple/swift/issues/73454
Resolves: rdar://128109889
2025-07-18 11:35:21 -07:00
Hamish Knight
62f1303bca [IDE] Fix assertion failure in PostfixCompletionCallback::Result::tryMerge
Unfortunately due to pre-checking multiple times the recorded
application level can change. Just OR the bits together.
2025-07-18 11:00:37 +01:00
Evan Wilde
22f32e0e87 Merge pull request #83106 from etcwilde/ewilde/freebsd-test-updates
FreeBSD: Fix issues in tests
2025-07-17 08:25:38 -07:00
Hamish Knight
213ad8aa8c Merge pull request #83096 from hamishknight/ret
[Sema] Set ReturnStmt result even if type-checking fails
2025-07-17 02:58:26 +01:00
Evan Wilde
79f7b638eb FreeBSD: Testing: pthread handling
Fixing pthread usage in tsan and tsan-inout tests. pthreads are imported
as opaque pointers on FreeBDS, and thus need to be kept in an optional
pthread_t, like on Apple platforms.

Unlike on macOS, pthread_join is not annotated with nullability
annotations and thus takes an optional opaque pointer, so we don't need
to unwrap it.
2025-07-16 11:16:41 -07:00
Evan Wilde
3316e82af3 FreeBSD: Disable SIMDParameterPassing
The SIMD module is not available on FreeBSD, disabling it.
2025-07-16 11:01:13 -07:00
Hamish Knight
72db18073c [Sema] Set ReturnStmt result even if type-checking fails
Make sure we set the updated expression since e.g pre-checking may
have folded a top-level SequenceExpr that we need to remove from the
AST.
2025-07-16 14:40:57 +01:00
Slava Pestov
ee440f3c91 AST: Remove MakeAbstractConformanceForGenericType
While the intent behind this functor was noble, it has grown in complexity
considerably over the years, and it seems to be nothing but a source of
crashes in practice. I don't want to deal with it anymore, so I've decided
to just subsume all usages with LookUpConformanceInModule instead.
2025-07-15 16:34:11 -04:00
Hamish Knight
818979fed8 Merge pull request #83034 from hamishknight/origami
[Sema] Avoid folding sequences multiple times
2025-07-15 09:14:55 +01:00
Hamish Knight
95a96f5593 Merge pull request #83026 from hamishknight/fuzzy 2025-07-15 03:54:25 +01:00