Skip to content

Commit

Permalink
fixed bug where type-checking subtraction uses +(S1,S2), which is obs…
Browse files Browse the repository at this point in the history
…olete
  • Loading branch information
quffaro committed Sep 18, 2024
1 parent b9b4146 commit 87f65fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/deca/ThDEC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ end
end
end

@operator -(S1, S2)::DECQuantity begin +(S1, S2) end
@operator -(S1, S2)::DECQuantity begin
promote_symtype(+, S1, S2)
end

@operator *(S1, S2)::DECQuantity begin
@match (S1, S2) begin
Expand Down
3 changes: 2 additions & 1 deletion test/decasymbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ u, v = @syms u::PrimalForm{0, :X, 2} du::PrimalForm{1, :X, 2}
ϕ, ψ = @syms ϕ::PrimalVF{:X, 2} ψ::DualVF{:X, 2}
# TODO would be nice to pass the space globally to avoid duplication


@testset "Term Construction" begin

@test symtype(a) == Scalar
Expand Down Expand Up @@ -44,6 +43,8 @@ u, v = @syms u::PrimalForm{0, :X, 2} du::PrimalForm{1, :X, 2}
@test promote_symtype(+, a, b) == Scalar
@test promote_symtype(, u, u) == PrimalForm{0, :X, 2}
@test promote_symtype(, u, ω) == PrimalForm{1, :X, 2}
@test promote_symtype(-, a) == Scalar
@test promote_symtype(-, u, u) == PrimalForm{0, :X, 2}

# test composition
@test promote_symtype(d d, u) == PrimalForm{2, :X, 2}
Expand Down

0 comments on commit 87f65fe

Please sign in to comment.