diff --git a/Project.toml b/Project.toml index 6ba21563..cb8c6950 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "HerbSearch" uuid = "3008d8e8-f9aa-438a-92ed-26e9c7b4829f" authors = ["Sebastijan Dumancic ", "Jaap de Jong ", "Nicolae Filat ", "Piotr CichoĊ„ ", "Tilman Hinnerichs "] -version = "0.4.1" +version = "0.4.2" [deps] DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" diff --git a/src/program_iterator.jl b/src/program_iterator.jl index fb5fcbd9..d70f65df 100644 --- a/src/program_iterator.jl +++ b/src/program_iterator.jl @@ -71,7 +71,7 @@ function generate_iterator(mod::Module, ex::Expr, mut::Bool=false) @match ex begin Expr(:(<:), decl::Expr, super) => begin # a check that `super` is a subtype of `ProgramIterator` - check = :(eval($mod.$super) <: HerbSearch.ProgramIterator || + check = :($mod.$super <: HerbSearch.ProgramIterator || throw(ArgumentError("attempting to inherit a non-ProgramIterator"))) # process the decl diff --git a/test/Project.toml b/test/Project.toml index 9e172f7b..7714cc39 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -4,7 +4,6 @@ HerbConstraints = "1fa96474-3206-4513-b4fa-23913f296dfc" HerbCore = "2b23ba43-8213-43cb-b5ea-38c12b45bd45" HerbGrammar = "4ef9e186-2fe5-4b24-8de7-9f7291f24af7" HerbInterpret = "5bbddadd-02c5-4713-84b8-97364418cca7" -HerbSearch = "3008d8e8-f9aa-438a-92ed-26e9c7b4829f" HerbSpecification = "6d54aada-062f-46d8-85cf-a1ceaf058a06" LegibleLambdas = "f1f30506-32fe-5131-bd72-7c197988f9e5" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" diff --git a/test/test_programiterator_macro.jl b/test/test_programiterator_macro.jl index 29a2377c..4d3c1330 100644 --- a/test/test_programiterator_macro.jl +++ b/test/test_programiterator_macro.jl @@ -36,6 +36,18 @@ @test it.f1 && it.f2 == 4 end + @testset "inheriting from something !<: ProgramIterator" begin + @test_throws ArgumentError @programiterator ConcreteIterator( + f1::Bool, + f2 + ) <: AbstractFloat + + # it = ConcreteIterator(g, s, max_depth = max_depth, max_size = max_size, true, 4) + + # @test ConcreteIterator <: IteratorFamily + # @test it.f1 && it.f2 == 4 + end + @testset "mutable iterator" begin @programiterator mutable AnotherIterator() <: IteratorFamily