rust-analyzer / rowan

Apache License 2.0
697 stars 57 forks source link

Maybe a mistake fix #52

Closed Veetaha closed 4 years ago

Veetaha commented 4 years ago

?

CAD97 commented 4 years ago

I don't think this is wrong. When we receive an offset equivalent to the length of the selected span, the correct token to say is present there is None, as is handled for the empty span case directly below the assert.

An actual example (other than an empty span) that passes the assert on master and is caught by this patch would help in determining the correct/expected behavior here.

Veetaha commented 4 years ago

Oh, I just read the precondition comment and saw the assertion that kinda conflicts with it...

matklad commented 4 years ago

Yep, text offset can point right at the end of the node/file, it can be equal to the length of the thing.