Skip to content

Using @sync from a package macro fails when the same result works in the REPL #28775

@ChrisRackauckas

Description

@ChrisRackauckas

Maybe this is simpler than I think, but ChrisRackauckas/ParallelDataTransfer.jl#14 seems to demonstrate that using @sync from outside the Main module gives an issue with let. MWE:

module Tester
  macro tester()
    quote
      @sync for i in 1:5
        println(i)
      end
    end
  end
end
using Main.Tester
Tester.@tester

throws

syntax: invalid let syntax
include_string(::Module, ::String, ::String) at loading.jl:1002
include_string(::Module, ::String, ::String, ::Int64) at eval.jl:30
(::getfield(Atom, Symbol("##110#115")){String,Int64,String})() at eval.jl:89
withpath(::getfield(Atom, Symbol("##110#115")){String,Int64,String}, ::String) at utils.jl:30
withpath at eval.jl:46 [inlined]
#109 at eval.jl:88 [inlined]
hideprompt(::getfield(Atom, Symbol("##109#114")){String,Int64,String}) at repl.jl:76
macro expansion at eval.jl:87 [inlined]
(::getfield(Atom, Symbol("##108#113")){Dict{String,Any}})() at task.jl:85

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)macros@macros

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions