Skip to content

Commit 68f4599

Browse files
committed
fix lhs rhs cmp
1 parent a1f3f66 commit 68f4599

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/tools.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ end
6464

6565
function cmp_exp(lhs, rhs)
6666
@switch (lhs, rhs) begin
67-
@case (Neg(a::Token{:float64}), b::Token{:float64})
67+
@case (Neg(a::Token{:float64}), b::Token{:float64}) || (b::Token{:float64}, Neg(a::Token{:float64}))
6868
startswith(b.str, '-') && a.str == b.str[2:end]
6969
@case _
7070
cmp_ast(lhs, rhs)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using Test
77

88
@testset "cmp_exp" begin
99
@test cmp_exp(Neg(qasm_f64(0.2)), qasm_f64(-0.2))
10+
@test cmp_exp(qasm_f64(-0.2), Neg(qasm_f64(0.2)))
1011
end
1112

1213
@testset "conversion" begin

0 commit comments

Comments
 (0)