Skip to content

Commit

Permalink
Better source type error (#2221)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Dec 23, 2024
1 parent 7af0e58 commit 87ee6e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/typeutils/jltypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ function classify_arguments(
# - boxed values
# XXX: use `deserves_retbox` instead?
elseif llvm_source_typ isa LLVM.PointerType
@assert llvm_source_typ == codegen_typ
if llvm_source_typ != codegen_typ
throw(AssertionError("Mismatch codegen type llvm_source_typ=$(string(llvm_source_typ)) codegen_typ=$(string(codegen_typ)) source_i=$source_i source_sig=$source_sig, source_typ=$source_typ, codegen_i=$codegen_i, codegen_types=$(string(codegen_ft))"))
end
push!(
args,
(
Expand Down
9 changes: 7 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,13 @@ end
@test autodiff(Forward, f28, Duplicated(2.0, 1.0))[1] == 12

f29(x) = sum(Set([1.0, x, 2x, x]))
@test autodiff(Reverse, f29, Active, Active(2.0))[1][1] == 3
@test autodiff(Forward, f29, Duplicated(2.0, 1.0))[1] == 3
@static if VERSION v"1.11-"
@test autodiff(set_runtime_activity(Reverse), f29, Active, Active(2.0))[1][1] == 3
@test autodiff(set_runtime_activity(Forward), f29, Duplicated(2.0, 1.0))[1] == 3
else
@test autodiff(Reverse, f29, Active, Active(2.0))[1][1] == 3
@test autodiff(Forward, f29, Duplicated(2.0, 1.0))[1] == 3
end

f30(x) = reverse([x 2.0 3x])[1]
@test autodiff(Reverse, f30, Active, Active(2.0))[1][1] == 3
Expand Down

0 comments on commit 87ee6e3

Please sign in to comment.