Skip to content

missing argument in call expression has bad recovery #15683

Closed
@Veykril

Description

fn main() {
	call(a, , b);
}

results in

FN@0..28
  FN_KW@0..2 "fn"
  WHITESPACE@2..3 " "
  NAME@3..7
    IDENT@3..7 "main"
  PARAM_LIST@7..9
    L_PAREN@7..8 "("
    R_PAREN@8..9 ")"
  WHITESPACE@9..10 " "
  BLOCK_EXPR@10..28
    STMT_LIST@10..28
      L_CURLY@10..11 "{"
      WHITESPACE@11..13 "\n\t"
      EXPR_STMT@13..22
        CALL_EXPR@13..22
          PATH_EXPR@13..17
            PATH@13..17
              PATH_SEGMENT@13..17
                NAME_REF@13..17
                  IDENT@13..17 "call"
          ARG_LIST@17..22
            L_PAREN@17..18 "("
            PATH_EXPR@18..19
              PATH@18..19
                PATH_SEGMENT@18..19
                  NAME_REF@18..19
                    IDENT@18..19 "a"
            COMMA@19..20 ","
            WHITESPACE@20..21 " "
            ERROR@21..22
              COMMA@21..22 ","
      WHITESPACE@22..23 " "
      EXPR_STMT@23..24
        PATH_EXPR@23..24
          PATH@23..24
            PATH_SEGMENT@23..24
              NAME_REF@23..24
                IDENT@23..24 "b"
      ERROR@24..25
        R_PAREN@24..25 ")"
      SEMICOLON@25..26 ";"
      WHITESPACE@26..27 "\n"
      R_CURLY@27..28 "}"

though ideally it should result in

FN@0..28
  FN_KW@0..2 "fn"
  WHITESPACE@2..3 " "
  NAME@3..7
    IDENT@3..7 "main"
  PARAM_LIST@7..9
    L_PAREN@7..8 "("
    R_PAREN@8..9 ")"
  WHITESPACE@9..10 " "
  BLOCK_EXPR@10..28
    STMT_LIST@10..28
      L_CURLY@10..11 "{"
      WHITESPACE@11..13 "\n\t"
      EXPR_STMT@13..26
        CALL_EXPR@13..25
          PATH_EXPR@13..17
            PATH@13..17
              PATH_SEGMENT@13..17
                NAME_REF@13..17
                  IDENT@13..17 "call"
          ARG_LIST@17..25
            L_PAREN@17..18 "("
            PATH_EXPR@18..19
              PATH@18..19
                PATH_SEGMENT@18..19
                  NAME_REF@18..19
                    IDENT@18..19 "a"
            COMMA@19..20 ","
            WHITESPACE@20..21 "   "
            COMMA@19..20 ","
            WHITESPACE@22..23 "   "
            PATH_EXPR@23..24
              PATH@23..24
                PATH_SEGMENT@23..24
                  NAME_REF@23..24
                    IDENT@23..24 "b"
            R_PAREN@24..25 ")"
        SEMICOLON@25..26 ";"
      WHITESPACE@26..27 "\n"
      R_CURLY@27..28 "}"
diff --git a/current.rast b/ideal.rast
index 09652b246..ca330d497 100644
--- a/current.rast
+++ b/ideal.rast
@@ -11,14 +11,14 @@ FN@0..28
     STMT_LIST@10..28
       L_CURLY@10..11 "{"
       WHITESPACE@11..13 "\n\t"
-      EXPR_STMT@13..22
-        CALL_EXPR@13..22
+      EXPR_STMT@13..26
+        CALL_EXPR@13..25
           PATH_EXPR@13..17
             PATH@13..17
               PATH_SEGMENT@13..17
                 NAME_REF@13..17
                   IDENT@13..17 "call"
-          ARG_LIST@17..22
+          ARG_LIST@17..25
             L_PAREN@17..18 "("
             PATH_EXPR@18..19
               PATH@18..19
@@ -26,18 +26,15 @@ FN@0..28
                   NAME_REF@18..19
                     IDENT@18..19 "a"
             COMMA@19..20 ","
-            WHITESPACE@20..21 " "
-            ERROR@21..22
-              COMMA@21..22 ","
-      WHITESPACE@22..23 " "
-      EXPR_STMT@23..24
-        PATH_EXPR@23..24
-          PATH@23..24
-            PATH_SEGMENT@23..24
-              NAME_REF@23..24
-                IDENT@23..24 "b"
-      ERROR@24..25
-        R_PAREN@24..25 ")"
-      SEMICOLON@25..26 ";"
+            WHITESPACE@20..21 "   "
+            COMMA@19..20 ","
+            WHITESPACE@22..23 "   "
+            PATH_EXPR@23..24
+              PATH@23..24
+                PATH_SEGMENT@23..24
+                  NAME_REF@23..24
+                    IDENT@23..24 "b"
+            R_PAREN@24..25 ")"
+        SEMICOLON@25..26 ";"
       WHITESPACE@26..27 "\n"
       R_CURLY@27..28 "}"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions