Files
swift-mirror/test/AutoDiff/Sema/missing_differentiable_protocol.swift
Dan Zheng 1308fc69c5 [AutoDiff] Simplify conditions enabling differentiable programming. (#30765)
Previously, two conditions were necessary to enable differentiable programming:
- Using the `-enable-experimental-differentiable-programming` frontend flag.
- Importing the `_Differentiation` module.

Importing the `_Differentiation` module is the true condition because it
contains the required compiler-known `Differentiable` protocol. The frontend
flag is redundant and cumbersome.

Now, the frontend flag is removed.
Importing `_Differentiation` is the only condition.
2020-04-02 03:24:03 -07:00

10 lines
463 B
Swift

// RUN: %target-swift-frontend -typecheck -verify %s
// Tests that Sema fails gracefully when the `_Differentiation` module is not imported.
// expected-error @+1 {{'@differentiable' attribute used without importing module '_Differentiation'}}
let _: @differentiable (Float) -> Float
// expected-error @+1 2 {{'@differentiable' attribute used without importing module '_Differentiation'}}
func hasDifferentiableFunctionArg<T>(_ f: @differentiable (T) -> T) {}