Skip to content

Add getters for Span and improve error handling - #146

Merged
apoelstra merged 3 commits into
BlockstreamResearch:masterfrom
distributed-lab:master
Sep 26, 2025
Merged

Add getters for Span and improve error handling#146
apoelstra merged 3 commits into
BlockstreamResearch:masterfrom
distributed-lab:master

Conversation

@gerau

@gerau gerau commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

Description

This pull request introduces getter methods for Span in Parse and AST nodes, and adds getters for RichError fields. These changes make span and error information more accessible, simplifying the development of tools for SimplicityHL.

Impact

  • Supports easier integration with developer tooling (e.g., LSP, analyzers).
  • No breaking changes introduced.

@uncomputable

Copy link
Copy Markdown
Collaborator

The added functionality seems to be used nowhere

@gerau

gerau commented Sep 25, 2025

Copy link
Copy Markdown
Contributor Author

Sorry for not explaining the motivation for these changes earlier.
We are working on building a language server for SimplicityHL on top of the original compiler.

For basic diagnostics, we need access to error information (RichError) in order to report error from compiler to text editor. Currently, since all RichError fields are private, the only available option is to extract the error as a string. We already have a basic diagnostics implementation, but it depends on our fork.

Similarly, for parser and AST nodes, we need access to the location (Span) of elements to implement features like goToDefinition. At the moment, this is not possible because the relevant data is inaccessible.

Since adding getters for these fields does not introduce any breaking changes, it would be very helpful if this functionality could be added.

@apoelstra apoelstra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK f00714d; successfully ran local tests

@apoelstra
apoelstra merged commit e68e1c6 into BlockstreamResearch:master Sep 26, 2025
9 checks passed
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.

3 participants