Commit Graph

58361 Commits

Author SHA1 Message Date
swift-ci
22d7267899 Merge pull request #30625 from zoecarver/fix/sil-combine-empty-visitors 2020-03-25 00:04:09 -07:00
swift-ci
cb0af126ec Merge pull request #30626 from gottesmm/pr-425e04b6ad912535696f87725172065161659a68 2020-03-24 23:42:08 -07:00
swift-ci
0eeefaea05 Merge pull request #30559 from zoecarver/ossa/sil-combine 2020-03-24 22:02:43 -07:00
Luciano Almeida
829152bdb4 [CSDiagnostics] Handle optional Inout to typed pointer conversion diagnostics on generic mismatch 2020-03-25 01:51:30 -03:00
Michael Gottesman
78c3be9052 [ownership] Change LLChecker APIs that use an out array to return leaked blocks to caller to instead use a callback.
NFC.
2020-03-24 21:47:40 -07:00
zoecarver
56d5c8aa4a [nfc] remove empty visitors in silcombine
Remove visitors in SILCombine that only return nullptr.
2020-03-24 20:03:59 -07:00
zoecarver
d3a01131d7 Update all relevant visitors in SILCombine to skip ownership functions.
Instead of bailing on ownership functions in SILCombine::run, we will
bail in individual visitors. This way, as SILCombine is updated we can
paritially support ownership across the pass.
2020-03-24 19:55:08 -07:00
Mishal Shah
88b093e9d7 Merge pull request #30615 from apple/post-back-master-xcode-11.4
Update master to build with Xcode 11.4
2020-03-24 17:19:37 -07:00
Pavel Yaskevich
4b3d075fb7 [ConstraintSystem] Produce fallback diagnostic on mismatch between fixes/holes
If score indicates that a solution should have at least one fix
but it doesn't let's attempt to produce a fallback diagnostic inline.
2020-03-24 16:51:44 -07:00
Pavel Yaskevich
16c1f50eda [ConstraintSystem] Diagnose incorrect use of _ during constraint generation
`_` or discard assignment expression should only be used on the left-hand
side of the assignment expression. Incorrect uses are easy to detect during
constraint generation which also allows us to avoid complications related
to other diagnostics when `_` is used incorrectly.
2020-03-24 16:51:44 -07:00
Pavel Yaskevich
da2023c9a0 [ConstraintSystem] Score solutions based on number of holes
Introduce `SK_Hole` which is used to count a number of "holes" in
a given solution. It is used to distinguish solutions with fewer holes.

Also it makes it possible to check whether a solution has holes but
no fixes, which is an issue and such solution shouldn't be applied
to AST.
2020-03-24 16:51:44 -07:00
Pavel Yaskevich
786bad422a [ConstraintSystem] Avoid applying invalid solution with fixes
If solution score indicates that there should be a fix but
none where recorded fail solution application and produce
a fallback diagnostic to pin-point a problem.

