Commit Graph

7604 Commits

Author SHA1 Message Date
Alejandro Alonso
5d5dec3fda Update SequenceType.swift.gyb 2025-03-13 12:47:25 -07:00
Alejandro Alonso
0646c61cf5 Fix bidirectional test to account for RandomAccess 2025-03-13 10:11:51 -07:00
Alejandro Alonso
9894440454 Conditionally conform EnumeratedSequence to Collections 2025-03-13 09:58:09 -07:00
Pavel Yaskevich
9daf23ca8a Merge pull request #79956 from xedin/reenable-SwiftUI-tests
[Tests] NFC: Re-enable rdar://57201781 and rdar://70880670
2025-03-13 00:20:31 -07:00
Pavel Yaskevich
c83eefc41a [Tests] NFC: Re-enable rdar://57201781 and rdar://70880670
A crash that was causing these tests to fail has been resolved.
2025-03-12 11:50:10 -07:00
Ben Barham
c2e05c26c2 [Test] Re-enable completion tests that are now fixed 2025-03-12 08:35:50 -07:00
Slava Pestov
1a38309661 Add a couple of regression tests 2025-03-11 10:20:58 -04:00
Pavel Yaskevich
51c833f2a9 Merge pull request #79617 from xedin/isolate-buildBlock-in-if-and-case-statements
[BuilderTransform] Type-check `buildBlock` of each condition body separately from "join" operation
2025-02-27 16:45:22 -08:00
Pavel Yaskevich
d70f14e936 [BuilderTransform] If: Save result of buildBlock into a variable before using in buildEither
Similar to `case` statements, if chain is non-optional, let's
isolate `buildBlock` of every branch into a separate type variable.
2025-02-25 13:09:35 -08:00
Alastair Houghton
71abe6f26b [Tests] Disable backtracing in some tests.
These tests can be negatively affected by the warnings about unsupported
Swift backtracer settings.

rdar://144497613
2025-02-25 10:53:28 +00:00
Erik Eckstein
328e6aad07 ConstExpr: fix handling of store_borrow
The `store_borrow` instruction has a result and that must be set.
Fixes a false error of the OSLogOptimization.
rdar://144896232
2025-02-19 13:30:07 +01:00
Erik Eckstein
85736fb703 tests: increase timeout of SILOptimizer/large_c_struct.swift
I have to take into account that CI machines are sometimes not so fast.
rdar://144921565
2025-02-16 18:28:13 +01:00
Anthony Latsis
2705212395 Merge pull request #79404 from AnthonyLatsis/fix-rdar141962317-6.2
Sema: Partially revert existential opening fix
2025-02-15 03:40:09 +00:00
Slava Pestov
abf3b32634 Merge pull request #79397 from slavapestov/optional-to-optional-cgfloat-to-double
Sema: Allow optional-to-optional CGFloat <-> Double conversion
2025-02-14 18:28:08 -05:00
Anthony Latsis
43e82b4f7e Sema: Partially revert existential opening fix
Selectively revert 36683a804c to resolve
a source compatibility regression. See inline comment for use case. We
are going to consider acknowledging this use case in the rules in a
future release.
2025-02-14 22:30:28 +00:00
eeckstein
3492b69fc2 Merge pull request #79393 from eeckstein/increase-test-timeout
tests: increase the timeout for `SILOptimizer/large_nested_array.swift.gyb`
2025-02-14 20:40:22 +01:00
Slava Pestov
f0f5ffcebf Sema: Allow optional-to-optional CGFloat <-> Double conversion
After https://github.com/swiftlang/swift/pull/78957, there is no
technical reason to not allow this conversion. This is needed for
an upcoming optimization.
2025-02-14 13:08:57 -05:00
nate-chandler
a829fa2298 Merge pull request #79366 from nate-chandler/rdar141718098
[IRGen] Pack: Scope recursive pack allocations.
2025-02-14 07:13:24 -08:00
Erik Eckstein
b07a06cd16 tests: increase the timeout for SILOptimizer/large_nested_array.swift.gyb
The test run time jumped from ~200s to ~600s on Linux.
Unfortunately I could not reproduce this locally.
But what I saw is that ARCSequenceOpts is taking 75% of the compile time: rdar://144863155

Let's increase the timeout a bit until we can get rid of ARCSequenceOpts.

