Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

wgsl-in: Fix bad span in assignment lhs error #2054

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

JCapucho
Copy link
Collaborator

The wgsl frontend was emiting errors for lhs expressions on assignments that weren't references using a span that didn't skip blankspaces causing the span to look weird (like starting at the end of the previous line)

This is fixed by consuming the blankspace before constructing the span

Related to #2053

@JCapucho JCapucho requested a review from jimblandy September 10, 2022 21:06
The wgsl frontend was emiting errors for lhs expressions on assignments
that weren't references using a span that didn't skip blankspaces
causing the span to look weird (like starting at the end of the previous
line)

This is fixed by consuming the blankspace before constructing the span
Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

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

This is fine for now. I'll put my concerns in a separate comment.

@jimblandy jimblandy merged commit 1a99c1c into gfx-rs:master Sep 12, 2022
@jimblandy
Copy link
Member

I hope we can find a more general solution to this, because these spans are misplaced everywhere. Basically, everyplace that calls Lexer::current_byte_offset is either trying to find the start or the end of something, and whenever it's looking for the start of something it's probably wrong.

@JCapucho JCapucho deleted the wgsl-lhs-span branch February 3, 2023 14:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants