Skip to content

Commit d166bc6

Browse files
Minor bugfix in rdata_type (#730)
* Minor bugfix in `rdata_type` Signed-off-by: Hong Ge <[email protected]> * tests * limit to Int64 --------- Signed-off-by: Hong Ge <[email protected]> Co-authored-by: Astitva Aggarwal <[email protected]>
1 parent 0920595 commit d166bc6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/fwds_rvs_data.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ end
448448
# This method can only handle struct types. Tell user to implement their own method.
449449
if isprimitivetype(T)
450450
msg = "$T is a primitive type. Implement a method of `rdata_type` for it."
451-
return :(error(msg))
451+
return :(error($msg))
452452
end
453453

454454
# If the type is a Union, then take the union type of its arguments.

test/fwds_rvs_data.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ end
2323
@test fdata_type(tangent_type(P)) == F
2424
@test rdata_type(tangent_type(P)) == R
2525
end
26+
@test_throws ErrorException(
27+
"Int64 is a primitive type. Implement a method of `rdata_type` for it."
28+
) rdata_type(Int64)
29+
@test_throws ErrorException(
30+
"Int64 is a primitive type. Implement a method of `fdata_type` for it."
31+
) fdata_type(Int64)
32+
2633
@testset "$(typeof(p))" for (_, p, _...) in Mooncake.tangent_test_cases()
2734
TestUtils.test_tangent_splitting(Xoshiro(123456), p)
2835
end

0 commit comments

Comments
 (0)