Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise correct error with invalid pattern matching conditionals #303

Open
st0012 opened this issue Oct 24, 2024 · 0 comments
Open

Raise correct error with invalid pattern matching conditionals #303

st0012 opened this issue Oct 24, 2024 · 0 comments

Comments

@st0012
Copy link
Member

st0012 commented Oct 24, 2024

We need to generate this error in a way that matches Sorbet's parser:

  case quux
# ^^^^ error: unexpected token "case"
  in x if 1, 2
  end

Currently it's translated into this without error:

CaseMatch {
  expr = Send {
    receiver = NULL
    method = <U quux>
    args = [
    ]
  }
  inBodies = [
    InPattern {
      pattern = MatchVar {
        name = <U x>
      }
      guard = IfGuard {
        condition = Integer {
          val = "1"
        }
      }
      body = Begin {
        stmts = [
          String {
            val = <U Unimplemented node type PM_MISSING_NODE (#103).>
          }
          Integer {
            val = "2"
          }
        ]
      }
    }
   ]
  elseBody = NULL
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant