If a conformance is unavailable then checking for the potential unavailability
of a witness doesn't make sense so skip it. This is necessary now because
availability scopes no longer constrain the platform introduction version for a
source range in that is annotated in source to be simultaneously unavailable
and also introduced in a later version.
This fixes a regression caused by https://github.com/swiftlang/swift/pull/79249.
Resolves rdar://145255592.
- Track environments for `PackExpansionExpr` directly
instead of using a locator.
- Split up the querying and creation of the environment
such that the mismatch logic can be done directly in
CSSimplify instead of duplicating it.
- Just store the environment directly instead of
the shape and UUID.
Resolve a couple of FIXMEs by using `dumpAnchor` to
dump a couple of ASTNodes. This uses the same
compact representation as used in ConstraintLocator
dumping.
* Collect flag in `ParamDecl::setTypeRepr()`.
* [ASTGen] Separate `BridgedParamDecl.setTypeRepr(_:)` from
`BridgedParamDecl.createParsed(_:)` aligning with C++ API. The majority
of the creations don't set the typerepr.
* Update `ParamSpecifierRequest::evaluate` to handle non-implicit
`ParamDecl` without `TypeRepr` (i.e. untyped closure parameter), instead
of `setSpecifier(::Default)` manually in Parse.
These should have been opened already, and the logic in
simplifyConstraint(), matchTypes(), etc is just going to do
undefined things if they end up there, so let's guard
against it happening.
In the future, the `DeclContext` for a given scope will be needed as an input
in order to query for the `AvailabilityDomain` associated with an
`AvailabilitySpec`.
According to the proposal both variants cannot be used together
with other forms of isolation i.e. isolated parameters, global
actors, `@isolated(any)` attributes.
Eventually, querying the `AvailabilityDomain` associated with an
`AvailabilitySpec` will require invoking a request that takes a `DeclContext`.
This means that any diagnostics related to the domain identified by an
`AvailabilitySpec` need to be emitted during type-checking rather than parsing.
This change migrates several `AvailabilitySpec` diagnostics from Parse to Sema
to unblock further work.
Something changed here between the removal of shrink() and it's
re-introduction, and we now record constraints that contain
UnboundGenericType, which crashes in matchTypes().
As a narrow workaround, let's just ignore the contextual type if
contains an UnboundGenericType.
Fixes rdar://145092838.
Make sure we set the correct DeclContext for CSGen
of multi-statement closure captures, since
otherwise the DeclContext is set to the closure
itself, which is wrong.
Similar to multi-statement closures, we need to
make sure we change the DeclContext of the
ConstraintSystem when solving a conjunction for an
if/switch expression. This is unfortunately needed
for cases within single-expression closures since
they can't switch the system's DeclContext (as
they're solved together with the rest of the system).
In a swiftinterface a declaration could be unavailable because it was written
in source with an `@_spi_available` attribute so it isn't possible to safely
reject unavailable stored properties in that context.
Resolves rdar://144958440.
Switch to calling `swift::getAvailabilityConstraintsForDecl()` to get the
unsatisfied availability constraints that should be diagnosed.
This was intended to be NFC, but it turns out it fixed a bug in the recently
introduced objc_implementation_direct_to_storage.swift test. In the test,
the stored properties are as unavailable as the context that is accessing them
so the accesses should not be diagnosed. However, this test demonstrates a
bigger issue with `@objc @implementation`, which is that it allows the
implementations of Obj-C interfaces to be less available than the interface,
which effectively provides an availability checking loophole that can be used
to invoke unavailable code.
Since we infer unsafety from a use of a declaration that involves unsafe types
in its signature, there isn't a reason to require @unsafe on declaration to
restate it. This matches recent revisions of SE-0458.
Update the concurrency typechecking logic to remove a check that allowed
mutable static variable declarations nested within an Actor type to be
ignored when diagnosing mutable non-Sendable state.