Skip to content

Commit

Permalink
Merge pull request #12845 from dotty-staging/backport-bridge-pos
Browse files Browse the repository at this point in the history
[backport] sbt bridge reporting improvements
  • Loading branch information
smarter authored Jun 16, 2021
2 parents 13942b0 + 3815651 commit c45fce3
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 17 deletions.
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.

0 comments on commit c45fce3

Please sign in to comment.