Skip to content

Commit

Permalink
Use qualifed call to Not in macro-generated code.
Browse files Browse the repository at this point in the history
Fixes #83

Also did some renames to use `$curmod` instead of `SimpleTraits` everywhere.
  • Loading branch information
mauro3 committed Oct 2, 2022
1 parent 29ea2ad commit ba5465d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/SimpleTraits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ macro traitimpl(tr)
end
else
return quote
$fnhead = Not{$trname{$(paras...)}}
$fnhead = $curmod.Not{$trname{$(paras...)}}
nothing
end
end
Expand All @@ -167,8 +167,8 @@ macro traitimpl(tr)
fn = Expr(:call, GlobalRef(SimpleTraits, :!), fn)
end
return esc(quote
function SimpleTraits.trait(::Type{$Tr{$(P1...)}}) where {$(P1...)}
return $fn($(P2...)) ? $Tr{$(P1...)} : Not{$Tr{$(P1...)}}
function $curmod.trait(::Type{$Tr{$(P1...)}}) where {$(P1...)}
return $fn($(P2...)) ? $Tr{$(P1...)} : $curmod.Not{$Tr{$(P1...)}}
end
nothing
end)
Expand Down Expand Up @@ -510,10 +510,10 @@ macro check_fast_traitdispatch(Tr, Arg=:Int, verbose=false)
out = gensym()
esc(quote
$test_fn_null(x) = 1
$nl_null = SimpleTraits.llvm_lines($test_fn_null, ($Arg,))
$nl_null = $curmod.llvm_lines($test_fn_null, ($Arg,))
@traitfn $test_fn(x::::$Tr) = 1
@traitfn $test_fn(x::::(!$Tr)) = 2
$nl = SimpleTraits.llvm_lines($test_fn, ($Arg,))
$nl = $curmod.llvm_lines($test_fn, ($Arg,))
$out = $nl == $nl_null
if $verbose && !$out
println("Number of llvm code lines $($nl) but should be $($nl_null).")
Expand Down

0 comments on commit ba5465d

Please sign in to comment.