diff --git a/src/StatsModels.jl b/src/StatsModels.jl index 02ac635a..642534c8 100644 --- a/src/StatsModels.jl +++ b/src/StatsModels.jl @@ -59,8 +59,8 @@ export include("traits.jl") include("contrasts.jl") include("terms.jl") -include("temporal_terms.jl") include("schema.jl") +include("temporal_terms.jl") include("formula.jl") include("modelframe.jl") include("statsmodel.jl") diff --git a/src/temporal_terms.jl b/src/temporal_terms.jl index 41611bdb..5a29ee24 100644 --- a/src/temporal_terms.jl +++ b/src/temporal_terms.jl @@ -26,7 +26,7 @@ struct LeadLagTerm{T<:AbstractTerm, F<:Union{typeof(lead), typeof(lag)}} <: Abst nsteps::Int end -function apply_schema(t::FunctionTerm{F}, sch, ctx::Type) where F<:Union{typeof(lead), typeof(lag)} +function apply_schema(t::FunctionTerm{F}, sch::Schema, ctx::Type) where F<:Union{typeof(lead), typeof(lag)} opname = string(nameof(F.instance)) if length(t.args_parsed) == 1 # lag(term) term_parsed = first(t.args_parsed) diff --git a/test/ambiguity.jl b/test/ambiguity.jl new file mode 100644 index 00000000..de9f10b8 --- /dev/null +++ b/test/ambiguity.jl @@ -0,0 +1,3 @@ +@testset "Ambiguity detection" begin + @test isempty(Test.detect_ambiguities(StatsModels)) +end diff --git a/test/extension.jl b/test/extension.jl index 10a56483..2f056928 100644 --- a/test/extension.jl +++ b/test/extension.jl @@ -93,4 +93,9 @@ end @testset "Fallback" begin @test_throws ArgumentError modelcols(DummyTerm(), (a=[1], )) end + + @testset "Ambiguity detection" begin + # ambiguities are introduced by adding additional methods here + @test_broken isempty(Test.detect_ambiguities(StatsModels)) + end end diff --git a/test/runtests.jl b/test/runtests.jl index 02713f1d..a39e0777 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,7 +8,8 @@ using StatsBase using StatsModels: ContrastsMatrix -my_tests = ["formula.jl", +my_tests = ["ambiguity.jl", + "formula.jl", "terms.jl", "temporal_terms.jl", "schema.jl",