I've seen this quite a few times, and it is very hard to figure out what the compiler is trying to tell me. I have no idea why the name is gensymed, when methods
shows me exactly what I supplied. There are no other constructor methods for this type, just this one:
struct Cellular{N} <: AbstractSampler{N}
random_state::RandomState
table::Vector{Float64}
jitter::Float64
metric::DistanceMetric
cell_func::CellFunction
function Cellular{N}(;
seed::Seed=nothing,
jitter::Real=1.0,
metric::DistanceMetric=Euclidean,
cell_func::CellFunction=F1,
) where {N}
rs = RandomState(seed)
table = rand(rs.rng, Uniform(-1.0, 1.0), table_size(Val(N)))
new{N}(rs, table, jitter, metric, cell_func)
end
end
(CoherentNoise) julia> s = Cellular{2}(seed=1)
ERROR: MethodError: no method matching (::CoherentNoise.Noise.CellularNoise.var"#_#1#2")(::Int64, ::Float64, :
:Type{Euclidean}, ::Type{F1}, ::Type{Cellular{2}})
Closest candidates are:
(::CoherentNoise.Noise.CellularNoise.var"#_#1#2")(::Union{Nothing, Integer}, ::Real, ::CoherentNoise.Noise.C
ellularNoise.DistanceMetric, ::CoherentNoise.Noise.CellularNoise.CellFunction, ::Type{Cellular{N}}) where N at
~/projects/Julia/CoherentNoise/src/noise_cellular.jl:32
Stacktrace:
[1] top-level scope
@ REPL[5]:1
Hard to say without a reproducer. Have you tried making a minimal working example?
It seems this was due to specifying default values that are types rather than instances of the asserted type.
Such a confusing error message
Michael Fiano has marked this topic as resolved.
Last updated: Nov 22 2024 at 04:41 UTC