Skip to content

Commit 8165f99

Browse files
author
Markus Sutter
committed
Add person readable toString for PositionBridge
There are compile call paths relying on meaningful toString impl. for error/warning log messages. Therefor lets add toString, which is: "concise but informative representation that is easy for a person to read." Without this, e.g. users of https://github.com/davidB/scala-maven-plugin get unsuitable compile problems like: [Warn] dotty.tools.xsbt.PositionBridge@4fbdc20: match may not be exhaustive.... Example call path: log:45, SbtLogger (sbt_inc) log:47, Logger (sbt.util) warn:43, Logger (sbt.util) logWarning:159, LoggedReporter (sbt.internal.inc) display:168, LoggedReporter (sbt.internal.inc) log:142, LoggedReporter (sbt.internal.inc) doReport:43, DelegatingReporter (dotty.tools.xsbt) report:150, Reporter (dotty.tools.dotc.reporting) issueWarning:32, report$ (dotty.tools.dotc) warning:67, report$ (dotty.tools.dotc) checkExhaustivity:847, SpaceEngine (dotty.tools.dotc.transform.patmat) ....
1 parent 45bf7c4 commit 8165f99

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sbt-bridge/src/dotty/tools/xsbt/PositionBridge.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public Optional<Integer> pointer() {
3939
public Optional<String> pointerSpace() {
4040
return Optional.empty();
4141
}
42+
43+
public String toString() {
44+
return "";
45+
}
4246
};
4347

4448
public PositionBridge(SourcePosition pos, SourceFile src) {
@@ -116,4 +120,9 @@ public Optional<String> pointerSpace() {
116120
result.append(lineContent.charAt(i) == '\t' ? '\t' : ' ');
117121
return Optional.of(result.toString());
118122
}
123+
124+
@Override
125+
public String toString() {
126+
return pos.toString();
127+
}
119128
}

0 commit comments

Comments
 (0)