Skip to content
New issue

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

[SR-14229] [AutoDiff] conformance of synthesized TangentVector doesn't work #54898

Open
marcrasi mannequin opened this issue Mar 31, 2020 · 1 comment
Open

[SR-14229] [AutoDiff] conformance of synthesized TangentVector doesn't work #54898

marcrasi mannequin opened this issue Mar 31, 2020 · 1 comment
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@marcrasi
Copy link
Mannequin

marcrasi mannequin commented Mar 31, 2020

Previous ID SR-14229
Radar rdar://problem/81170168
Original Reporter @marcrasi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, AutoDiff
Assignee None
Priority Medium

md5: 02544c29a1fa7eb644c287b7535e0342

is duplicated by:

  • SR-14959 [AutoDiff] Declaring protocol conformances for synthesized TangentVectors sometimes doesn't do anything

Issue Description:

Code:

public protocol P {}

public struct S: Differentiable {
  var x: Float = 0
  public init() {}

  //public struct TangentVector: AdditiveArithmetic, Differentiable {
  //  var x: Float = 0
  //}
  //public func move(along direction: TangentVector) { fatalError() }
}

extension S.TangentVector: P {}

func f<T: Differentiable>(_ t: T) where T.TangentVector: P {}

f(S())

Error:

module.swift:17:1: error: global function 'f' requires that 'S.TangentVector' conform to 'P'
f(S())
^
module.swift:15:6: note: where 'T.TangentVector' = 'S.TangentVector'
func f<T: Differentiable>(_ t: T) where T.TangentVector: P {}
     ^

This seems related to the synthesis because if you uncomment the custom TangentVector it compiles successfully.

@rxwei
Copy link
Member

rxwei commented Jul 27, 2021

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoDiff bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant