mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Gardening: Migrate test suite to GH issues: AutoDiff/Sema
This commit is contained in:
@@ -4,13 +4,14 @@
|
||||
// "-verify-ignore-unknown" is for "<unknown>:0: note: 'init()' declared here"
|
||||
// RUN: %target-swift-frontend-typecheck -verify -verify-ignore-unknown -I %t %s
|
||||
|
||||
// SR-12526: Fix cross-module deserialization crash involving `@derivative` attribute.
|
||||
// https://github.com/apple/swift/issues/54969
|
||||
// Fix cross-module deserialization crash involving `@derivative` attribute.
|
||||
|
||||
import a
|
||||
import b
|
||||
|
||||
func foo(_ s: Struct) {
|
||||
// Without this error, SR-12526 does not trigger.
|
||||
// Without this error, the aforementioned issue does not trigger.
|
||||
// expected-error @+1 {{'Struct' initializer is inaccessible due to 'internal' protection level}}
|
||||
_ = Struct()
|
||||
_ = s.method(1)
|
||||
|
||||
@@ -542,9 +542,10 @@ where T: AdditiveArithmetic {}
|
||||
extension NoMemberwiseInitializerExtended: Differentiable
|
||||
where T: Differentiable & AdditiveArithmetic {}
|
||||
|
||||
// SR-12793: Test interaction with `@differentiable` and `@derivative` type-checking.
|
||||
// https://github.com/apple/swift/issues/55238
|
||||
// Test interaction with `@differentiable` and `@derivative` type-checking.
|
||||
|
||||
class SR_12793: Differentiable {
|
||||
class C_55238: Differentiable {
|
||||
@differentiable(reverse)
|
||||
var x: Float = 0
|
||||
|
||||
@@ -593,7 +594,9 @@ class WrappedProperties: Differentiable {
|
||||
|
||||
@Wrapper var float: Generic<Float> = Generic()
|
||||
@ClassWrapper var float2: Generic<Float> = Generic()
|
||||
// SR-13071: Test `@differentiable` wrapped property.
|
||||
|
||||
// https://github.com/apple/swift/issues/55517
|
||||
// Test `@differentiable` wrapped property.
|
||||
@differentiable(reverse) @Wrapper var float3: Generic<Float> = Generic()
|
||||
|
||||
@noDerivative @ImmutableWrapper var nondiff: Generic<Int> = Generic()
|
||||
|
||||
@@ -158,19 +158,21 @@ extension TangentVectorP where Self == StructWithTangentVectorConstrained.Tangen
|
||||
// CHECK-AST-LABEL: internal struct StructWithTangentVectorConstrained : TangentVectorConstrained {
|
||||
// CHECK-AST: internal struct TangentVector : {{(TangentVectorP, Differentiable, AdditiveArithmetic)|(TangentVectorP, AdditiveArithmetic, Differentiable)|(Differentiable, TangentVectorP, AdditiveArithmetic)|(AdditiveArithmetic, TangentVectorP, Differentiable)|(Differentiable, AdditiveArithmetic, TangentVectorP)|(AdditiveArithmetic, Differentiable, TangentVectorP)}} {
|
||||
|
||||
public struct SR14241Struct: Differentiable {
|
||||
// https://github.com/apple/swift/issues/56601
|
||||
|
||||
public struct S1: Differentiable {
|
||||
public var simd: [Float]
|
||||
public var scalar: Float
|
||||
}
|
||||
|
||||
// CHECK-AST-LABEL: public struct SR14241Struct : Differentiable {
|
||||
// CHECK-AST-LABEL: public struct S1 : Differentiable {
|
||||
// CHECK-AST: public var simd: [Float]
|
||||
// CHECK-AST: public var scalar: Float
|
||||
// CHECK-AST: struct TangentVector : AdditiveArithmetic, Differentiable {
|
||||
// CHECK-AST: var simd: Array<Float>.TangentVector
|
||||
// CHECK-AST: var scalar: Float
|
||||
|
||||
// CHECK-SIL-LABEL: public struct SR14241Struct : Differentiable {
|
||||
// CHECK-SIL-LABEL: public struct S1 : Differentiable {
|
||||
// CHECK-SIL: @differentiable(reverse, wrt: self)
|
||||
// CHECK-SIL: @_hasStorage public var simd: [Float] { get set }
|
||||
// CHECK-SIL: @differentiable(reverse, wrt: self)
|
||||
|
||||
@@ -361,9 +361,10 @@ where T: AdditiveArithmetic {}
|
||||
extension NoMemberwiseInitializerExtended: Differentiable
|
||||
where T: Differentiable & AdditiveArithmetic {}
|
||||
|
||||
// SR-12793: Test interaction with `@differentiable` and `@derivative` type-checking.
|
||||
// https://github.com/apple/swift/issues/55238
|
||||
// Test interaction with `@differentiable` and `@derivative` type-checking.
|
||||
|
||||
struct SR_12793: Differentiable {
|
||||
struct S_55238: Differentiable {
|
||||
var x: Float
|
||||
|
||||
@differentiable(reverse)
|
||||
@@ -408,7 +409,9 @@ struct WrappedProperties: Differentiable {
|
||||
|
||||
@Wrapper var float: Generic<Float>
|
||||
@ClassWrapper var float2: Generic<Float>
|
||||
// SR-13071: Test `@differentiable` wrapped property.
|
||||
|
||||
// https://github.com/apple/swift/issues/55517
|
||||
// Test `@differentiable` wrapped property.
|
||||
@differentiable(reverse) @Wrapper var float3: Generic<Float>
|
||||
|
||||
@noDerivative @ImmutableWrapper var nondiff: Generic<Int>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// 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
|
||||
// https://github.com/apple/swift/issues/55897
|
||||
// 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.
|
||||
|
||||
@@ -583,20 +583,22 @@ extension Struct where T: Differentiable & AdditiveArithmetic {
|
||||
}
|
||||
}
|
||||
|
||||
struct SR15530_Struct<T> {}
|
||||
extension SR15530_Struct: Differentiable where T: Differentiable {}
|
||||
// https://github.com/apple/swift/issues/57833
|
||||
|
||||
extension SR15530_Struct {
|
||||
// expected-note @+1 {{candidate instance method does not have type equal to or less constrained than '<T where T : Differentiable> (inout SR15530_Struct<T>) -> (Int, @differentiable(reverse) (inout T) -> Void) -> Void'}}
|
||||
mutating func sr15530_update<D>(at index: Int, byCalling closure: (inout T, D) -> Void, withArgument: D) {
|
||||
struct Struct2<T> {}
|
||||
extension Struct2: Differentiable where T: Differentiable {}
|
||||
|
||||
extension Struct2 {
|
||||
// expected-note @+1 {{candidate instance method does not have type equal to or less constrained than '<T where T : Differentiable> (inout Struct2<T>) -> (Int, @differentiable(reverse) (inout T) -> Void) -> Void'}}
|
||||
mutating func update<D>(at index: Int, byCalling closure: (inout T, D) -> Void, withArgument: D) {
|
||||
fatalError("Stop")
|
||||
}
|
||||
}
|
||||
|
||||
extension SR15530_Struct where T: Differentiable {
|
||||
// expected-error @+1 {{referenced declaration 'sr15530_update' could not be resolved}}
|
||||
@derivative(of: sr15530_update)
|
||||
mutating func vjp_sr15530_update(
|
||||
extension Struct2 where T: Differentiable {
|
||||
// expected-error @+1 {{referenced declaration 'update' could not be resolved}}
|
||||
@derivative(of: update)
|
||||
mutating func vjp_update(
|
||||
at index: Int,
|
||||
byCalling closure: @differentiable(reverse) (inout T) -> Void
|
||||
) -> (value: Void, pullback: (inout Self.TangentVector) -> Void) {
|
||||
@@ -624,7 +626,8 @@ extension Class where T: Differentiable {
|
||||
return (1, { _ in .zero })
|
||||
}
|
||||
|
||||
// FIXME(SR-13096): Enable derivative registration for class property/subscript setters.
|
||||
// FIXME: Enable derivative registration for class property/subscript setters (https://github.com/apple/swift/issues/55542).
|
||||
//
|
||||
// This requires changing derivative type calculation rules for functions with
|
||||
// class-typed parameters. We need to assume that all functions taking
|
||||
// class-typed operands may mutate those operands.
|
||||
|
||||
Reference in New Issue
Block a user