Consider following example:
```swift
enum E {
case foo((x: Int, y: Int))
case bar(x: Int, y: Int)
}
func test(e: E) {
if case .foo(let x, let y) = e {}
if case .bar(let tuple) = e {}
}
```
Both of `if case` expressions have to be supported:
1. `case .foo(let x, let y) = e` allows a single tuple
parameter to be "destructured" into multiple arguments.
2. `case .bar(let tuple) = e` allows to match multiple
parameters with a single tuple argument.
Resolves: rdar://problem/60061646
parseClosureSignatureIfPresent.
Otherwise, closure parameters that were parsed as "potentially destructured"
will fail constraint generation, even after the parser has decided
they are not destructured.
This is a follow up to changes related to contextual availability
(https://github.com/apple/swift/pull/29921) which increased score
for unavailable declarations only if they were overloaded but
overlooked a case of a single unavailable choice.
Resolve: rdar://problem/60047439
Since constraint system now handles pattern matching it has
to preverse label matching semantics which existed in original
code: if pattern element has a label it has to match the one
in the tuple type it's matched against.
Resolves: rdar://problem/60048356
Specifically if we have a begin_access [read] or a begin_access [modify] that is
never actually written to. In that case if we can prove that the load [copy] is
completely within the exclusive access region, we will load_borrow. Example:
```
%0 = begin_access [read] ...
%1 = load [copy] %0
...
destroy_value %1
end_access %0
```
=>
```
%0 = begin_access [read] ...
%1 = load_borrow %0
...
end_borrow %1
end_access %0
```
rdar://60064692
Specifically, we do not handle cases where we use projections,
open_existential_addr, or load_borrow. We should be able to handle those in the
future.
The best part is that ossa makes this really easy to do correctly.
rdar://60064817
I enabled this recently by piggybacking it in the mega-commit:
commit badc5658bb
Author: Andrew Trick <atrick@apple.com>
Date: Mon Mar 2 16:23:53 2020
Fix SIL MemBehavior queries with access markers.
It miscompiles SwiftNIO's NIOPerformanceTester benchmark causing it to
segfault immediately.
We may consider debugging this to reenable it in the future...
<rdar://60068448> Teach IRGen to emit !invariant metadata for 'let' variables
Fixes <rdar://60038603> Swift CI: SwiftNIO_macOS NIOHTTP2_macOS fails
The "opened type" of a subscript reference has all references to Self
immediately substituted out, which destroys the link between Self and
the opened existential type we form for the "fully opened type". This
means, in general, we cannot use this type when rewriting subscript
applies, or we'll miss closing opened existentials.
Use the "fully opened type" everywhere except the AnyObject subscript
path. Then, add an assertion that AnyObject subscripts never involve
opened archetypes that we would have to close.
Resolves SR-11748, rdar://57092093
This is just better information to have since one wants to not only know the
instruction, but also the specific value used on the instruction since behavior
can vary depending upon that. The operand is what ties the two together so it is
a natural fit.
Now that this is done, I am going to work on refactoring out converting a
LiveRange from @owned -> @guaranteed. It will be a consuming operation using a
move operator since once the transformation has completed, the LiveRange no
longer exists.
I need this refactored functionality since I am going to need it when
eliminating phi-webs.
Emit copies of default implementations in protocol extensions and superclass declarations in conforming types and subclasses respectively using a virtual USR, i.e. `${REAL_USR}::SYNTHESIZED::${CONFORMING_OR_SUBCLASS_TYPE_USR}`.
- Add a -skip-synthesized-members option to skip these synthesized members.
- Create a new wrapping `Symbol` type that can also contain a base type declaration as well as the inherited declaration for those synthesized cases. Move some symbol-specific APIs there.
- Doc comments can “cascade” down to protocol extensions or refinements in concrete types. When emitting the doc comment for a symbol, look up through to superclasses or protocol requirements for where a doc comment is actually written.
- Clean up filtering of implicitly private (e.g. “public underscored”) types
rdar://problem/59128787