rdar://144810758
2025-02-14 15:54:38 +01:00
Nate Chandler
1102752604 [IRGen] Pack: Scope recursive pack allocations.
While materializing one metadata pack, another pack may need to be
materialized. When that happens, the inner pack's dynamically sized
allocation must be deallocated within the same dominance scope.

The CFG within which the inner dynamically sized pack is allocated isn't
visible from SIL; that explains why the existing infrastructure around
`de`/`alloc_pack_metadata` instructions fails to produce a deallocation
at the appropriate point.

In the fullness of time, this emitted code should be optimized such that
the inner loop is hoisted out of its current outer loop.

rdar://141718098
2025-02-13 12:11:27 -08:00
Pavel Yaskevich
725bd910be [ConstraintSystem] Revert new disjunction favoring algorithm (#79128)
* Revert "[CSOptimizer] Look through `OptionalEvaluationExpr`s when dealing with unapplied disjunctions"

This reverts commit 72340f39b8.

* Revert "[CSOptimizer] Don't consider disabled overloads when checking whether disjunction is supported"

This reverts commit 6bc23b5057.

* Revert "[CSOptimizer] Disjunctions with IUO overload choices are unsupported"

This reverts commit 471ee21535.

* Revert "[CSOptimizer] MemberImportVisibility: Don't consider overloads that come from implicit imports"

This reverts commit aa4a2b9071.

* Revert "[CSOptimizer] Don't consider CGFloat widening when explicit initializer is used"

This reverts commit 3cc76eacdd.

* Revert "[CSOptimizer] Literal arguments should cause score reset only for operators"

This reverts commit e3987beffb.

* Revert "[CSOptimizer] NFC: check whether a choice is of operator instead of whole disjunction"

This reverts commit 6c82892c3c.

* Revert "[CSOptimizer/Tests] NFC: Add a perf test-case fixed by improved literal array handling"

This reverts commit cfd34e54c4.

* Revert "[CSOptimizer] Extend candidate/parameter matching to support array literals"

This reverts commit 8a304f88c6.

* Revert "[CSOptimizer] Favor choices that don't require application"

This reverts commit 0737542da8.

* Revert "[CSOptimizer] Disable CGFloat -> Double conversion for unary operators"

This reverts commit bc3a15fbe6.

* Revert "[CSOptimizer] Mark bitwise operators as supported"

This reverts commit 860ae08d1b.

* Revert "[CSOptimizer] Simplify handling of non-applied disjunctions"

This reverts commit 43ca7dfff9.

* Revert "[ConstraintSystem] Fix `getEffectiveOverloadType` handling of `mutating` methods"

This reverts commit c767f7aff7.

* Revert "[CSOptimizer] Reduce overload types before ranking"

This reverts commit 95b47aead6.

* Revert "[CSOptimizer] Implement special prioritization rules for result builder contexts"

This reverts commit 56d6635e46.

* Revert "[CSOptimizer] Allow only widening CGFloat->Double conversions while matching candidate arguments"

This reverts commit bf8ae3bc1b.

* Revert "[CSSimplify] CGFloat-Double: Rank narrowing correctly when result is injected into an optional"

This reverts commit cb876cbd9e.

* Revert "[CSBindings] Prevent `BindingSet::isViable` from dropping viable bindings (v2)"

This reverts commit b7e7493076.

* Revert "[CSOptimizer] Add support for chained members without arguments"

This reverts commit 87cd5f8733.

* Revert "[CSOptimizer] Mark compiler synthesized disjunctions as optimized"

This reverts commit 867e64182f.

* Revert "[CSOptimizer] Make a light-weight generic overload check if some requirements are unsatisfiable"

This reverts commit 15c773b9d7.

* Revert "[CSOptimizer] Fix `selectDisjunction` to use favored choices even if disjunction was not optimized"

This reverts commit c2a55886f0.

* Revert "[CSOptimizer] Limit "old" behavior compatibility to unlabeled unary arguments"

This reverts commit 9fb73143f6.

* Revert "[Tests] NFC: Update a couple of type-checker tests"

This reverts commit ff8663ff16.

* Revert "[Tests] NFC: Move simd related test-case from `slow` to `fast`"

This reverts commit 28396a6dce.

* Revert "[CSGen] NFC: Remove obsolete `ConstraintSystem::{get, set}FavoredType`"

This reverts commit 8bd288447f.

* Revert "[CSOptimizer] Allow literal arguments to match parameters that conform to `ExpressibleBy{Integer, Float}Literal`"

This reverts commit 2fdd4b6c35.

* Revert "[CSOptimizer] Adjust `scoreCandidateMatch` to indicate when match cannot be decided"

This reverts commit 9b62c84a4f.

* Revert "[CSOptimizer] Fix Double<->CGFloat implicit conversion support when arguments are literals"

This reverts commit 6caf1ccbb2.

* Revert "[CSOptimizer] A more comprehensive generic overload checking when candidates are fully resolved"

This reverts commit e30587bda4.

* Revert "[CSOptimizer] Restore old hack behavior which used to favor overloads based on arity matches"

This reverts commit a3a3ec4fe0.

* Revert "[CSOptimizer] Desugar types before checking for equality"

This reverts commit 802f5cd105.

* Revert "[ConstraintSystem] Narrowly disable `tryOptimizeGenericDisjunction` when some of the arguments are number literals"

This reverts commit 8d5cb112ef.

* Revert "[CSOptimizer] Infer argument candidates from calls to `Double` and CGFloat constructors"

This reverts commit f2a6677a6d.

* Revert "[CSOptimizer] Score all of the overload choices matching on literals uniformly"

This reverts commit 59109c2d60.

* Revert "[CSOptimizer] Enable ranking of `Int*`, `Float{80}` and `Double` initializers"

This reverts commit 6fb6d1cf90.

* Revert "[CSOptimizer] Rank disjunctions based on score only if both sides are supported"

This reverts commit 8818d399f9.

* Revert "[CSOptimizer] Rank results of operators regardless of whether anything is known about parameters"

This reverts commit 3996b25fbd.

* Revert "[Tests] NFC: Add more test-cases that were previously solved due to old hacks behavior"

This reverts commit d0ff6c81b8.

* Revert "[CSOptimizer] Average score should reflect number of defaulted parameters"

This reverts commit 23589add74.

* Revert "[Tests] NFC: Adjust a couple of improved tests"

This reverts commit 66981364fe.

* Revert "[CSOptimizer] Don't optimize (implicit) calls with code completion arguments"

This reverts commit 8a918e2369.

* Revert "[CSOptimizer] attempt to rank only standard/simd operators and fully concrete overload sets"

This reverts commit deca9b61c5.

* Revert "[CSOptimizer] Record best scores for each disjunction and use them in `selectDisjunction`"

This reverts commit 3819ddfb40.

* Revert "[CSOptimizer] Let `determineBestChoicesInContext` return the best disjunction if one is available"

This reverts commit cf05405eae.

* Revert "[CSOptimizer] Emulate old behavior related to favoring of unary calls to members"

This reverts commit 527de22bec.

* Revert "[Tests] NFC: Add a test-case for rdar://133340307 which is now fast"

This reverts commit 670127abd6.

* Revert "[CSOptimizer] Prefer homogeneous arithmetic operator overloads when argument(s) or result match"

This reverts commit d69b6a0594.

* Revert "[CSOptimizer] Remove an outdated optimization to compare resolved argument types with all else equal"

This reverts commit 1760bd1f1e.

* Revert "[CSOptimizer] NFC: Switch from llvm::Optional to std::optional post-rebase"

This reverts commit c429f5b9ec.

* Revert "[CSOptimizer] Increase score when type matches opaque type"

This reverts commit 2869dff995.

* Revert "[CSOptimizer] NFC: Switch to llvm::Optional"

This reverts commit 0fc6806922.

* Revert "[CSOptimizer] NFC: Adjust conformance check to use `ConstraintSystem::lookupConformance`"

This reverts commit da65333d41.

* Revert "[CSOptimizer] Treat all type parameters equally"

This reverts commit 957a5f4270.

* Revert "[CSStep] Remove disjunction pruning logic from DisjunctionStep"

This reverts commit 2c44e37948.

* Revert "[CSOptimizer] Relax candidate type requirements from equality to set of no-impact conversions"

This reverts commit 11b897b32f.

* Revert "[CSOptimizer] Use `matchCallArguments` to establish argument-to-parameter relationships"

This reverts commit cb1cb2018d.

* Revert "[CSOptimizer] Don't attempt to optimize calls with code completion token(s) in argument position"

This reverts commit 14e2a16fce.

* Revert "[CSOptimizer] Allow generic operator overloads without associated type parameters"

This reverts commit bc5f70a9a3.

* Revert "[CSOptimizer] Make sure that all parameters without arguments are defaulted"

This reverts commit 7c1c46d4e4.

* Revert "[CSStep] Don't favor choices until the disjunction is picked"

This reverts commit e404ed722a.

* Revert "[CSOptimizer] Keep track of mismatches while evaluating candidates"

This reverts commit a094c3ebb0.

* Revert "[CSOptimizer] Favor SIMD related arithmetic operator choices if argument is SIMD<N> type"

This reverts commit c2f7451c7b.

* Revert "[CSOptimizer] Initial implementation of disjunction choice favoring algorithm"

This reverts commit 672ae3d252.

* Revert "[ConstraintSystem] Add skeleton of constraint optimizer"

This reverts commit b5f08a4009.

* Revert "[CSGen] Remove ConstraintOptimizer and all favoring logic"

This reverts commit 4432c51f57.

* Revert "[ConstraintSystem] Remove `shrink`"

This reverts commit 757ca24e8a.

* [TypeChecker] NFC: Remove resurrected use of `SolverShrinkUnsolvedThreshold`

* [TypeChecker] Bring back `SolverDisableShrink`

* [Tests] NFC: Mark tests affected by solver-perf revert as slow

* [Tests] NFC: Adjust async tests that are affected by performance hacks
2025-02-13 08:06:24 -08:00
Hamish Knight
d260bd8ddb [build-script] Remove Xcode generation support
This was quite brittle and has now been superseded
by swift-xcodegen. Remove the CMake/build-script
logic for it, leaving the option behind to inform
users to switch to using xcodegen instead.
2025-02-12 12:19:21 +00:00
Eric Miotto
996408ca6f Merge pull request #79267 from edymtt/edymtt/fix-build_worktree
Ensure `build_worktree.test` runs on Apple Silicon.
2025-02-10 19:17:09 -08:00
Slava Pestov
7f6a8c6804 Add regression test for fixed crasher 2025-02-10 14:07:32 -05:00
Eric Miotto
5d304fb803 Ensure build_worktree.test runs on Apple Silicon.
It looks like in this configuration we need to convince `build-script`
we have `ninja` sources in the worktree.

Resolves #79256
Addresses rdar://144503319
2025-02-10 10:10:06 -08:00
Mishal Shah
46bd549621 Fix the REQUIRES in validation-test/BuildSystem/build_worktree.test 2025-02-09 20:45:30 -08:00
Mishal Shah
1f48b2ca8f [Disabled] 1 BuildSystem test to support new version of Xcode 16.2 and macOS 15.2 https://github.com/swiftlang/swift/issues/79256 2025-02-09 20:03:58 -08:00
Mishal Shah
9f2ce02cfc [Disabled] 6 tests to support new version of Xcode 16.2 and macOS 15.2 https://github.com/swiftlang/swift/issues/79255 2025-02-09 20:01:27 -08:00
Erik Eckstein
d351d10845 tests: add a testfile for a predictable-memory-opt complexity problem.
Reported here: https://github.com/swiftlang/swift/issues/56221
rdar://72885279
2025-02-07 11:30:35 +01:00
Ian Anderson
517ced4f4b [ClangImporter][Tests] clang doesn't support the empty string as a path argument
SIL/verify_all_overlays.py is passing `-F ""` on non-Apple platforms. Swift handles that kind of, but clang doesn't support it and will get argument parsing errors. It's a pathological case, so fix SIL/verify_all_overlays.py to not do that, but also add a failsafe in ClangImporter to not pass on empty paths.

rdar://142441042
2025-02-03 13:06:32 -08:00
Pavel Yaskevich
d245dac784 Merge pull request #79086 from xedin/small-solver-perf-optimizations
[CSOptimizer] A few small performance optimizations
2025-01-31 21:20:50 -08:00
Pavel Yaskevich
72340f39b8 [CSOptimizer] Look through OptionalEvaluationExprs when dealing with unapplied disjunctions
This improves performance for situations like `a?.b + 2` by
giving a high score to `b` which prioritizes it over an operator.
2025-01-31 13:07:29 -08:00
Tim Kientzle
42f0b89f28 Merge pull request #79038 from tbkka/tbkka-rdar143402921-test
Test for #78981
2025-01-30 15:16:12 -08:00
Tim Kientzle
bf624b1461 Fine-tune what environments should run this test 2025-01-30 08:57:38 -08:00
Pavel Yaskevich
aff0f455cf Merge pull request #79026 from xedin/rdar-143474313
[CSBindings] Allow optional subtype inference when closure result is …
2025-01-30 00:37:46 -08:00
Pavel Yaskevich
f5158f8427 Merge pull request #79023 from xedin/rdar-143799118
[CSOptimizer] Disjunctions with IUO overload choices are unsupported
2025-01-30 00:37:33 -08:00
Tim Kientzle
f48f772396 Test for #78981
**Without #78981**: This test triggers "Reflection section too small to contain next record"
errors, indicating that the field information is broken.

**With #78981**: This test runs to completion without triggering
the error message above.
2025-01-29 18:52:17 -08:00
Arnold Schwaighofer
ed3a6d1090 verify_all_overlays.py : This test blocks the nightly toolchain and the failure is being worked on
Temporarily disable it.

rdar://143050566
2025-01-29 13:30:28 -08:00
Pavel Yaskevich
c922ab5634 [CSBindings] Allow optional subtype inference when closure result is not yet resolved
Similar to `Void?` we need to unwrap `$T?` because it could be later
bound to `Void` from context.

Resolves: rdar://143474313
2025-01-29 13:12:56 -08:00
Pavel Yaskevich
471ee21535 [CSOptimizer] Disjunctions with IUO overload choices are unsupported
They form a follow-up disjunction to determine whether force unwrap
is necessary and `getEffectiveType` cannot handle that.

Resolves: rdar://143799118
2025-01-29 10:36:16 -08:00
Alastair Houghton
40185a47c8 Merge pull request #78858 from al45tair/eng/PR-143050566
[Tests] Enable C++ interop for _Backtracing in the overlay verification test.
2025-01-28 22:33:50 +00:00
Dario Rexin
0587075839 Merge pull request #78890 from drexin/wip-143429827
[Runtime] Add compatibility override support for CVW runtime functions
2025-01-28 10:33:52 -08:00
Alastair Houghton
100f2615cb [Tests] Enable C++ interop for Runtime in the overlay verification test.
The Runtime module requires C++ interop enabled, because that's
the only way to robustly fix things so that it is able to declare various
types and constants without clashing with system headers.

To make this work, we also need to add a missing invocation to sil-opt to
make it pick the correct C++ runtime library.

rdar://143050566
2025-01-28 14:21:50 +00:00
Alastair Houghton
ab8e561583 Merge pull request #78516 from al45tair/eng/PR-124913332
[Backtracing] Implement API per SE-0419
2025-01-28 10:48:33 +00:00
Dario Rexin
e15bdc132c [Runtime] Rename CVW entry points for compatibility 2025-01-27 15:43:01 -08:00
Erik Eckstein
172f3caf85 tests: make tests more resilient to optimizations by passing values to _blackHole
Without `_blackHole`, the optimizer may remove or make assumptions about values, which are not intended by the test.
This fixes the tests when running them in optimize mode and when OSSA modules are enabled.

This is part of rdar://140229560.
2025-01-27 10:38:30 +01:00
Erik Eckstein
66e801b0e8 tests: fix lifetimes of objects in two tests
Those tests rely on lexical object lifetimes. But lifetimes are only guaranteed for "variables" but not for temporary objects.
Storing those objects in variables fixes the issue.

This fixes the tests when running them in optimize mode and when OSSA modules are enabled.

This is part of rdar://140229560.
2025-01-27 10:38:30 +01:00
Tim Kientzle
674c76274e Merge pull request #77062 from tbkka/tbkka-remotemirror-133890406
Let indirect enum cases export spare bits
2025-01-24 19:52:59 -08:00
Allan Shortlidge
0b0d2e912c AST: Only apply MemberImportVisibility to lookups from the main module.
MemberImportVisibility rules should only apply to source code in the main
module. The rules were being applied when resolving witnesses for synthesized
Hashable conformances on CF types imported by ClangImporter, which caused the
lookups to fail and bad conformances to be generated.

Resolves https://github.com/swiftlang/swift/issues/78870 and rdar://142433039.
2025-01-23 21:11:18 -08:00
Anthony Latsis
499146df88 Merge pull request #78739 from AnthonyLatsis/hatzegopteryx
TypeCheckType: Rework IUO diagnostics using behavior limitation
2025-01-22 19:12:02 +00:00