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

invalid syntax (gotoifnot (true) 0) from return type conversion of an opaque closure #44723

Closed
tkf opened this issue Mar 24, 2022 · 2 comments · Fixed by #44727
Closed

invalid syntax (gotoifnot (true) 0) from return type conversion of an opaque closure #44723

tkf opened this issue Mar 24, 2022 · 2 comments · Fixed by #44727
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@tkf
Copy link
Member

tkf commented Mar 24, 2022

julia> demo(thunk)::Any = Base.Experimental.@opaque () -> true ? 1 : 2
ERROR: syntax: invalid syntax (gotoifnot (true) 0)
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

julia> VERSION
v"1.9.0-DEV.241"

Meta.@lower throws, so I guess it happens in the frontend?

julia> Meta.@lower demo(thunk)::Any = Base.Experimental.@opaque () -> true ? 1 : 2
:($(Expr(:error, "invalid syntax (gotoifnot (true) 0)")))

But fe throws something else?

> (fe "demo(thunk)::Any = Base.Experimental.@opaque () -> true ? 1 : 2")
error: invalid syntax (call (top getproperty) (call (top getproperty) (outerref Base) (inert Experiment
al)) (inert @opaque)) # none, line 1 begin
    nothing
    begin
        nothing
        #1 = (new #1#2)
        (unnecessary #1)
    end
end
#0 (error ("invalid syntax (call (top getproperty) (call (top getproperty) (outerref Base) (inert Exper
imental)) (inert @opaque)) # none, line 1 begin\n    nothing\n    begin\n        nothing\n        #1 =
(new #1#2)\n        (unnecessary #1)\n    end\nend"))
#1 (compile-body/compile
...
@simeonschaub simeonschaub added bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage) labels Mar 24, 2022
@simeonschaub
Copy link
Member

But fe throws something else?

I don't think fe actually does macro expansion, so you'll need to expand the macro from Julia.

@tkf
Copy link
Member Author

tkf commented Mar 24, 2022

Ah, good to know.

> (expand-toplevel-expr '(= (:: (call demo) Any) (block (line 1 strnig) (opaque_closure (-> (tuple) (block (line 1 strnig) (if (true) 1 2)))))) 'none 0)
error: invalid syntax (gotoifnot (true) 0)
#0 (error ("invalid syntax (gotoifnot (true) 0)"))
#1 (compile-body/compile/lambda
 ((gotoifnot (true) 0)
  (return 1) (label 0) (return 2)))
...

simeonschaub added a commit that referenced this issue Mar 27, 2022
fixes #44723

Co-authored-by: Takafumi Arakaki <aka.tkf@gmail.com>
KristofferC pushed a commit that referenced this issue Mar 28, 2022
fixes #44723

Co-authored-by: Takafumi Arakaki <aka.tkf@gmail.com>
(cherry picked from commit 19eb307)
KristofferC pushed a commit that referenced this issue Apr 19, 2022
fixes #44723

Co-authored-by: Takafumi Arakaki <aka.tkf@gmail.com>
(cherry picked from commit 19eb307)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants