Commit Graph

8358 Commits

Author SHA1 Message Date
Aidan Hall 199eb62e2a Merge pull request #89216 from aidan-hall/restore-large-inline-array-test
large_inline_array.swift.gyb: Increase timeout and re-enable
2026-05-20 11:06:47 +01:00
Allan Shortlidge 2ea5a79344 Tests: Mark SILGenFunction-emitThrow-24ea1f.swift as fixed (#89268)
Resolves fall out from https://github.com/swiftlang/swift/pull/88948.
2026-05-19 14:46:09 -07:00
Augusto Noronha 27ba7beb5c Merge pull request #89138 from augusto2112/fix-protocol-typealias-typeref
[RemoteInspection] Fix generic typealiases in DemanglingForTypeRef
2026-05-19 10:47:18 -07:00
Slava Pestov cfc3ebfe4a Fix RUN: line in checkConformance-25eedf.swift (#89253) 2026-05-19 09:56:53 -07:00
Slava Pestov e33a43aa3e Merge pull request #89167 from slavapestov/clean-up-variadic-parameter-requirement-check
Sema: Fix crash when declaring an old-style variadic parameter with nonescaping type
2026-05-18 22:19:08 -04:00
Slava Pestov 4e6d0154f0 Fix mid-air collision 2026-05-18 18:15:03 -04:00
Slava Pestov f05d1cab32 Sema: Fix crash when declaring an old-style variadic parameter with nonescaping type
This is not supported for the same reason you can't have a noncopyable
variadic parameter, but the code was hard-coded to check for copyability
only.

Generalize this to apply the generic signature for Array via the
common code path, and add a custom note to explain why those requirements
are checked in the first place.

Cleaning this up also fixed some fuzzer crashes.

Reported on the forums:
https://forums.swift.org/t/variadic-escapable-arguments-crash-the-compiler/86727/2
2026-05-18 10:49:23 -04:00
Aidan Hall 6297fcd815 large_inline_array.swift.gyb: Increase timeout and re-enable
Increase the timeout to 60 seconds, the originally-intended value.

This test was temporarily disabled in #89022.
2026-05-18 15:24:46 +01:00
Hamish Knight e23410963d [test] Add some more known crashers 2026-05-18 11:19:49 +01:00
Hamish Knight 279221d386 [test] Add a couple of fixed crashers 2026-05-18 11:19:49 +01:00
Augusto Noronha 600d597f59 add test 2026-05-15 14:09:23 -07:00
elsa 83d4291709 CSE Optimizer Pass rewrite (#88248)
Resolves rdar://173862129
2026-05-15 19:11:10 +01:00
Mike Ash acb09e2f87 Merge pull request #88935 from mikeash/remote-mirror-variadic-generic
[Reflection] Support parameter packs in generic substitutions.
2026-05-15 12:35:24 -04:00
Slava Pestov 5831d31302 Merge pull request #89139 from slavapestov/tests-2026-05-14
Sema: Add test cases for three 6.3 regressions that were since fixed
2026-05-15 02:34:42 -04:00
Mike Ash 23fac72075 Merge pull request #88933 from mikeash/remote-mirror-inline-array
[Reflection] Support inspection of InlineArray.
2026-05-14 19:53:11 -04:00
Slava Pestov 3032c70fcb Sema: Add test cases for three 6.3 regressions that were since fixed
- rdar://176848577
- rdar://176813402
- rdar://170160180
2026-05-14 14:58:48 -04:00
Augusto Noronha 12f6b5f403 Merge pull request #89059 from augusto2112/fix-cross-mod-extension
[RemoteInspection] Fix handling of extensions in DemanglingForTypeRef
2026-05-14 10:04:38 -07:00
Augusto Noronha e5873e820b [RemoteInspection] Fix handling of extensions in DemanglingForTypeRef
Typically, the first node of a nested type is the type that contains it.
For example:

```
Demangling for $s7ModBase5OuterV5InnerC
kind=Global
  kind=Class
    kind=Structure
      kind=Module, text="ModBase"
      kind=Identifier, text="Outer"
    kind=Identifier, text="Inner"
$s7ModBase5OuterV5InnerC ---> ModBase.Outer.Inner
```

However, when a type is declared inside an extension of "Outer", that
becomes part of the mangled name too. For example:

```
Demangling for $s7ModBase5OuterV6ModExtE5InnerC
kind=Global
  kind=Class
    kind=Extension
      kind=Module, text="ModExt"
      kind=Structure
        kind=Module, text="ModBase"
        kind=Identifier, text="Outer"
    kind=Identifier, text="Inner"
$s7ModBase5OuterV6ModExtE5InnerC ---> (extension in ModExt):ModBase.Outer.Inner
````

DemanglingForTypeRef did not treat the extension case correctly, and was
losing the extension information. This patch fixes it.

Assisted-by: claude

rdar://176586425
2026-05-13 11:06:13 -07:00
David Smith 660f442f9d Fix a place where the tests were still relying on 2x growth for Strings in some cases (#89055)
Fixes rdar://176701891
2026-05-12 22:03:10 -07:00
Erik Eckstein eaff604f41 tests: don't fail if instruction counts are not available for scale tests
Instead of explicitly limiting those tests to specific platforms, just ignore "No data" results.

rdar://176820820
2026-05-12 21:03:36 +02:00
Doug Gregor b7e23fd2b4 Merge pull request #89022 from DougGregor/disable-timeout-large-inline-array
Disable test that timed out
2026-05-12 02:06:23 -07:00
Hamish Knight ae982b7e17 Merge pull request #89003 from hamishknight/fuzzy
[test] Add some more known crashers
2026-05-12 06:20:00 +01:00
Doug Gregor c378945e35 Disable test that timed out 2026-05-11 21:13:15 -07:00
Slava Pestov 40cb62fb54 Merge pull request #88480 from slavapestov/additional-dynamicmemberlookup-args-v2
[Sema] Support additional args in @dynamicMemberLookup subscripts 2.0
2026-05-11 17:56:52 -04:00
Hamish Knight edd6dac0eb [test] Add some more known crashers 2026-05-11 19:56:47 +01:00
Hamish Knight 59390e2ac3 [test] Add some fixed crashers 2026-05-11 19:56:47 +01:00
Hamish Knight 80e74648e5 [test] Update a couple of crasher signatures 2026-05-11 19:56:47 +01:00
John Hui 9c477bd4fd [PrintAsClang] Don't assert renamed decl is includable in Cxx header printer (#88945)
When generating C++ interop headers with
-experimental-skip-non-exportable-decls, a deprecated method's
@available(*, renamed:) target may not pass shouldInclude(), e.g.,
because the target uses `throws` or types that otherwise can't be
exposed to C++.

Instead of asserting, fall through to print the raw rename string from
the attribute (same behavior as when getRenamedDecl() returns null).

rdar://151425131
2026-05-11 09:27:42 -07:00
Erik Eckstein cfa5dbc9ea tests: fix flaky many_struct_properties_scale_test.swift.gyb and alias_analysis_scale_test.swift.gyb
Measure instruction count instead of user time, because this is more reliable. Unfortunately it's not available on all OSes.
So let's run the tests only on macos.

rdar://176507830
2026-05-11 11:50:02 +02:00
Michael Gottesman b459d31517 Merge pull request #88966 from gottesmm/pr-73b7e458d6172c5f7f494d5650ebdf58f02c66e0
[scale-test] Add some tests for DI/SendNonSendable
2026-05-08 17:09:34 -07:00
Aidan Hall d966ce12ef Merge pull request #88768 from aidan-hall/lifedep-refactored-print
Unified lifetime printing for Swift, SIL and AST dumps
2026-05-08 22:24:00 +01:00
Slava Pestov 1ecb5749e8 Sema: Resolve fixed crash 2026-05-08 15:46:19 -04:00
Slava Pestov a2ed8c66c2 Merge pull request #88875 from slavapestov/fix-rdar152143989
Sema: Don't record bogus trail changes in salvage()
2026-05-08 15:37:53 -04:00
Michael Gottesman d76022a08f [scale-test] Instrument DIMemoryUseCollector with LLVM statistics; add scale test documenting O(N²) stored-property scans
Adds NumStructEltBaseScans statistic to collectStructElementUses() in
DIMemoryUseCollector, which computes struct element base indices by
iterating over all preceding stored properties — O(k) work for property
k, summing to O(N²) over N properties in a non-delegating initializer.

The new di_struct_many_props.gyb scale test uses --invert-result to
document this known-bad quadratic scaling, following the pattern
established by the existing di_many_props and SendNonSendable scale tests.
2026-05-08 12:01:04 -07:00
Michael Gottesman 8b4d9cef83 [scale-test] Add some comments to di_many_props.gyb to explain what it is doing. 2026-05-08 12:01:04 -07:00
Michael Gottesman 01c3d6c8d8 [scale-test] Instrument RequireLiveness with LLVM statistics; add scale test documenting O(N²) inst scans in RequireLiveness::process
Add two LLVM statistics to RequireLiveness::process() in SendNonSendable.cpp:
- NumRequireLivenessProcess: counts calls to RequireLiveness::process()
- NumRequireLivenessInstScans: counts instructions scanned in block loops

Add a scale test documenting the known-bad O(N²) behavior:
- N non-Sendable values are each sent to a @MainActor function, producing N errors
- RequireLiveness::process() is called once per error (N times)
- Each call scans the `if cond` successor block, which contains O(N) instructions
- Total instruction scans: O(N²)

The test uses --invert-result to document this as a known regression, not a pass.
2026-05-08 12:01:03 -07:00
Michael Gottesman 23ff664294 [scale-test] Instrument Partition ops with LLVM statistics; add scale test documenting O(N²) horizontalUpdate in SendNonSendable
Part of developing automated techniques for detecting scale regressions in
region isolation. The approach: add LLVM STATISTIC counters to hot Partition
operations, then use --select in scale-test to track which counter grows
super-linearly as N increases.

This commit instruments four operations in PartitionUtils.cpp:
  - NumPartitionJoin      — calls to Partition::join
  - NumPartitionMerge     — calls to Partition::merge
  - NumHorizontalUpdate   — calls to Partition::horizontalUpdate
  - NumHorizontalUpdateScans — elements scanned inside horizontalUpdate loops

The new GYB scale test (send_non_sendable_join.gyb) selects
NumHorizontalUpdateScans and confirms it grows quadratically: N non-Sendable
values in separate regions on the false branch vs. one merged region on the
true branch forces join() to call merge() N-1 times, each scanning all N
elements via horizontalUpdate's flat-map scan → O(N²) total.

The test uses --invert-result to document the *known-bad* baseline. Once the
algorithm is fixed (e.g. with a union-find structure), remove --invert-result
and tighten the threshold.
2026-05-08 12:01:03 -07:00
Aidan Hall 77637713a8 Merge pull request #88866 from aidan-hall/inline-array-scaling
Add large InlineArray validation test
2026-05-08 12:20:34 +01:00
Mike Ash 2bcfe0b092 [Reflection] Support inspection of InlineArray.
Report the array count as NumFields, and report the same info for each child since InlineArray is homogeneous.

rdar://176382725
2026-05-07 14:39:05 -04:00
Mike Ash 01233ba7a3 [Reflection] Support parameter packs in generic substitutions.
Fill in the GenericParamKind::TypePack case in MetadataReader's getGenericSubst method.

rdar://165872192
2026-05-07 14:31:23 -04:00
Hamish Knight 3312da4fdd Merge pull request #88872 from hamishknight/remove-dupes
[test] Remove duplicate tests
2026-05-07 16:56:41 +01:00
Hamish Knight cf59ed37c4 [test] Remove duplicate tests
These duplicate:
- 00178-llvm-foldingset-swift-genericsignature-nodeequals.swift
- 00342-getselftypeforcontainer.swift
- test/Generics/nested_type_reference.swift
- 25349-swift-typechecker-validatedecl.swift
- 28413-swift-typebase-getcanonicaltype.swift
- test/Constraints/rdar44770297.swift
2026-05-07 11:50:58 +01:00
Erik Eckstein ba0b04559e ComputeEscapeEffects: add a complexity limit for escape analysis of function arguments
Similar to what we do in AliasAnalysis

related to rdar://175999887
2026-05-07 09:52:14 +02:00
Erik Eckstein bdc1c4d34f AliasAnalysis: use a complexity limit in getApplyEffect
Like we do in other parts of AliasAnalysis which call into escape analysis.

Fixes a compile time problem.
rdar://175937160
2026-05-07 09:52:14 +02:00
Ben Cohen 8cb5dfc117 AST: don't propagate null Type from invalid associated conformance (#88873)
When a pattern conformance in the pack is invalid (e.g. its underlying
conformance failed because of a prior diagnostic),
`getAssociatedConformance` returned an invalid `ProtocolConformanceRef`
whose `getType()` is null. The null type was pushed into `packElements`
and tripped an assertion in `PackType::get`. Substitute `ErrorType` for
the null so substitution can complete and the existing diagnostics
surface to the user.

Fixes https://github.com/swiftlang/swift/issues/88434.
2026-05-06 22:04:22 -07:00
Slava Pestov 6db1fd00e9 Sema: Don't record bogus trail changes in salvage()
In salvage(), there is a point where we're done solving, but we haven't
yet torn down ConstraintSystem::solverState, so the trail is still
active.

It was possible to cause a change to be recorded, because of the
path compression we do in TypeVariableType::getRepresentative().

We have a similar situation where we don't want to do path compression
when we're looking up a type variable's representative in the middle
of undo(). Generalize the existing UndoActive flag to Closed, and set
it after solving in salvage() as well.

While we're here, clean up an existing place where we would check
isUndoActive() to not do that anymore, so now getRepresentative() is
the only place that checks the state of the trail.

A better cleanup would be to try to refactor or eliminate SolverState
entirely, but this fix is pretty clean.

Note that the test cases are somewhat random because the exact scenario
is hard to trigger; you need to set up an invalid expression where the
type variables are set up in just the right way so that path compression
kicks in.

- Fixes rdar://152143989.
- Fixes https://github.com/swiftlang/swift/issues/81801.
- Fixes https://github.com/swiftlang/swift/issues/84884.
2026-05-06 11:51:40 -04:00
Aidan Hall 87e95af3c5 tests: + Large InlineArray validation test
This validates that InitializeStaticGlobals correctly folds an initializer list
for a global InlineArray to a static value.
2026-05-06 15:44:55 +01:00
Aidan Hall ad77d9fbf0 Lifetimes: Mark source list string crasher as fixed 2026-05-06 11:02:52 +01:00
Hamish Knight 0dabc9f09b [test] Add some more known crashers 2026-05-05 22:17:12 +01:00
Hamish Knight 079d36cd17 [test] Update a couple of crasher signatures 2026-05-05 22:17:12 +01:00