diff --git a/src/Compiler.jl b/src/Compiler.jl index ddbd1cb1e5..b9674c61a5 100644 --- a/src/Compiler.jl +++ b/src/Compiler.jl @@ -435,8 +435,7 @@ macro jit(args...) end is_a_module(s::Symbol)::Bool = begin - b = ccall(:jl_get_module_binding, Any, (Module, Symbol, Any), Main, s, 0) - isdefined(b, :value) && b.value isa Module + isdefined(@__MODULE__, s) && getproperty(@__MODULE__, s) isa Module end #create expression for more complex expression than a call @@ -449,9 +448,7 @@ function wrapped_expression(expr::Expr) return ( Expr(:tuple, args...), quote - struct $fname - ($fname)($(args...)) = $expr - end + ($fname)($(args...)) = $expr end, quote $(fname) diff --git a/test/basic.jl b/test/basic.jl index edc864cc88..b1b964416d 100644 --- a/test/basic.jl +++ b/test/basic.jl @@ -105,7 +105,7 @@ end x = Reactant.to_rarray(ones(3)) f(x) = x .+ 1 @test @jit(x + x - x + x * float(Base.pi) * 0) ≈ x - @test @jit(f(f(f(f(x))))) ≈ x .+ 4 + @test @jit(f(f(f(f(x))))) ≈ @allowscalar x .+ 4 end function sumcos(x)