The two GatherKinds no longer share any implementation, so there's
no point keeping the logic together. Doing this also allows removing
the acceptConstraintFn from gatherAllConstraints(), which further
simplifies depthFirstSearch().
Fixes a regression from commit 0c128e5db7.
The old depthFirstSearch() walked all adjacencies via the constraint graph,
and thus it would visit type variables that are currently inactive because
we're solving a conjunction element.
This was inconsistent with the new union-find which only formed the
connected components from the currently active type variables; adjacencies
involving inactive type variables are no longer considered.
Fix the inconsistency by changing gatherConstraints(), which used from
addTypeVariableConstraintsToWorkList(), to also skip inactive type
variables.
Fixes rdar://problem/143340082.
When a method override is as available as the class it's a member of, then it
can't be any more available. It doesn't make sense to diagnose such a method as
less available than the method it overrides. This regressed recently for
methods belonging to classes that are nested inside extensions. The
availability of the derived class may be defined by its context, but the
compiler was only checking the availability attributes directly on the class.
Resolves rdar://143600638.
Since the domain is now resolved by SemanticAvailableAttrRequest, diagnosing
attributes with invalid combinations of fields for a specific domains needs to
be delayed.
We don't want to do that in general because injection should happen
only in one place but Void is special because it allows conversions
in that position.
This can happen when we're generating constraints and resolving the
type annotations written in a closure expression. Just skip the
non-copyable check in this case.
Fixes rdar://problem/143031466.
Specifically, rather than performing the interception in ActorIsolationRequest
itself after we have returned an actor isolation from
getIsolationFromAttributes, just do it in getIsolationFromAttributes.
The reason I am doing this is then the code around how we infer isolation in
such a case is centralized in getIsolationFromAttributes instead of being in
both places.
This is a NFC change.
Downgrade the `cannot be more available than enclosing scope` error to a
warning when the attribute making the decl too available is specified for a
less specific platform.
Resolves rdar://143423070.
This request will finish type checking an AvailableAttr by resolving its domain
and then enforcing any restrictions that the domain has on the attribute, like
disallowing version specifications.
This change just introduces the request and plumbs it through. NFC.
Now that most of the compiler tracks availability in terms of
AvailabilityDomain, it's time to do so in AvailabilityContext as well. This
will ensure that the compiler accurately suppresses diagnostics about a decl
being unavailable in an arbitrary domain when the context of the use is already
unavailable in that domain.
With this change, most of the special-casing for the Embedded Swift availability
domain has been removed from the compiler, outside of parsing and interface
printing.
Most of the compiler should use SemanticAvailableAttr instead. In contexts like
ASTDumper where a semantic attribute is unavailable use accessors on
AvailableAttr.
NFC.
Also stop suggesting a '?' fix-it for casts, where it is not likely to
be helpful because the common intention is either to force the optional
or declare an IUO.
This fixes sudden compiler errors that are emitted when trying to use CoreText.framework with C++ interop enabled.
When Swift is trying to rebuild a dependency module from its textual interface, it should not complain on usages of C enums in public Swift APIs.
This still leaves the resilience safety guardrail enabled for C++ scoped enums.
rdar://143215914
As specified by the SE-0446 acceptance, extensions that declare a type's
conditional `Copyable` or `Escapable` ability must reiterate explicitly all
of the `Copyable` and/or `Escapable` requirements, whether required or not
required (by e.g. `~Copyable`) that were suppressed in the original
type declaration.
AvailabilityConstraint models a superset of UnavailabilityDiagnosticInfo and
will become the currency type for unsatisfied availability everywhere. NFC.