Skip to content

Commit 7d31f3d

Browse files
ci: fix tests and update JET harness
1 parent d4b12df commit 7d31f3d

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

test/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
55
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
66
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
77
DispatchDoctor = "8d63f2c5-f18a-4cf2-ba9d-b3f60fc568c8"
8+
DynamicExpressions = "a40a106e-89c9-4ca8-8020-a735e8728b6b"
89
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
910
Interfaces = "85a1e053-f937-4924-92a5-1367d23b7b87"
1011
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
@@ -26,6 +27,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
2627

2728
[compat]
2829
Aqua = "0.7"
30+
JET = "0.11"
2931

3032
[preferences.DynamicExpressions]
3133
dispatch_doctor_codegen_level = "min"

test/runtests.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,27 @@ if "jet" in test_name
2323
)
2424
using JET
2525
using DynamicExpressions
26-
struct MyIgnoredModule
26+
27+
# JET v0.11 uses the ReportMatcher + match_report API.
28+
struct MyIgnoredModule <: JET.ReportMatcher
2729
mod::Module
2830
end
29-
function JET.match_module(
30-
mod::MyIgnoredModule, @nospecialize(report::JET.InferenceErrorReport)
31+
function JET.match_report(
32+
m::MyIgnoredModule, @nospecialize(report::JET.InferenceErrorReport)
3133
)
32-
s_mod = string(mod.mod)
34+
s_mod = string(m.mod)
3335
any(report.vst) do vst
3436
occursin(s_mod, string(JET.linfomod(vst.linfo)))
3537
end
3638
end
39+
3740
JET.test_package(
3841
DynamicExpressions;
39-
target_defined_modules=true,
42+
target_modules=(DynamicExpressions,),
4043
ignored_modules=(
4144
MyIgnoredModule(DynamicExpressions.NonDifferentiableDeclarationsModule),
4245
),
4346
)
44-
# TODO: Hack to get JET to ignore modules
45-
# https://github.com/aviatesk/JET.jl/issues/570#issuecomment-2199167755
4647
end
4748
end
4849
if "main" in test_name

test/test_chainrules.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ let
8383
end
8484

8585
# Operator that is NaN for forward pass
86-
bad_op(x) = x > 0.0 ? log(x) : convert(typeof(x), NaN)
86+
# Define only for numeric types; `@extend_operators` adds the `Node` method.
87+
bad_op(x::Real) = x > 0.0 ? log(x) : convert(typeof(x), NaN)
8788
# And operator that is undefined for backward pass
88-
undefined_grad_op(x) = x >= 0.0 ? x : zero(x)
89+
undefined_grad_op(x::Real) = x >= 0.0 ? x : zero(x)
8990
# And operator that gives a NaN for backward pass
9091
bad_grad_op(x) = x
9192

0 commit comments

Comments
 (0)