`\.self` is the final chosen syntax. Implement support for this syntax, and remove the stopgap builtin and `WritableKeyPath._identity` property that were in place before.
For a resilient protocol that has defaulted associated types, emit
default associated conformance witnesses that compute associated
conformances based on that default witness.
This completes the implementation of resilience protocols that
add new, defaulted associated types, rdar://problem/44167982.
When an associated type witness has a default, record that as part of
the protocol and emit a default associated type metadata accessor into the
default witness table. This allows a defaulted associated type to be
added to a protocol resiliently.
This is another part of rdar://problem/44167982, but it’s still very
limiting because the new associated type cannot have any conformances.
SILWitnessTable::Entry already contains a superset of what was supported
by SILDefaultWitnessTable::Entry, the latter of which only had “no entry”
and “method” states. Make SILDefaultWitnessTable::Entry an alias for
SILWitnessTable::Entry, and unify all of the parsing/printing/
(de)serialization logic.
Also, move the check to make it explicit that only a TupleShuffleExpr
at the top level goes through the argument emission code path; a
TupleShuffleExpr appearing inside a ParenExpr or TupleExpr is a
tuple conversion, which is totally unrelated and emitted as an RValue.
This is unfortunate and we should split off ArgumentShuffleExpr from
TupleShuffleExpr, and eventually, fold ArgumentShuffleExpr into
ApplyExpr.
This eliminates the only usage of AbstractionPattern::dropLastTupleElement().
For now, we keep the argument tuple-based entry points in TransformArguments
as well, because they're used by re-abstraction thunks. Those require a bit more
refactoring.
This silences the instances of the warning from Visual Studio about not all
codepaths returning a value. This makes the output more readable and less
likely to lose useful warnings. NFC.
This comes up when we import a static factory method as a convenience init.
The thunk was using DynamicSelfType as the type of a basic block argument,
because that was the type of the 'self' parameter in -swift-version 5.
Fixes <rdar://problem/44242156>.
When emitting accessor calls for keypaths, make sure that we reference
protocol requirements that introduce witness table entries. Other
protocol requirements don't have the necessary dispatch thunks,
resulting in linker errors.
Fixes rdar://problem/44187969.
I changed all of the places that used end_borrow_argument to use end_borrow.
NOTE: I discovered in the process of this patch that we are not verifying
guaranteed block arguments completely. I disabled the tests here that show this
bad behavior and am going to re-enable them with more tests in a separate PR.
This has not been a problem since SILGen does not emit any such arguments as
guaranteed today. But once I do the SILGenPattern work this will change.
rdar://33440767
When forming a witness_method instruction, follow the override chain of
a protocol requirement to reach a requirement that doesn’t override any
other protocol requirement. These will be the requirements that introduce
new witness table entries.
This fixes a logic error in the existing code that cause these
function arguments to appear twice, once as local variable and once as
formal parameter.
rdar://problem/37410759
This is NFC for now, but I plan to build on this to (1) immediately
remove some unnecessary materialization and loads of the base value
and (2) to allow clients to load a borrowed value.
Print parens and "_:" in cases where a function has no named
parameters.
We already print the parens in cases with no parameters, and the "_:"
for unnamed parameters in cases where there are already named
parameters.
Fixes: rdar://problem/19785368
Delay allocating the result buffer for an opened Self return until right before it's needed. When a mutating method is invoked on an existential, the Self type won't be opened until late, when the formal access to the mutable value begins. Fixes rdar://problem/43507711.
Swift 3 mode has not been fully removed, but the constraint solver
support for the old function argument tuple behavior is gone, so
rip out some SILGen hacks for it too.
This does the same thing as taking the AST type and running it through mapTypeOutOfContext, but
saves call sites from having to do the unwrap-rewrap dance.
Most of this patch is just removing special cases for materializeForSet
or other fairly mechanical replacements. Unfortunately, the rest is
still a fairly big change, and not one that can be easily split apart
because of the quite reasonable reliance on metaprogramming throughout
the compiler. And, of course, there are a bunch of test updates that
have to be sync'ed with the actual change to code-generation.
This is SR-7134.