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

Module inside a begin ... end leads to false-positive parsing error #54092

Open
vchuravy opened this issue Apr 15, 2024 · 0 comments
Open

Module inside a begin ... end leads to false-positive parsing error #54092

vchuravy opened this issue Apr 15, 2024 · 0 comments
Labels
parser Language parsing and surface syntax

Comments

@vchuravy
Copy link
Sponsor Member

module Test
    begin
        module Inner
        end
    end
end
julia> include("Test.jl")
ERROR: LoadError: syntax: "module" expression not at top level
Stacktrace:
 [1] top-level scope
   @ ~/Test.jl:2
 [2] include(fname::String)
   @ Base.MainInclude ./client.jl:444
 [3] top-level scope
   @ REPL[1]:1
in expression starting at /home/vchuravy/Test.jl:1

Two issues:

  1. The line-number is the outer module not the inner module
  2. I believe that begin...end should be neutral here and we are still in top-level

If we move the inner module into it's own file. Inner.jl and include it instead this works without issue,
Encountered while parsing and re-evaluating some test-code

cc: @gbaraldi

@vchuravy vchuravy added the parser Language parsing and surface syntax label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

1 participant