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

vararg type #2150

Merged
merged 2 commits into from
Dec 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 35 additions & 29 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,32 @@ const known_ops = Dict{DataType,Tuple{Symbol,Int,Union{Nothing,Tuple{Symbol,Data
Tys = (Float32, Float64)

if length(sparam_vals) == arity
T = first(sparam_vals)::Type
legal = T ∈ Tys

if legal
if name == :ldexp
if !(sparam_vals[2] <: Integer)
legal = false
end
elseif name == :pow
if sparam_vals[2] <: Integer
name = :powi
elseif sparam_vals[2] != T
legal = false
end
elseif name == :jl_rem2pi
else
if !all(==(T), sparam_vals)
legal = false
T = first(sparam_vals)
if (T isa Type)
T = T::Type
legal = T ∈ Tys

if legal
if name == :ldexp
if !(sparam_vals[2] <: Integer)
legal = false
end
elseif name == :pow
if sparam_vals[2] <: Integer
name = :powi
elseif sparam_vals[2] != T
legal = false
end
elseif name == :jl_rem2pi
else
if !all(==(T), sparam_vals)
legal = false
end
end
end
end
if legal
return name, toinject, T
if legal
return name, toinject, T
end
end
end
end
Expand All @@ -144,15 +147,18 @@ const known_ops = Dict{DataType,Tuple{Symbol,Int,Union{Nothing,Tuple{Symbol,Data
Tys = (Complex{Float32}, Complex{Float64})
if length(sparam_vals) == arity
T = first(sparam_vals)
legal = T ∈ Tys

if legal
if !all(==(T), sparam_vals)
legal = false
if (T isa Type)
T = T::Type
legal = T ∈ Tys

if legal
if !all(==(T), sparam_vals)
legal = false
end
end
if legal
return name, toinject, T
end
end
if legal
return name, toinject, T
end
end
end
Expand Down
Loading