apollo-rs
apollo-rs copied to clipboard
Many lexer errors do not have a location
Description
Many errors emitted by the lexer do not set the error.index
property, so they point to the start of the document by default.
Steps to reproduce
Input a GraphQL document with unexpected characters:
type Query {
// Some invalid characters
user: User
}
Expected result
Syntax errors point to the correct position
Actual result
rror: syntax error: Unexpected character "/"
╭─[q.graphql:1:1]
│
1 │ type Query {
│ ┬
│ ╰── Unexpected character "/"
───╯
Error: syntax error: Unexpected character "/"
╭─[q.graphql:1:1]
│
1 │ type Query {
│ ┬
│ ╰── Unexpected character "/"
───╯