You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the solution you'd like
The Swift Stdlib currently lacks support for differentiating conversion of types to optionals. #57228 was a feature request about converting Double to Double?. I did some digging into the proposed feature, and encountered a compiler crasher. This regards the operator ?? (or perhaps it was !), which I attempted to replicate using an instance method test instead of an explicit operator.
To incorporate this feature into the Standard Library, one would need to modify the code below. There could be a way to work around the crash. In this instance, the compiler crashed while compiling philipturner/differentiation on the v5.6 release toolchain. One may have different results using the v5.7 release toolchain offered in Xcode 14 beta, or when using a development toolchain. Someone should also try adding this code to the Swift Stdlib's source files and ensuring apple/swift successfully compiles.
After finding a suitable version of the reproducer, locate the test file tests/AutoDiff/stdlib/optional.swift. One should add a new code section that shows Optional.init being differentiated.
There is no way to differentiate Optional.init in AutoDiff's current state. One may have to modify the C++ code and permit differentiating throwing functions. Alternatively, one may hunt down the bug causing the compiler crash above. If the bug's source if found, there can be a PR to apple/swift detailing:
(a) The C++ code modifications that fix the bug.
(b) A compiler crasher test involving optional differentiation.
(c) The addition of Optional.init to the Swift Stdlib.
(d) Additions to the test/AutoDiff/stdlib suite.
Other details
This is not directly in the interest of apple/swift, but I would like to validate s4tf/s4tf against this addition to the Swift Stdilb. I recently faced #59467, which caused a lot of long-term difficulties. If this causes a compiler crash while building S4TF or philipturner/differentiation, I would request further investigation before merging.
The text was updated successfully, but these errors were encountered:
Describe the solution you'd like
The Swift Stdlib currently lacks support for differentiating conversion of types to optionals. #57228 was a feature request about converting
Double
toDouble?
. I did some digging into the proposed feature, and encountered a compiler crasher. This regards the operator??
(or perhaps it was!
), which I attempted to replicate using an instance methodtest
instead of an explicit operator.To incorporate this feature into the Standard Library, one would need to modify the code below. There could be a way to work around the crash. In this instance, the compiler crashed while compiling philipturner/differentiation on the v5.6 release toolchain. One may have different results using the v5.7 release toolchain offered in Xcode 14 beta, or when using a development toolchain. Someone should also try adding this code to the Swift Stdlib's source files and ensuring apple/swift successfully compiles.
After finding a suitable version of the reproducer, locate the test file
tests/AutoDiff/stdlib/optional.swift
. One should add a new code section that showsOptional.init
being differentiated.Current reproducer:
Crash:
Related: SR-13440, SR-13627, SR-14881
Worst case scenario
There is no way to differentiate
Optional.init
in AutoDiff's current state. One may have to modify the C++ code and permit differentiating throwing functions. Alternatively, one may hunt down the bug causing the compiler crash above. If the bug's source if found, there can be a PR to apple/swift detailing:Optional.init
to the Swift Stdlib.test/AutoDiff/stdlib
suite.Other details
This is not directly in the interest of apple/swift, but I would like to validate s4tf/s4tf against this addition to the Swift Stdilb. I recently faced #59467, which caused a lot of long-term difficulties. If this causes a compiler crash while building S4TF or philipturner/differentiation, I would request further investigation before merging.
The text was updated successfully, but these errors were encountered: