// RUN: %target-build-swift -O %s

// rdar://71191415

import _Differentiation

protocol P {
  @differentiable(reverse)
  func req(_ input: Float) -> Float
}

extension P {
  @differentiable(reverse)
  func foo(_ input: Float) -> Float {
    return req(input)
  }
}

struct Dummy: P {
  @differentiable(reverse)
  func req(_ input: Float) -> Float {
    input
  }
}

struct DummyComposition: P {
  var layer = Dummy()

  @differentiable(reverse)
  func req(_ input: Float) -> Float {
    layer.foo(input)
  }
}

// RUN: %target-build-swift -O %s

// FIXME(rdar://89055298)
// UNSUPPORTED: linux

// rdar://71191415

import _Differentiation

protocol P {
  @differentiable(reverse)
  func req(_ input: Float) -> Float
}

extension P {
  @differentiable(reverse)
  func foo(_ input: Float) -> Float {
    return req(input)
  }
}

struct Dummy: P {
  @differentiable(reverse)
  func req(_ input: Float) -> Float {
    input
  }
}

struct DummyComposition: P {
  var layer = Dummy()

  @differentiable(reverse)
  func req(_ input: Float) -> Float {
    layer.foo(input)
  }
}

Disable an autodiff test on Linux to unblock CI.
Disable an autodiff test on Linux to unblock CI.

AutoDiff/compiler_crashers_fixed/rdar71191415-nested-differentiation-of-extension-method-optimized.swift is starting to fail recently. Tracked by rdar://89055298.
