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
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
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
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
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.
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.
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.
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.
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.