Skip to content

Commit

Permalink
vararg type (#2150)
Browse files Browse the repository at this point in the history
* vararg type

* Update compiler.jl
  • Loading branch information
wsmoses authored Dec 1, 2024
1 parent 31055b5 commit 611dda9
Showing 1 changed file with 35 additions and 29 deletions.
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

0 comments on commit 611dda9

Please sign in to comment.