Commit Graph

39091 Commits

Author SHA1 Message Date
swift-ci
5e030b57a2 Merge pull request #29918 from dan-zheng/derivative-attr-diagnostics 2020-02-19 23:26:54 -08:00
Holly Borla
f141b4da3c [TypeCheckAttr] Provide better error messages for a typeEraser that
has invalid init candidates.
2020-02-19 21:23:57 -08:00
Dan Zheng
e5e9fce8bf [AutoDiff upstream] Upstream attribute type-checking changes. (#29945)
- Support `@differentiable` and `@derivative` attributes for original
  initializers in final classes. Reject original initializers in non-final
  classes.
- Synchronize tests.
2020-02-19 21:17:45 -08:00
Joe Groff
f353c40ce9 Revert "[SILOptimizer] Generalize optimization of static keypaths" 2020-02-19 19:58:15 -08:00
Robert Widmann
8c2cff8c40 Merge pull request #29937 from CodaFi/semantic-gymnastics
[Sema] Always install property wrappers during qualified lookup
2020-02-19 19:54:54 -08:00
Robert Widmann
9f0e2d279c Merge pull request #29930 from CodaFi/di-trying
Add regression tests for rdar://58495602
2020-02-19 17:36:40 -08:00
Pavel Yaskevich
8af4f2ddb3 Merge pull request #29493 from LucianoPAlmeida/SR-11421-checked-cast-diag
[SR-11421][Diagnostics] Tailored diagnostic for checked downcast with literals
2020-02-19 17:29:30 -08:00
Holly Borla
ebb727c0a3 [TypeCheckAttr] Allow a type eraser initializer to have more than one
generic requirement.
2020-02-19 17:07:30 -08:00
Slava Pestov
1a9eb7960b Merge pull request #29913 from slavapestov/opaque-result-type-versus-keypath
Fix a couple of problems with opaque result types
2020-02-19 20:00:00 -05:00
Argyrios Kyrtzidis
3d5cb90904 Merge pull request #29938 from akyrtzi/annotated-property-wrapper-attribute
[ASTPrinter] When printing a property wrapper attribute name for the fully annotated declaration, make sure that it is wrapped within the `syntaxtype.attribute.name` tag
2020-02-19 16:41:25 -08:00
Robert Widmann
92b8d637f1 [Sema] Always install property wrappers during qualified lookup
Revert the property wrappers part of dd51251014.

Every part of the qualified lookup stack needs to synthesize property
wrapper members, otherwise we'll be subject to the relativistic effects
of semantic lookups in different files. Besides, Codable was the main
source of cycles and circularity under the old scheme.

Resolves rdar://59531889
2020-02-19 14:23:07 -08:00
Argyrios Kyrtzidis
8cfc5eda94 [ASTPrinter] When printing a property wrapper attribute name for the fully annotated declaration, make sure that it is wrapped within the syntaxtype.attribute.name tag 2020-02-19 14:20:51 -08:00
Alexis Laferrière
d4e0336541 [Test] Test use of SPI in compiled lib 2020-02-19 14:17:14 -08:00
Alexis Laferrière
d12292ca92 [Sema] Consider SPI decls public to emit symbols and TBD 2020-02-19 14:17:14 -08:00
Alexis Laferrière
d4bd7220c7 [Test] Test generated private and public swiftinterface when using @_spi 2020-02-19 14:17:14 -08:00
Alexis Laferrière
4d6adefa4c [Test] Test clients of modules defining SPI decls 2020-02-19 14:17:14 -08:00
Alexis Laferrière
b14fdd30de [Test] SPI access and limits when used locally 2020-02-19 14:17:14 -08:00
Pavel Yaskevich
288a7765fc [CSRanking] Detect cases where overload choices are incomparable
If constraint system is underconstrained e.g. because there are
editor placeholders, it's possible to end up with multiple solutions
where each ambiguous declaration is going to have its own overload kind:

```swift
func foo(_: Int) -> [Int] { ... }
func foo(_: Double) -> (result: String, count: Int) { ... }

_ = foo(<#arg#>).count
```

In this case solver would produce 2 solutions: one where `count`
is a property reference on `[Int]` and another one is tuple access
for a `count:` element.

Resolves: rdar://problem/49712598
2020-02-19 13:41:26 -08:00
Luciano Almeida
497d46fcfc [tests] Spliting literals downcast tests into commom and bridged 2020-02-19 18:38:17 -03:00
Arnold Schwaighofer
e641c4a4b7 IRGen: Deal with broken AST from batch mode
rdar://59552858
2020-02-19 12:55:39 -08:00
Slava Pestov
9fa6d8947b SILGen: Fix keypath getter/setter emission with opaque result types
Opaque result types are substituted away inside the SILFunction, so
make sure we're looking at the correct SILFunctionType.
2020-02-19 15:42:01 -05:00
Luciano Almeida
705e468e47 Require objc interop on cast/literals_downcast tests 2020-02-19 16:34:51 -03:00
Robert Widmann
34eaf8d487 Add regression tests for rdar://58495602 2020-02-19 11:24:28 -08:00
swift-ci
e26b01ca38 Merge pull request #29923 from mikeash/fix-empty-collection-singleton-realization-test-backward-deployment 2020-02-19 10:14:36 -08:00
Pavel Yaskevich
71753f3ca6 [ConstraintSystem] Rank contextually unavailable overloads lower than other choices (#29921)
Currently constraint solver is only capable of detecting universally unavailable
overloads but that's insufficient because it's still possible to pick a contextually
unavailable overload choice which could be better than e.g. generic overload, or
one with defaulted arguments, marked as disfavored etc.

Let's introduce `ConstraintSystem::isDeclUnavailable` which supports both universal
and contextual unavailability and allow constraint solver to rank all unavailable
overload choices lower than any other possible choice(s).

Resolves: rdar://problem/59056638
2020-02-19 13:13:53 -05:00
Dan Zheng
469ecb640f Improve @derivative type-checking diagnostics order.
Attempt to look up original function before checking whether the `value:` result
conforms to `Differentiable`.

This improves diagnostics: "original function not found" should be diagnosed as
early as possible.
2020-02-19 09:54:31 -08:00
Brent Royal-Gordon
d842fa3763 Merge pull request #29582 from brentdax/the-most-ambitious-crossover-event-in-history
Cross-Import Overlays
2020-02-19 09:10:55 -08:00
Mike Ash
495554f270 [Test] Don't run EmptyCollectionSingletonRealization on older runtimes that aren't fixed.
rdar://problem/59590614
2020-02-19 11:30:29 -05:00
Slava Pestov
092fb33ab0 Merge pull request #29901 from slavapestov/reflection-zero-edition
IRGen: Fix reflection metadata for zero-sized enum cases
2020-02-19 11:08:11 -05:00
Arnold Schwaighofer
289996a362 Add test case for typelayout based value witness emission.
rdar://51988441
2020-02-19 07:12:56 -08:00
eeckstein
b1fc252f29 Merge pull request #29907 from eeckstein/dead_alloc_stack_elimination
SILOptimizer: improvements for dead alloc_stack elimination
2020-02-19 08:19:42 +01:00
Robert Widmann
6965c3323e Merge pull request #29894 from CodaFi/im-beginning-to-feel-like-a-wrap-god
[SILGen] Reabstract and Materialize Arguments To Property Wrapper Setters If Needed
2020-02-18 21:23:01 -08:00
Dan Zheng
2c70f0ae6c [AutoDiff] Improve @derivative attribute diagnostics.
Previously, `@derivative` attribute type-checking produced a confusing error
referencing unbound types `T` and `U`:

```
'@derivative(of:)' attribute requires function to return a two-element tuple of
type '(value: T..., pullback: (U.TangentVector) -> T.TangentVector...)' or
'(value: T..., differential: (T.TangentVector...) -> U.TangentVector)'
```

Now, the error is less confusing:

```
'@derivative(of:)' attribute requires function to return a two-element tuple;
first element must have label 'value:' and second element must have label
'pullback:' or 'differential:'
```
2020-02-19 04:48:27 +00:00
Pavel Yaskevich
51257ddf73 Merge pull request #29906 from xedin/eliminate-csdiag
[TypeChecker] Obsolete and remove old diagnostics (CSDiag)
2020-02-18 19:46:54 -08:00
Daniel Rodríguez Troitiño
c868b867dc Merge pull request #29893 from drodriguez/android-mark-sil_combine_alloc_stack-executable
[android][test] Mark sil_combine_alloc_stack as executable.
2020-02-18 18:25:50 -08:00
Pavel Yaskevich
2c92df4a6d [ConstraintSystem] Simplify diagnoseAmbiguityWithEphemeralPointers
Don't attempt to figure out what exactly is ambiguous, let
`diagnoseAmbiguity` take care of that. Simplify make sure
that only some of the solutions have fixes and these fixes
are all related to use of ephemeral pointers.
2020-02-18 15:06:13 -08:00
Robert Widmann
3e4a820fb4 [SILGen] Handle Reabstraction and Substitution in assign_by_wrapper
Use the substitution map for the LValue component to properly handle the
case where we need to re-abstract the argument to the assign_by_wrapper
setter.

Resolves rdar://59553318
2020-02-18 14:59:03 -08:00
Slava Pestov
7a4b5cf798 SIL: Fix assertion failure when function with opaque result type returns a tuple 2020-02-18 17:43:55 -05:00
Arnold Schwaighofer
6992712bec IRGen: Fix specialized conformances with abstract conditional requirements in the partial apply forwarder
We need to add abstract requirements of the conditional requirements.

rdar://59456064
2020-02-18 13:43:39 -08:00
Michael Gottesman
3526539109 Merge pull request #29605 from gottesmm/pr-db719c8315f5da4d80fcb174523fcc569fb14caf
[semantic-arc-opts] Convert @owned -> @guaranteed args of transforming terminators when fed by load [copy], copy_value.
2020-02-18 13:36:59 -08:00
Joe Groff
14cda1a472 Merge pull request #28799 from NobodyNada/master
[SILOptimizer] Generalize optimization of static keypaths
2020-02-18 13:28:05 -08:00
Pavel Yaskevich
d2953bb0c0 [ConstraintSystem] Let simplifyRestrictedConstraintImpl fix any failures related to arguments with restrictions 2020-02-18 13:22:22 -08:00
Mike Ash
6c19d6f257 Merge pull request #29904 from mikeash/fix-swiftnativeerror-description-memory-management
[Stdlib] Fix an overrelease in -[__SwiftNativeNSError description].
2020-02-18 15:07:26 -05:00
Slava Pestov
5b6a050e80 IRGen: Fix reflection metadata for zero-sized enum cases
If an enum has a payload case with zero size, we treat it as an empty case
for ABI purposes. Unfortunately, this meant that reflection metadata was
incomplete for such cases, with a Mirror reporting that the enum value
had zero children.

Tweak the field type metadata emission slightly to preserve the payload
type for such enum cases.

Fixes <https://bugs.swift.org/browse/SR-12044> / <rdar://problem/58861157>.
2020-02-18 14:16:58 -05:00
Brent Royal-Gordon
014bb1cd83 Don’t count submodules when cross-importing
It turns out that, if you pull in any nontrivial module, there are thousands of submodules and none of them could possibly have a  cross-import overlay. Avoid evaluating them.
2020-02-18 11:08:36 -08:00
Brent Royal-Gordon
12286197c9 [NFC] Improvements suggested in code review
Thank you, @hamishknight and @varungandhi-apple.
2020-02-18 11:08:36 -08:00
Brent Royal-Gordon
747c50725c Add a warning about redundant cross-import declarations
These are mostly harmless, except that they make the two module names synonymous in qualified lookup. A hard error seems too aggressive for something that could easily be caused by uncoordinated changes to two modules, so warn instead.
2020-02-18 11:08:36 -08:00
Brent Royal-Gordon
17087cbb4e Correct for difference between BSD and GNU cp 2020-02-18 11:08:36 -08:00
Brent Royal-Gordon
0ab823801c Test cross-import overlays 2020-02-18 11:08:36 -08:00
Brent Royal-Gordon
e248f82773 Add support for loading cross-import files 2020-02-18 11:06:12 -08:00