Skip to content

No end of expression on grouped stab #13358

Closed
@mhanberg

Description

@mhanberg

Elixir and Erlang/OTP versions

Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [jit:ns]

Elixir 1.17.0-dev (compiled with Erlang/OTP 26)

[tools]
erlang = "26.2.1"
elixir = "ref:514615d0347cb9bb513faa44ae1e36406979e516"

Operating system

Linux

Current behavior

The following code produces the following AST

a do
  d ->
    (b -> c)
end
{
  :a,
  [
    end_of_expression: [newlines: 1, line: 4, column: 4],
    do: [line: 1, column: 3],
    end: [line: 4, column: 1],
    line: 1,
    column: 1
  ],
  [
    [
      do: [
        {:->, [newlines: 1, line: 2, column: 5],
         [
           [{:d, [line: 2, column: 3], nil}],
           [{:->, [line: 3, column: 8], [[{:b, [line: 3, column: 6], nil}], {:c, [line: 3, column: 11], nil}]}]
         ]}
      ]
    ]
  ]
}

Expected behavior

Should the grouped stab expression (b -> c) have end_of_expression data?

This is a weird case, in that its its more like a child expression and less like prongs of a do block.

But, if you were to have this code in a type spec, I'm not what I would expect to happen.

Also, I'll admit while this is valid syntax, its not valid code outside of a macro, I don't think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions