Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Type piracies, and unbound parameters detected when testing with Aqua.jl #74

Open
Fe-r-oz opened this issue Dec 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Fe-r-oz
Copy link
Contributor

Fe-r-oz commented Dec 16, 2024

Describe the bug

Testing with Aqua.jl gives type piracy, unbound parameter, etc. errors. With Aqua.jl, we can detect method ambiguities, type piracies, any unbound parameters, etc. There are no method ambiguities which is a good thing but there are other errors.

The following tests pass with Aqua

julia> Aqua.test_ambiguities(Satisfiability)
Skipping Satisfiability.decode_from_ascii
Skipping Satisfiability.pop
Skipping Satisfiability.push
Test Passed
julia> Aqua.test_persistent_tasks(Satisfiability)
Test Passed

Stale dependency error was fixed in #73

julia> Aqua.test_stale_deps(Satisfiability)
Test Passed

Please provide the steps to reproduce the bug, including a minimal code demo if possible.

These bugs can be reproduced using Aqua.test_unbound_args(...), Aqua.test_piracies(...), Aqua.test_undefined_exports(...), Aqua.test_project_extras(...), Aqua.test_deps_compat(...).

Documentation about these methods can be found here

Unbound parameters detected

julia> Aqua.test_unbound_args(Satisfiability)
Skipping Satisfiability.decode_from_ascii
Skipping Satisfiability.pop
Skipping Satisfiability.push
Unbound type parameters detected:
[1] sat!(interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...; logic, line_ending) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:143                                                                                                                               
[2] assert!(interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...; line_ending) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:197                                                                                                                                   
[3] var"#assert!#185"(line_ending, ::typeof(assert!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:197                                                                                                      
[4] or(zs::Union{Integer, T}...) where T<:AbstractBitVectorExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:229
[5] var"#sat!#178"(logic, line_ending, ::typeof(sat!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:143                                                                                                     
[6] Satisfiability.SlicedBitVectorExpr(op::Symbol, children::Array{AbstractExpr}, value::Union{Missing, Nothing, T}, name::String, length::Int64, __is_commutative::Bool, range::Union{UnitRange{I}, I} where I<:Integer) where T<:Integer @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:34                                                                                                                                                        
[7] kwcall(::NamedTuple, ::typeof(smt), zs_mixed::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:172                                                                                                                                     
[8] var"#smt#122"(assert, line_ending, as_list, ::typeof(smt), zs_mixed::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:172                                                                                                              
[9] and(zs::Union{Bool, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:110
[10] smt(zs_mixed::Union{Array{T}, T}...; assert, line_ending, as_list) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:172                                                                                                                                      
[11] var"#sat!#157"(solver, logic, clear_values_if_unsat, line_ending, start_commands, end_commands, ::typeof(sat!), prob::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:34
[12] __flatten_nested_exprs(operator::Function, zs::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/utilities.jl:8                                                                                                                                              
[13] xnor(zs::Union{Integer, T}...) where T<:AbstractBitVectorExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:302
[14] xor(zs::Union{Bool, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:194
[15] xor(values::Union{Array{T}, BitVector}) where T<:Bool @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:198
[16] kwcall(::NamedTuple, ::typeof(assert!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:197                                                                                                               
[17] save(zs::Union{Array{T}, T}...; io, assert, check_sat, line_ending, start_commands, end_commands) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:206                                                                                                       
[18] kwcall(::NamedTuple, ::typeof(save), zs::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:206                                                                                                                                         
[19] or(zs::Union{Bool, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:152
[20] sat!(prob::Union{Array{T}, T}...; solver, logic, clear_values_if_unsat, line_ending, start_commands, end_commands) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:34                                                                                                          
[21] var"#save#135"(io, assert, check_sat, line_ending, start_commands, end_commands, ::typeof(save), zs::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:206                                                                             
[22] kwcall(::NamedTuple, ::typeof(sat!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:143                                                                                                                  
[23] and(zs::Union{Integer, T}...) where T<:AbstractBitVectorExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:240
[24] kwcall(::NamedTuple, ::typeof(sat!), prob::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:34
Test Failed at /home/Transcendence/.julia/packages/Aqua/bBjXC/src/unbound_args.jl:37
  Expression: isempty(unbounds)
   Evaluated: isempty(Method[sat!(interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...; logic, line_ending) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:143, assert!(interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...; line_ending) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:197, var"#assert!#185"(line_ending, ::typeof(assert!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:197, or(zs::Union{Integer, T}...) where T<:AbstractBitVectorExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:229, var"#sat!#178"(logic, line_ending, ::typeof(sat!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:143, Satisfiability.SlicedBitVectorExpr(op::Symbol, children::Array{AbstractExpr}, value::Union{Missing, Nothing, T}, name::String, length::Int64, __is_commutative::Bool, range::Union{UnitRange{I}, I} where I<:Integer) where T<:Integer @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:34, kwcall(::NamedTuple, ::typeof(smt), zs_mixed::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:172, var"#smt#122"(assert, line_ending, as_list, ::typeof(smt), zs_mixed::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:172, and(zs::Union{Bool, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:110, smt(zs_mixed::Union{Array{T}, T}...; assert, line_ending, as_list) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:172  …  xor(values::Union{Array{T}, BitVector}) where T<:Bool @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:198, kwcall(::NamedTuple, ::typeof(assert!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:197, save(zs::Union{Array{T}, T}...; io, assert, check_sat, line_ending, start_commands, end_commands) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:206, kwcall(::NamedTuple, ::typeof(save), zs::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:206, or(zs::Union{Bool, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:152, sat!(prob::Union{Array{T}, T}...; solver, logic, clear_values_if_unsat, line_ending, start_commands, end_commands) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:34, var"#save#135"(io, assert, check_sat, line_ending, start_commands, end_commands, ::typeof(save), zs::Union{Array{T}, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/smt_representation.jl:206, kwcall(::NamedTuple, ::typeof(sat!), interactive_solver::InteractiveSolver, exprs::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:143, and(zs::Union{Integer, T}...) where T<:AbstractBitVectorExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:240, kwcall(::NamedTuple, ::typeof(sat!), prob::Union{Array{T}, T}...) where T<:BoolExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/sat.jl:34])

ERROR: There was an error during testing

Type piracy detected

julia> Aqua.test_piracies(Satisfiability)
Possible type-piracy detected:
[1] repeat(a::Integer, n::Int64) @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:435
[2] xor(zs_mixed::Array{T}; broadcast_type) where T @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:170
[3] xor(exprs::Base.Generator) @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:195
[4] xor(zs::Union{Bool, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:194
[5] xor(values::Union{Array{T}, BitVector}) where T<:Bool @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:198
[6] kwcall(::NamedTuple, ::typeof(xor), zs_mixed::Array{T}) where T @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:170
Test Failed at /home/Transcendence/.julia/packages/Aqua/bBjXC/src/piracies.jl:240
  Expression: isempty(v)
   Evaluated: isempty(Method[repeat(a::Integer, n::Int64) @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BitVectorExpr.jl:435, xor(zs_mixed::Array{T}; broadcast_type) where T @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:170, xor(exprs::Base.Generator) @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:195, xor(zs::Union{Bool, T}...) where T<:AbstractExpr @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:194, xor(values::Union{Array{T}, BitVector}) where T<:Bool @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:198, kwcall(::NamedTuple, ::typeof(xor), zs_mixed::Array{T}) where T @ Satisfiability ~/Desktop/SAT/Satisfiability.jl/src/BooleanOperations.jl:170])

ERROR: There was an error during testing

Undefined exports detected

julia> Aqua.test_undefined_exports(Satisfiability)
Undefined exports detected:
3-element Vector{Symbol}:
 Symbol("Satisfiability.decode_from_ascii")
 Symbol("Satisfiability.pop")
 Symbol("Satisfiability.push")
Test Failed at /home/Transcendence/.julia/packages/Aqua/bBjXC/src/exports.jl:57
  Expression: isempty(exports)
   Evaluated: isempty([Symbol("Satisfiability.decode_from_ascii"), Symbol("Satisfiability.pop"), Symbol("Satisfiability.push")])

ERROR: There was an error during testing

Other errors

julia> Aqua.test_project_extras(Satisfiability)
Test Failed at /home/Transcendence/.julia/packages/Aqua/bBjXC/src/project_extras.jl:12
  Expression: isempty(msgs)
   Evaluated: isempty(["Root and test projects should be consistent for projects supporting Julia <= 1.1.", "Test dependencies not in root project (/home/Transcendence/Desktop/SAT/Satisfiability.jl/Project.toml):\n\tLogging [56ddb016-857b-54e1-b83d-db4d58db5568]\n\tTestItemRunner [f8b46487-2199-4994-9208-9a1283c18c0a]"])

ERROR: There was an error during testing
julia> Aqua.test_deps_compat(Satisfiability)
Test Summary: | Pass  Total  Time
julia         |    1      1  0.0s
Base.PkgId(Base.UUID("160ab843-0bc6-4ba4-9585-b7478b70f443"), "Satisfiability") does not declare a compat entry for the following deps:
1-element Vector{Base.PkgId}:
 Unicode [4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5]
Base.PkgId(Base.UUID("160ab843-0bc6-4ba4-9585-b7478b70f443"), "Satisfiability") deps: Test Failed at /home/Transcendence/.julia/packages/Aqua/bBjXC/src/deps_compat.jl:60
  Expression: isempty(result)
   Evaluated: isempty(Base.PkgId[Base.PkgId(Base.UUID("4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"), "Unicode")])

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.11.1+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:679 [inlined]
 [2] test_deps_compat(pkg::Base.PkgId, deps_type::String; broken::Bool, kwargs::@Kwargs{})
   @ Aqua ~/.julia/packages/Aqua/bBjXC/src/deps_compat.jl:60
 [3] test_deps_compat
   @ ~/.julia/packages/Aqua/bBjXC/src/deps_compat.jl:55 [inlined]
 [4] macro expansion
   @ ~/.julia/packages/Aqua/bBjXC/src/deps_compat.jl:41 [inlined]
 [5] macro expansion
   @ ~/.julia/juliaup/julia-1.11.1+0.x64.linux.gnu/share/julia/stdlib/v1.11/Test/src/Test.jl:1700 [inlined]
 [6] test_deps_compat(pkg::Base.PkgId; check_julia::Bool, check_extras::Bool, check_weakdeps::Bool, kwargs::@Kwargs{})
   @ Aqua ~/.julia/packages/Aqua/bBjXC/src/deps_compat.jl:41
Test Summary:                                                                        | Fail  Total  Time
Base.PkgId(Base.UUID("160ab843-0bc6-4ba4-9585-b7478b70f443"), "Satisfiability") deps |    1      1  0.6s
ERROR: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.

What is the expected behavior?

The tests that causes error should pass as well.

Please tell us about your environment.

julia> using InteractiveUtils

julia> versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12ad (2024-10-16 10:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 4 × Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
@elsoroka elsoroka self-assigned this Dec 16, 2024
@elsoroka elsoroka added the bug Something isn't working label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants