Skip to content

Conversation

pull[bot]
Copy link

@pull pull bot commented Nov 30, 2020

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

rxwei and others added 3 commits November 27, 2020 21:03
…Derivative'. (swiftlang#34861)

A `@differentiable` function type require at least 1 differentiability parameter. This PR adds a diagnostic that rejects cases where all parameters are marked with `@noDerivative`. This fixes a compiler crasher.

```swift
test2.swift:3:24: error: '@differentiable' function type requires at least one differentiability parameter, i.e. a non-'@noDerivative' parameter whose type conforms to 'Differentiable'
let _: @differentiable (@noDerivative Float) -> Float = { _ in 0 }
                       ^~~~~~~~~~~~~~~~~~~~~
test2.swift:4:32: error: '@differentiable' function type requires at least one differentiability parameter, i.e. a non-'@noDerivative' parameter whose type conforms to 'Differentiable' with its 'TangentVector' equal to itself
let _: @differentiable(linear) (@noDerivative Float, @noDerivative Int) -> Float = { _, _ in 0 }
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
@MaxDesiatov MaxDesiatov merged commit fae2397 into swiftwasm Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants