Commit Graph

58361 Commits

Author SHA1 Message Date
Lang Hames
17671672ce [Immediate] Switch the JIT codegen opt-level to Default.
This matches MCJIT's default, and may solve some of the linux test failures
seen in https://github.com/apple/swift/pull/29863.
2020-03-05 14:08:09 -08:00
Pavel Yaskevich
1f222f307e [ConstraintSystem] Make sure pattern matching tuple destructuring works both ways
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
2020-03-05 14:05:35 -08:00
Holly Borla
3634b4366c [Parse] Mark closure parameters as definitively not destructured in
parseClosureSignatureIfPresent.

Otherwise, closure parameters that were parsed as "potentially destructured"
will fail constraint generation, even after the parser has decided
they are not destructured.
2020-03-05 13:45:37 -08:00
Owen Voorhees
0ffb727dfe [DependencyVerifier] Route DependencyVerifier diags through DiagnosticEngine 2020-03-05 12:41:04 -08:00
Michael Gottesman
621573e839 [semantic-arc-opts] Refactor out convert to guarantee code into a method on LiveRange.
Should be NFC.

I am doing this since when I am eliminating phi webs, I need this exact
functionality.
2020-03-05 11:49:36 -08:00
Andrew Trick
cab9c49f13 Merge pull request #30224 from atrick/disable-invariant-let
Disable !invariant metadata for 'let' variables.
2020-03-05 11:18:06 -08:00
Hamish Knight
c26eb11baf Merge pull request #30190 from hamishknight/the-beginning-of-the-pipeline-end
Requestify SourceFile parsing
2020-03-05 11:17:24 -08:00
Slava Pestov
cf451c2ebe Merge pull request #30228 from slavapestov/stronger-invariant-apply-inst-substitution-map
SIL: Verify that the substitution map of an apply instruction matches the callee
2020-03-05 14:11:33 -05:00
Xi Ge
2f5f66b9da Re-apply "TBDGen: pass-down target variant when generating textual interface stubs"
rdar://60057760
2020-03-05 11:00:14 -08:00
AG
97d8c99984 Merge pull request #30219 from bitjammer/acgarland/rdar-59128787-sg-include-synthesized
[SymbolGraph] Emit synthesized members
2020-03-05 09:46:22 -08:00
Pavel Yaskevich
d6a9399f7b Merge pull request #30202 from omochi/refactor-matchCallArguments
[ConstraintSystem] Refactor matchCallArguments
2020-03-05 09:45:53 -08:00
Michael Gottesman
c0a866d1f6 Merge pull request #30227 from gottesmm/pr-d0ba712c9532bbdd21033e19354f8fb6b3bb253d
[semantic-arc-opts] load [copy] -> load_borrow if copy is completely enclosed in certain kinds of exclusive access scopes.
2020-03-05 09:45:22 -08:00
Michael Gottesman
d428d76f04 Merge pull request #30225 from gottesmm/pr-3ca0f543e9c626572476d6c0ffb789ef45166e54
[temp-rvalue] Add support for eliminating simple temp rvalues inited with a store when in ossa.
2020-03-05 09:44:42 -08:00
Anthony Latsis
f762644175 Diagnose nested type references with unsatisfied requirements 2020-03-05 20:23:49 +03:00
Pavel Yaskevich
8b6f66b245 Merge pull request #30223 from xedin/rdar-60048356
[ConstraintSystem] Preserve label matching rules in pattern matching …
2020-03-05 09:23:45 -08:00
Pavel Yaskevich
8ce5c7794b Merge pull request #30232 from xedin/rdar-60047439
[ConstraintSystem] Check availability as part of resolving overload c…
2020-03-05 09:23:04 -08:00
Anthony Latsis
db3f7081ec Sema: Diagnose invalid overrides involving contextual where clauses 2020-03-05 20:20:07 +03:00
Doug Gregor
e780c194fc Merge pull request #30230 from DougGregor/function-builder-switch-checking
[Constraint system] Semantic checking for switch statements in function builders
2020-03-05 06:23:19 -08:00
Alexis Laferrière
34353b8a40 Merge pull request #30215 from xymus/spi-isnt-internal
[SPI] Requestify, inherit SPI groups and better diagnostics
2020-03-05 06:13:01 -08:00
Pavel Yaskevich
4c600843d6 [ConstraintSystem] Check availability as part of resolving overload choice
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
2020-03-05 00:35:47 -08:00
Robert Widmann
d07ed46023 Merge pull request #30221 from CodaFi/existaxis
[CS] Use The Full Opened Type When Forming Subscripts
2020-03-04 23:33:35 -08:00
Pavel Yaskevich
87878a65eb [ConstraintSystem] Preserve label matching rules in pattern matching context
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
2020-03-04 23:09:31 -08:00
Doug Gregor
c0cf407565 [Constraint solver] Check case variable mutability consistency. 2020-03-04 22:46:36 -08:00
Doug Gregor
3887498e55 [Constraint system] Diagnose @unknown cases in function builders. 2020-03-04 22:46:36 -08:00
Rintaro Ishizaki
58d4868e42 Revert "TBDGen: pass-down target variant when generating textual interface stubs" 2020-03-04 22:01:24 -08:00
Slava Pestov
5aee91053f SIL: Verify that the substitution map of an apply instruction matches the callee
This fixes part of the problem in <rdar://problem/49509247>, but not the
actual bug.
2020-03-05 00:40:37 -05:00
Slava Pestov
c3192a0757 Merge pull request #30220 from slavapestov/substitution-map-print-tweak
AST: Set PrintForSIL when printing replacement types in SubstitutionMaps
2020-03-04 23:59:48 -05:00
fischertony
c498ad0283 IDE: Ensure syntax coloring for contextual where clauses 2020-03-05 07:29:28 +03:00
Michael Gottesman
0aecebd7c1 [semantic-arc-opts] load [copy] -> load_borrow if copy is completely enclosed in certain kinds of exclusive access scopes.
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
2020-03-04 20:26:18 -08:00
Michael Gottesman
04007f2583 Merge pull request #30201 from gottesmm/pr-6331d582c9865bfa1aca1fee9d93aeac11f93f4b
[ownership] Convert LiveRange to use Operands.
2020-03-04 19:42:44 -08:00
Michael Gottesman
0e19ae4871 [temp-rvalue] Add support for eliminating simple temp rvalues inited with a store when in ossa.
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
2020-03-04 19:29:33 -08:00
swift-ci
6e7184287c Merge pull request #30204 from atrick/no-borrow-address 2020-03-04 19:23:46 -08:00
Andrew Trick
0bbc44c976 Disable !invariant metadata for 'let' variables.
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
2020-03-04 19:19:04 -08:00
Xi Ge
830c90feb9 Merge pull request #30217 from nkcsgexi/zippered
TBDGen: pass-down target variant when generating textual interface stubs
2020-03-04 17:40:48 -08:00
fischertony
6f08216936 Sema: Support where clauses on contextually generic decls 2020-03-05 04:37:12 +03:00
Robert Widmann
0a28307c41 [CS] Use The Full Opened Type When Forming Subscripts
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
2020-03-04 17:23:15 -08:00
Michael Gottesman
fced2398c5 [semantic-arc] Change LiveRange to work with Operand instead of Operand->getUser().
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.
2020-03-04 17:07:48 -08:00
Michael Gottesman
15c7e3a56a Merge pull request #30200 from gottesmm/pr-f782df1b8f778cdddc48f8343fb0876f598f9012
[ownership] Remove BranchPropagatedUser.
2020-03-04 16:59:16 -08:00
Alexis Laferrière
2bbebcb180 [Sema] Remove invalid @_spi attributes 2020-03-04 16:43:05 -08:00
Alexis Laferrière
26c6a18345 [Sema] Improve type-checking of the use and exposability of SPIs 2020-03-04 16:43:05 -08:00
Alexis Laferrière
c61cc6fe4e [AST] Add SPI information to public access scopes 2020-03-04 16:42:18 -08:00
Alexis Laferrière
fb1c71c651 [ASTPrinter] Skip SPI extensions too 2020-03-04 16:42:18 -08:00
Alexis Laferrière
65a0dc1754 [ASTPrinter] Print all SPI attributes, including the inherited ones 2020-03-04 16:42:18 -08:00
Alexis Laferrière
0a65a39ecb [ASTPrinter] Check if we should skip synthesized extensions 2020-03-04 16:42:18 -08:00
Alexis Laferrière
7bd585001a [AST] Intro and use isSPI and getSPIGroups 2020-03-04 16:42:18 -08:00
Alexis Laferrière
fd4feacb0d [AST] Intro request to list declared and inherited SPI groups 2020-03-04 16:41:54 -08:00
Slava Pestov
98902ef142 AST: Set PrintForSIL when printing replacement types in SubstitutionMaps
This prints opened existentials with @opened("...") rather than just printing
the erased existential type.
2020-03-04 19:32:14 -05:00
Andrew Trick
653a5aae2a Prevent begin_borrow on addresses and cleanup address access utils. 2020-03-04 16:32:08 -08:00
Kuba Mracek
acfc4a98b1 Fixup for 3904fe83f (AST: Centralize ABI-related deployment target checks) 2020-03-04 16:30:07 -08:00
Ashley Garland
f0887fa245 [SymbolGraph] Emit synthesized members
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
2020-03-04 16:04:21 -08:00