We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
md5: 33f7db793aa428d1420cdfa7d18ae9b0
Issue Description:
// nontrivial_loadable_type.swift import _Differentiation /// A non-trivial, loadable type. /// /// Used to test differentiation transform coverage. struct NontrivialLoadable<T> { fileprivate class Box { fileprivate var value: T init(_ value: T) { self.value = value } } private var handle: Box init(_ value: T) { self.handle = Box(value) } var value: T { get { handle.value } set { handle.value = newValue } } } extension NontrivialLoadable: ExpressibleByFloatLiteral where T: ExpressibleByFloatLiteral { init(floatLiteral value: T.FloatLiteralType) { self.handle = Box(T(floatLiteral: value)) } } extension NontrivialLoadable: ExpressibleByIntegerLiteral where T: ExpressibleByIntegerLiteral { init(integerLiteral value: T.IntegerLiteralType) { self.handle = Box(T(integerLiteral: value)) } } extension NontrivialLoadable: Equatable where T: Equatable { static func == (lhs: NontrivialLoadable, rhs: NontrivialLoadable) -> Bool { return lhs.value == rhs.value } } extension NontrivialLoadable: AdditiveArithmetic where T: AdditiveArithmetic { static var zero: NontrivialLoadable { return NontrivialLoadable(T.zero) } static func + (lhs: NontrivialLoadable, rhs: NontrivialLoadable) -> NontrivialLoadable { return NontrivialLoadable(lhs.value + rhs.value) } static func - (lhs: NontrivialLoadable, rhs: NontrivialLoadable) -> NontrivialLoadable { return NontrivialLoadable(lhs.value - rhs.value) } } extension NontrivialLoadable: Differentiable where T: Differentiable, T == T.TangentVector { typealias TangentVector = NontrivialLoadable<T.TangentVector> }
// property-wrappers.swift // RUN: %target-swift-frontend -emit-sil -verify %s %S/Inputs/nontrivial_loadable_type.swift import DifferentiationUnittest @propertyWrapper struct Wrapper<Value> { private var value: Value var wrappedValue: Value { // computed property get { value } set { value = newValue } } init(wrappedValue: Value) { self.value = wrappedValue } } struct GenericStruct<T: Differentiable>: Differentiable { @Wrapper var nontrivial: NontrivialLoadable<Float> = 20 @differentiable static func nontrivialSetter(_ s: inout GenericStruct, _ x: NontrivialLoadable<Float>) { s.nontrivial = x } }
$ swiftc nontrivial_loadable_type.swift property_wrappers.swift Begin Error in Function: 'AD__$s17property_wrappers13GenericStructV10nontrivialAA18NontrivialLoadableVySfGvs__pullback_src_0_wrt_0_1_16_Differentiation14DifferentiableRzl' Error! Found a leaked owned value that was never consumed. Value: %4 = load [take] %3 : $*NontrivialLoadable<Float> // user: %8 End Error in Function: 'AD__$s17property_wrappers13GenericStructV10nontrivialAA18NontrivialLoadableVySfGvs__pullback_src_0_wrt_0_1_16_Differentiation14DifferentiableRzl' Found ownership error?! Stack dump: 0. Program arguments: build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swiftc -frontend -target x86_64-apple-macosx10.9 -module-cache-path build/Ninja-ReleaseAssert/swift-macosx-x86_64/swift-test-results/x86_64-apple-macosx10.9/clang-module-cache -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -swift-version 4 -ignore-module-source-info -typo-correction-limit 10 -emit-sil -verify swift/test/AutoDiff/SILOptimizer/property_wrappers.swift swift/test/AutoDiff/SILOptimizer/Inputs/nontrivial_loadable_type.swift 1. Swift version 5.3-dev (LLVM f66b332548, Swift bb2bc9e176) 2. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Guaranteed Passes } on SIL for property_wrappers.property_wrappers) 3. While running pass #​354 SILModuleTransform "MandatoryInlining". 4. While verifying SIL function "@AD__$s17property_wrappers13GenericStructV10nontrivialAA18NontrivialLoadableVySfGvs__pullback_src_0_wrt_0_1_16_Differentiation14DifferentiableRzl". for setter for nontrivial (at swift/test/AutoDiff/SILOptimizer/property_wrappers.swift:19:16) ...
The text was updated successfully, but these errors were encountered:
Fixed in #31701.
Sorry, something went wrong.
dan-zheng
No branches or pull requests
Additional Detail from JIRA
md5: 33f7db793aa428d1420cdfa7d18ae9b0
Issue Description:
The text was updated successfully, but these errors were encountered: