diff --git a/src/ast.jl b/src/ast.jl index ecc40b0..a4aa04e 100644 --- a/src/ast.jl +++ b/src/ast.jl @@ -62,7 +62,7 @@ end # Close to single assignment form mutable struct FlatAST top # topmost variable(s) - input_variables::Set{Symbol} + input_variables::Vector{Symbol} intermediate::Vector{Symbol} # generated vars code # ::Vector{Assignment} variables::Vector{Symbol} # cleaned version of input_variables @@ -76,7 +76,7 @@ function Base.show(io::IO, flatAST::FlatAST) println(io, "code: ", flatAST.code) end -FlatAST() = FlatAST([], Set{Symbol}(), [], [], []) +FlatAST() = FlatAST([], [], [], [], []) export FlatAST diff --git a/src/code_generation.jl b/src/code_generation.jl index fb50f55..d2d239c 100644 --- a/src/code_generation.jl +++ b/src/code_generation.jl @@ -133,9 +133,7 @@ function forward_backward(flatAST::FlatAST) # @show flatAST.input_variables # @show flatAST.intermediate - - - input = sort(collect(flatAST.input_variables)) + input = collect(flatAST.input_variables) # @show flatAST.top diff --git a/test/runtests.jl b/test/runtests.jl index 230c836..0e000b4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -65,6 +65,11 @@ end C2 = Contractor([x, y, z], y+z) @test C2(A,X) == IntervalBox(0.5..1.5, 0.5..0.5, 0.5..0.5) + vars = @variables x1 x3 x2 + + C = Contractor(vars, x1+x2) + @test C(A, X) == IntervalBox(0.5..0.5, 0.5..1.5, 0.5..0.5) + end @testset "Contractor is created by function name " begin