Skip to content

Add location to error messages - #941

Merged
hugo-vrijswijk merged 1 commit into
mainfrom
fix/field-error-locations
Sep 11, 2026
Merged

Add location to error messages#941
hugo-vrijswijk merged 1 commit into
mainfrom
fix/field-error-locations

Conversation

@hugo-vrijswijk

Copy link
Copy Markdown
Contributor

Adds a location field Ast.Selection.Field to hold the line and column of the selection. That can then be used to add a locations field to error messages.

Most changes are in tests with added location information to the error messages. The other option would be to strip location information from the expected error messages, but that would make it harder to verify that the location information is actually present.

Fixes 2 conformance tests.

location: Option[(Int, Int)] = None
)
case class Select(name: String, alias: Option[String], child: Query)
case class Select(name: String, alias: Option[String], child: Query, location: Option[(Int, Int)] = None)

@hugo-vrijswijk hugo-vrijswijk Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is also a source-breaking change for any users that pattern-match on Select(n, a, c), but I don't know if there is a way around

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not too concerned about this: SelectElatorator should protect most uses from this.

Adds a `location` field `Ast.Selection.Field` to hold the line and column of the selection. That can then be used to add a `locations` field to error messages.

Most changes are in tests with added `location` information to the error messages. The other option would be to strip location information from the expected error messages, but that would make it harder to verify that the location information is actually present.

Fixes 2 conformance tests.
@hugo-vrijswijk
hugo-vrijswijk force-pushed the fix/field-error-locations branch from 4f6bd0a to eea26c9 Compare September 8, 2026 21:04

@milessabin milessabin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@hugo-vrijswijk
hugo-vrijswijk merged commit 1d83e32 into main Sep 11, 2026
23 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.

2 participants