Add `Differentiable.withDerivative(_:)`, a "derivative surgery" API.
`Differentiable.withDerivative(_:)` is an identity function returning `self`.
It takes a closure and applies it to the derivative of the return value, in
contexts where the return value is differentiated with respect to.
Make sure we mangle opaque types using the same settings as the
debugger mangling (with OptimizeProtocolNames = false) to ensure
that we can reconstruct those names again.
We already ban all structs from declaring storage that comes from implementation-only imports. Until now we missed property wrappers, they were just dropped in deserialization.
Resolves rdar://problem/59403617
When merging many blocks to a single block (in the wrong order), instructions are getting moved over and over again.
This is quadratic and can result in very long compile times for large functions.
To fix this, always move the instruction to smaller block to the larger block.
rdar://problem/56268570
`-lm` is not portable, it is only needed on certain platforms (e.g.
Linux, not BSD). Remove the explicit link.
Avoid using a static library as that is not supported on all platforms
(e.g. Windows). Use the helper macros to generate the library.
Repairs the Windows tests.
Previously we could allow some invalid coercions to
sneak past Sema. In most cases these would either
cause crashes later down the pipeline or
miscompiles. However, for coercions between
collections, we emitted somewhat reasonable code
that performed a force cast.
This commit aims to preserve compatibility with
those collection coercions that previously
compiled, and emits a warning telling the user to
use either 'as?' or 'as!' instead.
Start visiting transitive fixed bindings for type
variables, and stop visiting adjacencies for
`gatherConstraint`'s `AllMentions` mode.
This improves performance and fixes a correctness
issue with the old implementation where we could
fail to re-activate a coercion constraint, and
then let invalid code get past Sema, causing
either miscompiles or crashes later down the
pipeline.
Unfortunately this change requires us to
temporarily drop the non-ephemeral fix for a couple
of fairly obscure cases where the overload hasn't
yet been resolved. The logic was previously relying
on stale adjacency state in order to re-activate
the fix when the overload is bound, but it's not
connected on the constraint graph. We need to find
a way to connect constraints to unresolved
overloads they depend on.
Resolves SR-12369.
The name of the module is encoded into the type name. The module name
is not `null` on Windows, which would fail to match the name. It is
possible to make the test less overly-constricted, but setting the
module name to null is simpler and avoids more regex matching.
Fix `@derivative` attribute type-checking crash, so far reproducible only via
`-parse-stdlib`.
The crash occurs because it is not sufficient for type-checking to check for
`Differentiable` conformances. We must also check for invalid `TangentVector`
associated types.
Resolves SR-12559.
Support `@differentiable` function conversion for `init` references, in
addition to `func` references and literal closures. Minor usability improvement.
Resolves SR-12562.
checked_cast_br may take an additional operands for the source and
target types. I'm sure the compiler forgets to check this in many
places. In this case, it was just a harmless assert.
Fixes <rdar://61122253> Assertion failed:
(termInst->getNumOperands() == 1 && "Transformation terminators should only have single operands")
wrapped value placeholder in an init(wrappedValue:) call that was previously
injected as an OpaqueValueExpr. This commit also restores the old design of
OpaqueValueExpr.
* [Diagnostics] Improve {{none}} fix-it verifier
* split two conditions
* define "none" constant
* support plural
* use Twine and add comment for replacement range
* check if {{none}} is at the end
* use noneMarkerStartLoc
* update second {{none}} error message
Co-Authored-By: Owen Voorhees <owenvoorhees@gmail.com>
* update test case for second {{none}}
* fix test case for new {{none}} check
* Use named struct
* set const
Co-authored-by: Owen Voorhees <owenvoorhees@gmail.com>
The confusion here was around a test that was testing the behavior when one
/does not/ guard a polymorphic builtin with a _isConcrete. Specifically, without
_isConcrete, one gets weird behavior where in debug we crash, but in release we
may not due to further inlining/specialization. With _isConcrete, we never
crashand get the appropriate behavior.
This commit works by changing the current run of the polymorphic builtin test to
force -Onone and adds an extra -O run that way we validate both behaviors.
This updates the invocation to use `Python2::Interpreter` rather than
relying on the custom `PYTHON_EXECUTABLE`. This is much easier to
identify where we are falling back to the python2 code paths and where
we can start moving towards Python3.
Extend SwiftDtoa to provide optimal formatting for Float16 and use that for `Float16.description` and `Float16.debugDescription`.
Notes on signaling NaNs: LLVM's Float16 support passes Float16s on x86
by legalizing to Float32. This works well for most purposes but incidentally
loses the signaling marker from any NaN (because it's a conversion as far
as the hardware is concerned), with a side effect that the print code never
actually sees a true sNaN. This is similar to what happens with Float and
Double on i386 backends. The earlier code here tried to detect sNaN in a
different way, but that approach isn't guaranteed to work so we decided to
make this code use the correct detection logic -- sNaN printing will just be
broken until we can get a better argument passing convention.
Resolves rdar://61414101