Files
swift-mirror/test/AutoDiff/Sema/ImplicitDifferentiableAttributeCrossFile/protocol_default_implementation_witness.swift
Dan Zheng 9afad737eb [AutoDiff] [Sema] Limit implicit @differentiable attribute creation. (#33776)
During protocol witness matching for a protocol requirement with
`@differentiable` attributes, implicit `@differentiable` attributes may be
created for the witness under specific conditions (when the witness has a
`@differentiable` attribute with superset differentiability parameters, or
when the witness has less-than-public visibility).

Do not generate implicit `@differentiable` attributes for protocol witnesses
when the protocol conformance is declared from a separate file or type context
from the witness.

Resolves SR-13455.
2020-09-19 10:49:09 -07:00

13 lines
516 B
Swift

// RUN: %target-swift-frontend -c -verify -primary-file %s %S/Inputs/other_file_protocol_default_implementation_witness.swift
// SR-13455: Test missing protocol requirement `@differentiable` attribute
// errors for protocol witnesses declared in a different file than the protocol
// conformance.
//
// This test case specifically tests protocol extension method witnesses.
import _Differentiation
// expected-error @+1 {{type 'ConformingStruct' does not conform to protocol 'P1'}}
struct ConformingStruct: P2 {}