Skip to content

Error in functor definition with where clause and newlines #58060

Open
@AntonReinhard

Description

@AntonReinhard

When defining a functor in julia version 1.12, I get an error (depending on the formatting), while 1.11 and 1.10 work fine. MWE:

julia> function (
           a::Tuple{A}
       )() where {A<:Int64} end
ERROR: UndefVarError: `A` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

Putting it in one line works like normal, even with spaces. Just the newlines seem to break it.

julia> function (a::Tuple{A})() where {A<:Int64} end

julia> function ( a::Tuple{A} )() where {A<:Int64} end

1.12 versioninfo():

julia> versioninfo()
Julia Version 1.12.0-beta1
Commit c175ace780d (2025-04-02 11:19 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 24 × AMD Ryzen 9 7900X3D 12-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver4)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 24 virtual cores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    parserLanguage parsing and surface syntaxregressionRegression in behavior compared to a previous versionregression 1.12Regression in the 1.12 release

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions