Skip to content

Meta.parse changed trailing newline behavior with julia 1.12Β #59935

@lgoettgens

Description

@lgoettgens

Consider the following example:

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.7 (2025-09-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> Meta.parse("x=1\n\n")
:(x = 1)
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.12.1 (2025-10-17)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org release
|__/                   |

julia> Meta.parse("\n\n")

julia> Meta.parse("x=1\n\n")
ERROR: ParseError("extra token after end of expression")
Stacktrace:
 [1] parse(str::String; filename::String, raise::Bool, depwarn::Bool)
   @ Base.Meta ./meta.jl:283
 [2] parse(str::String)
   @ Base.Meta ./meta.jl:276
 [3] top-level scope
   @ REPL[1]:1

In julia 1.11.x and earlier, this parsed just fine, but starting with julia 1.12 (and also on a current nightly) this throws a ParseError.

This came up yesterday in the regression CI of Documenter.jl in JuliaDocs/Documenter.jl#2777.

cc @fingolfin

Metadata

Metadata

Assignees

No one assigned

    Labels

    parserLanguage parsing and surface syntaxregression 1.12Regression in the 1.12 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions