nushell / nushell/tree-sitter-nu

Bare `return` statement in match arm does not parse

Open
#240 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Nushell
Stars
180
Forks
38
Avg merge
12m
Merged PRs (30d)
1

Description

Seems that a return statement in a match arm (which nushell proper is fine with), is treated as invalid grammar

match ($val | describe) {
   "path" | "string" =>  {}
   _ => return
}
[2025-12-13T20:39:11Z ERROR topiary::error]   × Parsing error between line 0, column 25 and line 3, column 0
       ╭─[standard input:1:26]
     1 │ ╭─▶ match ($val | describe) {
     2 │ │      "path" | "string" =>  {}
     3 │ │      _ => return
     4 │ ├─▶ }
       · ╰──── (ERROR) node
       ╰────
    

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the parsing error with the provided Nushell match-arm example, then inspect the tree-sitter-nu grammar rules handling match arms and return statements. Done means the bare return arm parses successfully without regressing the existing match syntax.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.