Resolves: rdar://problem/60663007
2020-03-24 16:51:44 -07:00
Pavel Yaskevich
f14e9a8901 Merge pull request #30621 from xedin/extend-nil-diags
[ConstraintSystem] Diagnose more cases of invalid `nil` use during co…
2020-03-24 16:48:29 -07:00
swift-ci
1beb37e1b5 Merge pull request #30619 from gottesmm/pr-878b61dfa7844a20d0934aed4fd361c3ff5cb7c2 2020-03-24 15:44:01 -07:00
Pavel Yaskevich
465b0e193a [ConstraintSystem] Diagnose more cases of invalid nil use during constraint generation
Move check for `nil` destination of conditional casts to `visitNilLiteral` and
add support for `nil?` which wasn't previously detected.
2020-03-24 14:57:27 -07:00
Alexis Laferrière
9921cd7c1f Merge pull request #30614 from xymus/fix-deser-indexing
[Serialization] Recover from more failures when reading private declarations
2020-03-24 13:45:00 -07:00
Michael Gottesman
c55856e372 [pred-memopt] Simplify logic around lifetime extending a value that is consumed in a loop.
I realized after 84232cf177 started testing that I
can simplify this code as such, but I decided to finish testing. This is a NFC
change.
2020-03-24 13:41:08 -07:00
Arnold Schwaighofer
f0cdd76f18 Merge pull request #30612 from aschwaighofer/irgen_also_unique_ext_method_types_list
IRGen: Also unique selectors in extended method types list
2020-03-24 12:42:59 -07:00
Robert Widmann
a9e11e3130 [NFC] Separate Taking Redundant Conformance Diagnostics From The Lookup Table 2020-03-24 12:40:11 -07:00
Slava Pestov
829ab27e37 Merge pull request #30594 from slavapestov/irgen-get-conditional-requirements
IRGen: Don't call getConditionalRequirementsIfAvailable()
2020-03-24 15:21:24 -04:00
Slava Pestov
fe5b9c84c6 Merge pull request #30593 from slavapestov/rdar60045501
AST: Handle request cycle in TypeBase::getMemberSubstitutions()
2020-03-24 15:20:53 -04:00
Michael Gottesman
63deebc83a Merge pull request #30602 from gottesmm/pr-ddf5c7c0e3c6e9ace5c3b695b19e43d13bb6ec3b
[ownership] Replace all uses outside of the SILOwnershipVerifier of LinearLifetimeChecker::checkValue() and make it a private implementation detail.
2020-03-24 12:20:00 -07:00
Doug Gregor
e46d6fd0ec Merge pull request #30590 from DougGregor/property-wrapper-backing-init-linkage
[Property wrappers] Fix property wrapper backing initializer linkage.
2020-03-24 11:32:11 -07:00
Mishal Shah
e7cd5ab17f Update master to build with Xcode 11.4 2020-03-24 11:30:45 -07:00
Dan Zheng
a1c4b68d3c [AutoDiff] Remove @differentiable(jvp:vjp:) parsing logic. (#30604)
Remove logic for parsing and diagnosing `jvp:` and `vjp:` arguments for
`@differentiable` attribute. No logic remains for handling those arguments.

Follow-up to TF-1001.
2020-03-24 11:21:10 -07:00
Alexis Laferrière
c133437f2c [Serialization] Recover from opaque type related failures
Fixes rdar://60291019
2020-03-24 10:42:16 -07:00
Nathan Hawes
7811f531cb Merge pull request #30521 from nathawes/cross-import-interface-gen
[SourceKit/InterfaceGen] Also print the cross-import overlays of a module in its interface.
2020-03-24 10:28:55 -07:00
Alexis Laferrière
4e0038f0df [Serialization] Recover from conformances with missing decls
Components of a requirement may be hidden behind an implementation-only
import. Attempts at deserializing them would fail on a 'module not
loaded' error. We only see failures in non-compilation paths, either in
indexing or with tools like ide-test as they try to deserialize
things that are private.
2020-03-24 10:25:02 -07:00
Arnold Schwaighofer
e344971de7 IRGen: Also unique selectors in extended method types list
rdar://60778637
2020-03-24 09:39:44 -07:00
eeckstein
2ca8b15b51 Merge pull request #30610 from eeckstein/fix-destroy-hoisting
DestroyHoisting: fix a bug which creates invalid SIL
2020-03-24 17:20:53 +01:00
Dan Zheng
a856d59623 [AutoDiff upstream] Add @differentiable attribute serialization. (#30605)
Serialize "is linear?" flag, differentiability parameter indices, and
differentiability generic signature.

Deserialization has some ad-hoc logic for setting the original declaration and
parameter indices for `@differentiable` attributes because
`DeclDeserializer::deserializeDeclAttributes` does not have access to the
original declaration.

Resolves TF-836.
2020-03-24 08:22:56 -07:00
eeckstein
0873622b4b Merge pull request #30445 from eeckstein/globalopt
GlobalOpt: don't speculatively execute initializers of global variables
2020-03-24 15:09:10 +01:00
Erik Eckstein
15f519f544 DestroyHoisting: fix a bug which creates invalid SIL
A dominance check was missing.
2020-03-24 15:07:37 +01:00
marcrasi
1be86adbfc [AutoDiff] forbid derivative registration using @differentiable (#30001)
Delete `@differentiable` attribute `jvp:` and `vjp:` arguments for derivative
registration. `@derivative` attribute is now the canonical way to register
derivatives.

Resolves TF-1001.
2020-03-24 00:41:27 -07:00
Slava Pestov
81912e943a AST: Handle request cycle in TypeBase::getMemberSubstitutions()
I don't have a test case, but it's possible that getGenericSignature()
returns nullptr, even if the declaration has a generic parameter list,
because of a request cycle.

Fixes <rdar://problem/60045501>.
2020-03-24 01:30:40 -04:00
Slava Pestov
d0fb9c65c3 Merge pull request #30595 from slavapestov/rdar60081992
Sema: Fix interface type vs archetype mixup with generic typealiases
2020-03-24 01:09:54 -04:00
Robert Widmann
fee53354b8 Merge pull request #30589 from CodaFi/a-salvo-in-the-protocol-wars
[NFC] Define InheritedProtocolsRequest
2020-03-23 20:54:05 -07:00
Michael Gottesman
84232cf177 [ownership] Replace all uses outside of the SILOwnershipVerifier of LinearLifetimeChecker::checkValue() and make it a private implementation detail.
HOW THIS WAS DONE: I did this by refactoring the last usages of checkValue into
a higher level API that uses checkValue as an implementation detail:
completeConsumingUseSet(...). All of these places in
MandatoryInlining/PredictableMemOpts all wanted behavior where we complete a set
of consuming uses for a value, detecting if the consuming use is in a different
loop nest from the value.

WHY DO THIS: The reason why I wanted to do this is that checkValue is a lower
level API that drives the actual low level computation. We shouldn't expose its
interface to the LinearLifetimeChecker's users since it is our own private
implementation detail that also has some sharp edges.

AN ADDITIONAL BENEFIT: Additionally by hiding the declaration of checkValue, the
last public use of LinearLifetimeError and ErrorBehaviorKind was not
private. This allowed me to then move the declarations of those two to a private
header (./lib/SIL/LinearLifetimeCheckerPrivate.h) and make their declarations
private to LinearLifetimeChecker as well. As such, I renamed them to
LinearLifetimeChecker::Error and LinearLifetimeChecker::ErrorBehaviorKind.
2020-03-23 20:42:53 -07:00
omochimetaru
e1cb1a2057 Merge pull request #30501 from omochi/fix-verify-range
[Diagnostics] Fix range of fix-its in verify mode
2020-03-24 11:25:15 +09:00
Robert Widmann
302b7f5bf9 [NFC] Define InheritedProtocolsRequest
Refactor the interface to ProtocolDecl::getInheritedProtocols in
preparation for request-based dependency tracking.
2020-03-23 18:49:23 -07:00
Robert Widmann
80cca7d7a4 Merge pull request #30597 from CodaFi/a-set-of-yellowed-pages
[NFC] Define LookupConformanceInModuleRequest
2020-03-23 18:48:15 -07:00
Robert Widmann
d4bc0a62c5 [NFC] Define LookupConformanceInModuleRequest
Factor out the lookup side of TypeChecker::conformsToProtocol so we have
a dependency registration point available for evaluator-based
dependencies that doesn't have re-entrancy problems.
2020-03-23 16:24:17 -07:00
Slava Pestov
c2a913e4d7 Sema: Fix interface type vs archetype mixup with generic typealiases
Fixes <rdar://problem/60081992>.
2020-03-23 19:01:26 -04:00
Slava Pestov
ac4ca6dffa IRGen: Don't call getConditionalRequirementsIfAvailable()
We should not fail silently here if the conditional requirements
could not be computed due to a cycle.
2020-03-23 18:59:43 -04:00
Anthony Latsis
8f306261ea Merge pull request #30574 from AnthonyLatsis/code-complete-broken-conf-no-static
[CodeCompletion] Add overlooked 'isDeclVisibleInLookupMode' check when collecting value requirements
2020-03-24 01:26:41 +03:00
Robert Widmann
89b8163824 Merge pull request #30585 from CodaFi/untapped-potential
Register Conformances as Potential Member Constraints
2020-03-23 14:33:07 -07:00
Doug Gregor
8621a524ba [Property wrappers] Fix property wrapper backing initializer linkage.
Have property wrapper backing initializers determine their linkage in
the same way as stored property initializers, which need to match the linkage
of the enclosing type in cases where one can write an initializer
outside of the source file where that type is declared.

Fixes rdar://problem/59607192.
2020-03-23 14:27:25 -07:00
Dan Zheng
62f6686da4 Merge pull request #30579 from dan-zheng/autodiff-upstream-sil
[AutoDiff upstream] [SIL] Add differentiable function instructions.
2020-03-23 12:18:19 -07:00
Hamish Knight
de4669055a Add direct operator lookup requests (#30584)
Add direct operator lookup requests
2020-03-23 12:09:23 -07:00
Joe Groff
b0ca53fcf3 Merge pull request #30546 from jckarter/mangle-any-protocol-conformance
Factor `appendAnyProtocolConformance` out of the conformance mangling.
2020-03-23 11:47:34 -07:00