Skip to content

parsing failure for multi-line macro calls and + #20258

Closed
@stevengj

Description

@stevengj

Normally, if you type an incomplete binary expression like 1 + 1 +, then the parser automatically looks to the next line to complete the expression. However, this doesn't happen in macro calls (in both Julia 0.5 and 0.6):

julia> 1 + 1 +
       1
3

julia> Base.Test.@test 1 + 1 +
ERROR: MethodError: no method matching @test(::Expr, ::Symbol)
Closest candidates are:
  @test(::ANY) at test.jl:189

It seems to be related to the fact that + is both a binary and a unary operator, since it works fine for *, and hence I think it is a bug:

julia> Base.Test.@test 1 * 1 *
       1 == 1
Test Passed
  Expression: 1 * 1 * 1 == 1
   Evaluated: 1 == 1

(I got bitten by this in #20249 when .+ became a unary+binary operator.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorparserLanguage parsing and surface syntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions