Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Pull Request

on: [pull_request]

jobs:
test-ubuntu-latest:
name: Test Swift ${{ matrix.swift }} Ubuntu Latest
strategy:
matrix:
swift: ["6.0", "6.0.1", "6.0.2"]
runs-on: ubuntu-latest
container: swift:${{ matrix.swift }}
steps:
- uses: actions/checkout@v4
- name: Run Tests
run: swift test -Xswiftc -warnings-as-errors -Xcc -Werror
4 changes: 2 additions & 2 deletions Sources/Differentiation/Dictionary+Differentiation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import _Differentiation
// and
// https://bugs.swift.org/browse/TF-1193

extension Dictionary: Differentiable where Value: Differentiable {
extension Dictionary: @retroactive Differentiable where Value: Differentiable {
public typealias TangentVector = [Key: Value.TangentVector]
public mutating func move(by direction: TangentVector) {
for (componentKey, componentDirection) in direction {
Expand All @@ -28,7 +28,7 @@ extension Dictionary: Differentiable where Value: Differentiable {
}

/// Implements the `AdditiveArithmetic` requirements.
extension Dictionary: AdditiveArithmetic where Value: AdditiveArithmetic {
extension Dictionary: @retroactive AdditiveArithmetic where Value: AdditiveArithmetic {
public static func + (_ lhs: Self, _ rhs: Self) -> Self {
lhs.merging(rhs, uniquingKeysWith: +)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Copyright (c) 2024 PassiveLogic, Inc.

#if canImport(_Differentiation)

import Differentiation
Expand All @@ -13,7 +11,7 @@ struct OptionalDifferentiableMapTests {
func testFunc(_ x: Double?) -> Double? {
x.differentiableMap { $0 * $0 * $0 }
}
#expect(pullback(at: 1.0, of: testFunc)(.init(1.0)) == 3.0)
#expect(pullback(at: 1.0, of: testFunc)(.init(1.0)) == .init(3.0))
#expect(pullback(at: nil, of: testFunc)(.init(1.0)) == .init(0.0))
#expect(pullback(at: 0.0, of: testFunc)(.init(1.0)) == .init(0.0))
}
Expand Down
Loading