diff --git a/sbt-bridge/src/dotty/tools/xsbt/PositionBridge.java b/sbt-bridge/src/dotty/tools/xsbt/PositionBridge.java index 2f20609578db..075efd5b53e6 100644 --- a/sbt-bridge/src/dotty/tools/xsbt/PositionBridge.java +++ b/sbt-bridge/src/dotty/tools/xsbt/PositionBridge.java @@ -39,6 +39,10 @@ public Optional pointer() { public Optional pointerSpace() { return Optional.empty(); } + + public String toString() { + return ""; + } }; public PositionBridge(SourcePosition pos, SourceFile src) { @@ -116,4 +120,58 @@ public Optional pointerSpace() { result.append(lineContent.charAt(i) == '\t' ? '\t' : ' '); return Optional.of(result.toString()); } + + @Override + public String toString() { + return pos.toString(); + } + + @Override + public Optional startOffset() { + if (src.content().length == 0) + return Optional.empty(); + else + return Optional.of(pos.start()); + } + + @Override + public Optional endOffset() { + if (src.content().length == 0) + return Optional.empty(); + else + return Optional.of(pos.end()); + } + + @Override + public Optional startLine() { + if (src.content().length == 0) + return Optional.empty(); + else + return Optional.of(pos.startLine() + 1); + } + + @Override + public Optional endLine() { + if (src.content().length == 0) + return Optional.empty(); + else + return Optional.of(pos.endLine() + 1); + } + + @Override + public Optional startColumn() { + if (src.content().length == 0) + return Optional.empty(); + else + return Optional.of(pos.startColumn()); + } + + @Override + public Optional endColumn() { + if (src.content().length == 0) + return Optional.empty(); + else + return Optional.of(pos.endColumn()); + } + } diff --git a/tests/neg/i12640.scala b/tests/neg/i12640.scala deleted file mode 100644 index 7946525deeeb..000000000000 --- a/tests/neg/i12640.scala +++ /dev/null @@ -1,17 +0,0 @@ -package x - -trait CpsMonad[F[_]]: - def pure[A](x:A): F[A] - def flatMap[A,B](fa:F[A])(f: A=>F[B]): F[B] - -abstract sealed class CpsStream[-F[_],+T] - -case class Cons[F[_],T](head:T, tailFun: ()=>F[CpsStream[F,T]]) extends CpsStream[F,T] - -case class Empty[F[_]]() extends CpsStream[F,Nothing] - -def unfold[S,F[_]:CpsMonad,T](s0:S)(f:S => F[Option[(S,T)]]):F[CpsStream[F,T]] = - summon[CpsMonad[F]].flatMap(f(s0)){ - case Some(s1,a) => Cons(a, () => unfold(s1,f)) // error // error - case None => summon[CpsMonad[F]].pure(Empty[F]()) - } \ No newline at end of file