apex icon indicating copy to clipboard operation
apex copied to clipboard

AST confused for records

Open al2o3cr opened this issue 6 years ago • 0 comments

Passing Elixir AST (for instance, the output of quote) triggers the "Elixir record" behavior here.

Example:

iex(3)> ast = quote do
...(3)>   foo[1].bar
...(3)> end
{{:., [], [{{:., [], [Access, :get]}, [], [{:foo, [], Elixir}, 1]}, :bar]}, [],
 []}
iex(4)> Apex.ap(ast)
{
  [0] .{
    [0] []
    [1] [
      [0] {
        [0] .{
          [0] []
          [1] [
            [0] :Elixir.Access
            [1] :get
          ]
        }
        [1] []
        [2] [
          [0] foo{
            [0] []
            [1] :Elixir
          }
          [1] 1
        ]
      }
      [1] :bar
    ]
  }
  [1] []
  [2] []
}

Would a "no srsly I don't have records here" option make sense? Something like the numbers: false setting.

al2o3cr avatar Aug 25 '18 20:08 al2o3cr