Skip to content

When field expression is on a new line the . is marked as a number #23

Closed
@ckipp01

Description

@ckipp01

Alright, given the following snippet, the . will actually be marked as a number.

val myList = List(1, 2, 3)

myList
	.map(_ * 2) // <- . here is marked as a number

A corpus for this bug would look like this:

===============================
Chained expressions 
===============================

def main() {
  val myList = List(1, 2, 3)

  myList.map(_ * 2)

  myList
    .map(_ * 2)
}

---

(compilation_unit
  (function_definition
    (identifier)
    (parameters)
    (block
      (val_definition (identifier) (call_expression
        (identifier)
        (arguments (number) (number) (number))))
      (call_expression
        (field_expression (identifier) (identifier))
        (arguments (infix_expression
          (identifier) (operator_identifier) (number))))
      (call_expression
        (field_expression (identifier) (identifier))
        (arguments (infix_expression
          (identifier) (operator_identifier) (number)))))))

You can see what it actually does here:

Screenshot 2021-03-24 at 21 00 27

I think this is actually a automatic semi insertion issue where we don't account that the .call can be on a new line.

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