Skip to content

fix(LSP): don't crash on broken function definition#9441

Merged
TomAFrench merged 2 commits intomasterfrom
ab/parser-end-token-location
Aug 11, 2025
Merged

fix(LSP): don't crash on broken function definition#9441
TomAFrench merged 2 commits intomasterfrom
ab/parser-end-token-location

Conversation

@asterite
Copy link
Copy Markdown
Collaborator

@asterite asterite commented Aug 8, 2025

Description

Problem

No issue, just something I noticed while writing some Noir code.

Summary

LSP crashed on the documentSymbol request on code like "fn foo(", that is, a function with an unclosed parentheses.

The issue was that the function body ended up having the location since "(" until the end, but the end token always had a dummy location of zero. This PR changes that location to be the actual end of the file. This might solve many LSP issues with broken code where a node's location end up having part of its location computed from the end token location.

Additional Context

Documentation

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@asterite asterite requested a review from a team August 8, 2025 16:24
@TomAFrench TomAFrench added this pull request to the merge queue Aug 11, 2025
Merged via the queue into master with commit e54057d Aug 11, 2025
122 checks passed
@TomAFrench TomAFrench deleted the ab/parser-end-token-location branch August 11, 2025 15:31
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 12, 2025
Automated pull of nightly from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix(LSP): don't crash on broken function definition
(noir-lang/noir#9441)
feat(opt): Don't clone on array_len
(noir-lang/noir#9440)
feat(ssa_fuzzer): mode without instruction simplification + array
instructions mutations + limits fix
(noir-lang/noir#9438)
feat(fuzz): Push and pop for slices
(noir-lang/noir#9262)
fix(brillig_vm): Remove slice padding for foreign call inputs
(noir-lang/noir#9321)
fix: allow calling private impl method defined on another module from…
(noir-lang/noir#9449)
fix: guard `Eq` for `[T]` to avoid OOB on length mismatch
(noir-lang/noir#9453)
chore: bump external pinned commits
(noir-lang/noir#9454)
END_COMMIT_OVERRIDE

Co-authored-by: AztecBot <tech@aztecprotocol.com>
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

Successfully merging this pull request may close these issues.

2 participants