Skip to content

IndexOutOfBounds in SourceFile.scala contents() #14795

Closed
@Xavientois

Description

@Xavientois

Given a SourcePosition pos where pos.exists and pos.source.exists, I would expect that it is safe to call startColumnPadding on pos. This is not always the case, as can be seen when building the community lib Lucre here.

This exception issue occurs at startColumnPadding in SourceFile.scala, when content() is empty, but length is non-zero.

It seems content().length != length happens when length is computed from Tasty using setLineIndicesFromLineSizes instead of using calculateLineIndicesFromContents.

Originally posted by @olhotak in #14683 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions