Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluating functional IR throws unsupported or misplaced expression lambda #102

Open
rtjoa opened this issue Dec 7, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@rtjoa
Copy link

rtjoa commented Dec 7, 2022

Functional IRs sometimes throw unsupported or misplaced expression lambda or ERROR: MethodError: objects of type IRTools.Inner.Self are not callable when evaluated (similar to #54)

Environment: IRTools v0.4.7, Julia Version 1.81, macOS Monterey, Apple M1 Pro

using IRTools: IR, @dynamo, functional, evalir, @code_ir

@dynamo function functional_dyna(a...)
    ir = IR(a...)
    ir === nothing && return
    functional(ir)
end

foo() = false
bar() = if true false else false end

# Works: foo run normally
functional_dyna(foo)  # false

# Works: foo run in two steps
ir = @code_ir functional_dyna foo()
evalir(ir, foo)  # false

# Works: bar run normally
functional_dyna(bar)  # false

# Errors: bar run in two steps
ir = @code_ir functional_dyna bar()
evalir(ir, bar)  # ERROR: unsupported or misplaced expression lambda

The error trace was:

Stacktrace:
 [1] var"##344"(arg1::typeof(bar))
   @ IRTools.Inner ~/.julia/packages/IRTools/FeBr2/src/eval.jl:18
 [2] #invokelatest#2
   @ ./essentials.jl:729 [inlined]
 [3] invokelatest
   @ ./essentials.jl:726 [inlined]
 [4] evalir
   @ ~/.julia/packages/IRTools/FeBr2/src/eval.jl:25 [inlined]
 [5] evalir(ir::IRTools.Inner.IR, args::Any)
   @ IRTools.Inner ~/.julia/packages/IRTools/FeBr2/src/eval.jl:26
 [6] top-level scope
@rtjoa rtjoa added the bug Something isn't working label Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant