diff --git a/src/univariates.jl b/src/univariates.jl index c75c579d5b..f0b9920877 100644 --- a/src/univariates.jl +++ b/src/univariates.jl @@ -646,7 +646,7 @@ macro _delegate_statsfuns(D, fpre, psyms...) pargs = [Expr(:(.), :d, Expr(:quote, s)) for s in psyms] # output type of `quantile` etc. - T = :($D isa DiscreteUnivariateDistribution ? Int : Real) + T = :($D <: DiscreteUnivariateDistribution ? Int : Real) return quote $Distributions.pdf(d::$D, x::Real) = $(fpdf)($(pargs...), x) diff --git a/test/univariates.jl b/test/univariates.jl index 8913b3866f..4fa2fadc90 100644 --- a/test/univariates.jl +++ b/test/univariates.jl @@ -166,3 +166,12 @@ for c in ["discrete", verify_and_test_drive(jsonfile, ARGS, 10^6) println() end + +# #1358 +@testset "Poisson quantile" begin + d = Poisson(1) + @test quantile(d, 0.2) isa Int + @test cquantile(d, 0.4) isa Int + @test invlogcdf(d, log(0.2)) isa Int + @test invlogccdf(d, log(0.6)) isa Int +end