Skip to content

Range check in Source#createSection is off by one (rejects good code) #184

Closed
@pniederw

Description

@pniederw
import com.oracle.truffle.api.source.Source;

// works as expected, prints:
// source=test pos=5 len=0 line=1 col=6 identifier=test code=
System.out.println(Source.fromText("12345", "test").createSection("test", 1, 6, 5, 0));

// fails unexpectedly with:
// java.lang.IllegalArgumentException: column out of range
// the "out of range" check seems to be off by 1
System.out.println(Source.fromText("12345", "test").createSection("test", 1, 6, 0));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions