You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> using SimpleTraits
julia> abstract type AbFoo end
julia> struct Foo <: AbFoo
x::Int
end
julia> @traitdef IsDirected{G<:AbFoo}
julia> @traitimpl IsDirected{G} <- is_directed(G)
julia> is_directed(x...) = error("nope")
is_directed (generic function with 1 method)
julia> is_directed(::Foo) = true
is_directed (generic function with 2 methods)
julia> is_directed(::Type{Foo}) = true
is_directed (generic function with 3 methods)
julia> is_directed(Foo)
true
julia> is_directed(AbFoo)
ERROR: nope
Stacktrace:
[1] is_directed(::Type{T} where T) at ./REPL[6]:1
julia> @traitfn f(g::::IsDirected) = g.x
f (generic function with 2 methods)
julia> f(Foo(10))
ERROR: MethodError: no method matching is_directed(::Type{Foo})
The applicable method may be too new: running in world age 21602, while current world is 21607.
Closest candidates are:
is_directed(::Type{Foo}) at REPL[8]:1 (method too new to be called from this world context.)
is_directed(::Any...) at REPL[6]:1 (method too new to be called from this world context.)
is_directed(::Foo) at REPL[7]:1 (method too new to be called from this world context.)
Stacktrace:
[1] trait(...) at /Users/seth/.julia/v0.6/SimpleTraits/src/SimpleTraits.jl:186
[2] f(::Foo) at /Users/seth/.julia/v0.6/SimpleTraits/src/SimpleTraits.jl:319
julia> is_directed(Foo)
true
julia> f(Foo(10))
ERROR: MethodError: no method matching is_directed(::Type{Foo})
The applicable method may be too new: running in world age 21602, while current world is 21608.
Closest candidates are:
is_directed(::Type{Foo}) at REPL[15]:1 (method too new to be called from this world context.)
is_directed(::Any...) at REPL[6]:1 (method too new to be called from this world context.)
is_directed(::Foo) at REPL[7]:1 (method too new to be called from this world context.)
Stacktrace:
[1] trait(...) at /Users/seth/.julia/v0.6/SimpleTraits/src/SimpleTraits.jl:186
[2] f(::Foo) at /Users/seth/.julia/v0.6/SimpleTraits/src/SimpleTraits.jl:319
julia> is_directed(Foo)
true
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: