c763ab5d1e fixed an issue in
`getSerializedLocs` where it never actually cached its result (and thus
always allocated a new `CachedExternalSourceLocs`). Unfortunately it
missed a leak that could occur when `DocRanges` grows beyond its initial
size of 4.
Allocate `DocRanges` upfront in the `ASTContext` as well in order to
prevent this leak.
Resolves rdar://85472403.
This cleans up 90 instances of this warning and reduces the build spew
when building on Linux. This helps identify actual issues when
building which can get lost in the stream of warning messages. It also
helps restore the ability to build the compiler with gcc.
This is a verbatim copy of the GenericSignatureBuilder's somewhat
questionable (but necessary for source compatibility) logic where
protocol typealiases with the same name as some other associated
type imply a same-type requirement.
The related diagnostics are there too, but only emitted when
-requirement-machine-protocol-signatures=on; in 'verify' mode,
the GSB will emit the same diagnostics.
Introduce the `@_predatesConcurrency` attribute, which specifies that a
given declaration existed prior to the introduction of Swift
Concurrency, has been updated to use concurrency features (global
actors, Sendable, etc.), but should retain its pre-concurrency behavior
for clients that have not yet opted into concurrency.
Implement type and actor-isolation adjustments to
`@_predatesConcurrency` declarations to subsume the `@_unsafeMainActor`,
`@_unsafeSendable`, and `@MainActor(unsafe)` use cases. This is the
bulk of the semantic transformations needed for this new attribute,
but is not yet complete.
Part of rdar://84448438.
This allows applications that back-deploy but only use concurrency in
newer code to load and execute properly, even when the concurrency library
is not available. Fixes rdar://84877644.
This would be used by closures because they handle patterns
and initializers via solver and set them back to the pattern
binding decl as fully type-checked.
The `@__distributedActorIndependent` attribute is effectively the same
as nonisolated, so start treating it that way by making actor-isolation
checking look for it specifically and conclude "nonisolated". Remove
various special cases for this attribute that don't need to exist.
These will be used by the RequirementMachine to compute requirement
signatures. For now, they're not hooked up.
ProtocolDecl::getStructuralRequirements() produces a list of Requirements
with SourceLocs from the structural types written in the protocol's
inheritance clause and 'where' clauses.
ProtocolDecl::getProtocolDependencies() produces a list of protocols which
appear on the right hand side of the protocol's conformance requirements.
Note: we only lazily load the result if it's a record, because otherwise it's trivial to load when importing the function. Also, we still eagerly import operator's results types.
Returning a null GenericSignature is not the right way to break a cycle,
because then callers have to be careful to handle the case of a null
GenericSignature together with a non-null GenericParamList, for example
in applyGenericArguments().
An even worse problem can occur when a GenericSignatureRequest for a
nested generic declaration requests the signature of the parent context,
which hits a cycle. In this case, we would build a signature where
the first generic parameter did not have depth 0.
This makes the requirement machine upset, so this patch implements a new
strategy to break such cycles. Instead of returning a null
GenericSignature, we build a signature with the correct generic
parameters, but no requirements. The generic parameters can be computed
just by traversing GenericParamLists, which does not trigger more
GenericSignatureRequests, so this should be safe.
The MemoryBuffer loader is used by LLDB during debugging to import binary Swift
modules from .swift_ast sections. Modules imported from .swift_ast sections are
never produced from textual interfaces. By disabling resilience the expression
evaluator in the debugger can directly access private members.
rdar://79462915
The following regression test added for this feature is not passing:
Swift(linux-x86_64) :: decl/protocol/protocols_with_self_or_assoc_reqs_executable.swift
with a compiler crash happening during SILFunctionTransform "Devirtualizer".
Reverting to unblock CI.
This reverts commit f96057e260, reversing
changes made to 3fc18f3603.