Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] sbt bridge reporting improvements #12845

Merged
merged 3 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions sbt-bridge/src/dotty/tools/xsbt/PositionBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public Optional<Integer> pointer() {
public Optional<String> pointerSpace() {
return Optional.empty();
}

public String toString() {
return "";
}
};

public PositionBridge(SourcePosition pos, SourceFile src) {
Expand Down Expand Up @@ -116,4 +120,58 @@ public Optional<String> pointerSpace() {
result.append(lineContent.charAt(i) == '\t' ? '\t' : ' ');
return Optional.of(result.toString());
}

@Override
public String toString() {
return pos.toString();
}

@Override
public Optional<Integer> startOffset() {
if (src.content().length == 0)
return Optional.empty();
else
return Optional.of(pos.start());
}

@Override
public Optional<Integer> endOffset() {
if (src.content().length == 0)
return Optional.empty();
else
return Optional.of(pos.end());
}

@Override
public Optional<Integer> startLine() {
if (src.content().length == 0)
return Optional.empty();
else
return Optional.of(pos.startLine() + 1);
}

@Override
public Optional<Integer> endLine() {
if (src.content().length == 0)
return Optional.empty();
else
return Optional.of(pos.endLine() + 1);
}

@Override
public Optional<Integer> startColumn() {
if (src.content().length == 0)
return Optional.empty();
else
return Optional.of(pos.startColumn());
}

@Override
public Optional<Integer> endColumn() {
if (src.content().length == 0)
return Optional.empty();
else
return Optional.of(pos.endColumn());
}

}
17 changes: 0 additions & 17 deletions tests/neg/i12640.scala

This file was deleted.