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

Method ambiguities reported by Aqua #681

Open
prbzrg opened this issue Dec 27, 2023 · 3 comments
Open

Method ambiguities reported by Aqua #681

prbzrg opened this issue Dec 27, 2023 · 3 comments

Comments

@prbzrg
Copy link

prbzrg commented Dec 27, 2023

In Julia v1.10, I used Aqua to detect method ambiguities in my package impICNF/ContinuousNormalizingFlows.jl#356 and some of its report were related to this package:

Ambiguity #7
==(x::ForwardDiff.Dual{Tx}, y::Real) where Tx @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:144
==(x::Real, y::AbstractIrrational) @ Base irrationals.jl:90

Possible fix, define
  ==(::ForwardDiff.Dual{Tx}, ::AbstractIrrational) where Tx

Ambiguity #13
==(x::Real, y::ForwardDiff.Dual{Ty}) where Ty @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:145
==(x::AbstractIrrational, y::Real) @ Base irrationals.jl:89

Possible fix, define
  ==(::AbstractIrrational, ::ForwardDiff.Dual{Ty}) where Ty

Ambiguity #18
ForwardDiff.Dual(args...) @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:73
(::Type{T})(x::T) where T<:Number @ Core boot.jl:792

Possible fix, define
  ForwardDiff.Dual(::ForwardDiff.Dual)

Ambiguity #19
(ForwardDiff.Dual{T, V})(x) where {T, V} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:79
(::Type{T})(x::T) where T<:Number @ Core boot.jl:792

Possible fix, define
  (ForwardDiff.Dual{T, V})(::ForwardDiff.Dual{T, V}) where {T, V}

Ambiguity #20
ForwardDiff.Dual{T, V, N}(x) where {T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:77
(::Type{T})(x::Base.TwicePrecision) where T<:Number @ Base twiceprecision.jl:265

Possible fix, define
  ForwardDiff.Dual{T, V, N}(::Base.TwicePrecision) where {T, V, N}

Ambiguity #21
(ForwardDiff.Dual{T})(value) where T @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:69
(::Type{T})(x::Base.TwicePrecision) where T<:Number @ Base twiceprecision.jl:265

Possible fix, define
  (ForwardDiff.Dual{T})(::Base.TwicePrecision) where T

Ambiguity #22
(ForwardDiff.Dual{T, V})(x) where {T, V} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:79
(::Type{T})(x::Base.TwicePrecision) where T<:Number @ Base twiceprecision.jl:265

Possible fix, define
  (ForwardDiff.Dual{T, V})(::Base.TwicePrecision) where {T, V}

Ambiguity #23
ForwardDiff.Dual(args...) @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:73
(::Type{T})(x::Base.TwicePrecision) where T<:Number @ Base twiceprecision.jl:265

Possible fix, define
  ForwardDiff.Dual(::Base.TwicePrecision)

Ambiguity #24
(ForwardDiff.Dual{T, V})(x) where {T, V} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:79
(::Type{T})(z::Complex) where T<:Real @ Base complex.jl:44

Possible fix, define
  (ForwardDiff.Dual{T, V})(::Complex) where {T, V}

Ambiguity #25
ForwardDiff.Dual(args...) @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:73
(::Type{T})(z::Complex) where T<:Real @ Base complex.jl:44

Possible fix, define
  ForwardDiff.Dual(::Complex)

Ambiguity #26
ForwardDiff.Dual{T, V, N}(x::Number) where {T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:78
(::Type{T})(z::Complex) where T<:Real @ Base complex.jl:44

Possible fix, define
  ForwardDiff.Dual{T, V, N}(::Complex) where {T, V, N}

Ambiguity #27
ForwardDiff.Dual{T, V, N}(x) where {T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:77
(::Type{T})(z::Complex) where T<:Real @ Base complex.jl:44

Possible fix, define
  ForwardDiff.Dual{T, V, N}(::Complex) where {T, V, N}

Ambiguity #28
(ForwardDiff.Dual{T})(value) where T @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:69
(::Type{T})(z::Complex) where T<:Real @ Base complex.jl:44

Possible fix, define
  (ForwardDiff.Dual{T})(::Complex) where T

Ambiguity #29
ForwardDiff.Dual{T, V, N}(x) where {T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:77
(::Type{T})(x::AbstractChar) where T<:Union{AbstractChar, Number} @ Base char.jl:50

Possible fix, define
  ForwardDiff.Dual{T, V, N}(::AbstractChar) where {T, V, N}

Ambiguity #30
ForwardDiff.Dual(args...) @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:73
(::Type{T})(x::AbstractChar) where T<:Union{AbstractChar, Number} @ Base char.jl:50

Possible fix, define
  ForwardDiff.Dual(::AbstractChar)

Ambiguity #31
(ForwardDiff.Dual{T})(value) where T @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:69
(::Type{T})(x::AbstractChar) where T<:Union{AbstractChar, Number} @ Base char.jl:50

Possible fix, define
  (ForwardDiff.Dual{T})(::AbstractChar) where T

Ambiguity #32
(ForwardDiff.Dual{T, V})(x) where {T, V} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:79
(::Type{T})(x::AbstractChar) where T<:Union{AbstractChar, Number} @ Base char.jl:50

Possible fix, define
  (ForwardDiff.Dual{T, V})(::AbstractChar) where {T, V}

Ambiguity #40
^(x::Irrational, y::ForwardDiff.Dual{Ty}) where Ty @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:145
^(::Irrational{:ℯ}, x::Number) @ Base.MathConstants mathconstants.jl:119

Possible fix, define
  ^(::Irrational{:ℯ}, ::ForwardDiff.Dual{Ty}) where Ty

Ambiguity #43
^(x::Real, y::ForwardDiff.Dual{Ty}) where Ty @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:145
^(::Irrational{:ℯ}, x::Number) @ Base.MathConstants mathconstants.jl:119

Possible fix, define
  ^(::Irrational{:ℯ}, ::ForwardDiff.Dual{Ty}) where Ty

Ambiguity #55
convert(::Type{ForwardDiff.Dual{T, V, N}}, x) where {T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:435
convert(::Type{T}, index::CartesianIndex{1}) where T<:Number @ Base.IteratorsMD multidimensional.jl:135

Possible fix, define
  convert(::Type{ForwardDiff.Dual{T, V, N}}, ::CartesianIndex{1}) where {T, V, N}

Ambiguity #56
convert(::Type{ForwardDiff.Dual{T, V, N}}, x) where {T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:435
convert(::Type{T}, x::Base.TwicePrecision) where T<:Number @ Base twiceprecision.jl:271

Possible fix, define
  convert(::Type{ForwardDiff.Dual{T, V, N}}, ::Base.TwicePrecision) where {T, V, N}

Ambiguity #59
convert(::Type{ForwardDiff.Dual{T, V, N}}, x) where {T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:435
convert(::Type{T}, x::AbstractChar) where T<:Number @ Base char.jl:185

Possible fix, define
  convert(::Type{ForwardDiff.Dual{T, V, N}}, ::AbstractChar) where {T, V, N}

Ambiguity #80
log(x::Irrational, y::ForwardDiff.Dual{Ty}) where Ty @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:145
log(::Irrational{:ℯ}, x::Number) @ Base.MathConstants mathconstants.jl:124

Possible fix, define
  log(::Irrational{:ℯ}, ::ForwardDiff.Dual{Ty}) where Ty

Ambiguity #81
log(x::Real, y::ForwardDiff.Dual{Ty}) where Ty @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:145
log(::Irrational{:ℯ}, x::Number) @ Base.MathConstants mathconstants.jl:124

Possible fix, define
  log(::Irrational{:ℯ}, ::ForwardDiff.Dual{Ty}) where Ty

Ambiguity #90
promote_rule(::Type{R}, ::Type{ForwardDiff.Dual{T, V, N}}) where {R<:Real, T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:427
promote_rule(::Type{<:AbstractIrrational}, ::Type{T}) where T<:Real @ Base irrationals.jl:44

Possible fix, define
  promote_rule(::Type{R}, ::Type{ForwardDiff.Dual{T, V, N}}) where {T, V, N, R<:AbstractIrrational}

Ambiguity #92
promote_rule(::Type{R}, ::Type{ForwardDiff.Dual{T, V, N}}) where {R<:Real, T, V, N} @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:427
promote_rule(::Type{S}, ::Type{T}) where {S<:AbstractIrrational, T<:Number} @ Base irrationals.jl:45

Possible fix, define
  promote_rule(::Type{S}, ::Type{ForwardDiff.Dual{T, V, N}}) where {S<:AbstractIrrational, T, V, N}

I would appreciate your attention to this issue.

@jonschumacher
Copy link

Possible duplicate of #597

@prbzrg
Copy link
Author

prbzrg commented Jan 1, 2024

There are differences between Julia v1.9 and v1.10 ambiguity report. IMO, there should be an Aqua test in CI, so we can have an updated list of ambiguities for both Julia versions.

@hyrodium
Copy link
Contributor

hyrodium commented Jan 2, 2024

x-ref: #662

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants