swift
swift copied to clipboard
[AutoDiff] Synthesized TangentVectors can no longer be extended
Describe the bug Starting in roughly July, synthesized TangentVectors for Differentiable types can no longer be extended. Initially, these caused an assertion failure, then an error for a circular reference, and now (after PR #60373) they state that "Non-nominal type 'TestCase.TangentVector' cannot be extended". See below for a one-file reproducer.
Steps To Reproduce Place the following in a single file:
import _Differentiation
protocol TestProtocol {}
struct TestCase: Differentiable {
var test1: Float
var test2: Float
}
extension TestCase.TangentVector: TestProtocol {}
and build using swiftc test.swift
.
Expected behavior Prior to ~July, the above code built cleanly. Nightly toolchain snapshots since then do not build this correctly.
Environment (please fill out the following information)
Both macOS and Linux, Swift nightly toolchain snapshots since July (latest tested: 2022-08-06)