-
Notifications
You must be signed in to change notification settings - Fork 102
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
compilation failures on tests in Scala 2.13 community build #97
Comments
I can reproduce locally:
|
I've partially minimized --- /tmp/okay 2018-01-25 13:06:10.000000000 +1000
+++ /tmp/broke 2018-01-25 13:06:26.000000000 +1000
@@ -1,48 +1,58 @@
package scala.compat.java8
import java.util.stream._
import StreamConverters._
class Test {
- x
y
+ x
def x = EnrichAnySteppableWithSeqStream(Vector[Int](1, 2, 3)).seqStream: IntStream
def y = EnrichAnySteppableWithSeqStream(Array[String]("a", "b")).seqStream: Stream[String]
}
/Users/jz/code/scala-java8-compat/src/test/scala/scala/compat/java8/StreamConvertersTest.scala:10: $conforms is not a valid implicit value for scala.collection.immutable.Vector[Int] => scala.compat.java8.converterImpl.MakesStepper[A,Any] because:
-hasMatchingSymbol reported error: type mismatch;
- found : scala.collection.immutable.Vector[Int] <:< scala.collection.immutable.Vector[Int]
- required: scala.collection.immutable.Vector[Int] => scala.compat.java8.converterImpl.MakesStepper[?,Any]
- def x = EnrichAnySteppableWithSeqStream(Vector[Int](1, 2, 3)).seqStream: IntStream
- ^
-/Users/jz/code/scala-java8-compat/src/test/scala/scala/compat/java8/StreamConvertersTest.scala:11: materializing requested scala.reflect.type.ClassTag[String] using scala.reflect.`package`.materializeClassTag[String]()
/Users/jz/code/scala-java8-compat/src/test/scala/scala/compat/java8/StreamConvertersTest.scala:11: materializing requested scala.reflect.type.ClassTag[String] using scala.reflect.`package`.materializeClassTag[String]()
def y = EnrichAnySteppableWithSeqStream(Array[String]("a", "b")).seqStream: Stream[String]
^
/Users/jz/code/scala-java8-compat/src/test/scala/scala/compat/java8/StreamConvertersTest.scala:11: $conforms is not a valid implicit value for Array[String] => scala.compat.java8.converterImpl.MakesStepper[A,Any] because:
hasMatchingSymbol reported error: type mismatch;
found : Array[String] <:< Array[String]
required: Array[String] => scala.compat.java8.converterImpl.MakesStepper[?,Any]
def y = EnrichAnySteppableWithSeqStream(Array[String]("a", "b")).seqStream: Stream[String]
^
+/Users/jz/code/scala-java8-compat/src/test/scala/scala/compat/java8/StreamConvertersTest.scala:10: $conforms is not a valid implicit value for scala.collection.immutable.Vector[Int] => scala.compat.java8.converterImpl.MakesStepper[A,Any] because:
+hasMatchingSymbol reported error: type mismatch;
+ found : scala.collection.immutable.Vector[Int] <:< scala.collection.immutable.Vector[Int]
+ required: scala.collection.immutable.Vector[Int] => scala.compat.java8.converterImpl.MakesStepper[?,Any]
+ def x = EnrichAnySteppableWithSeqStream(Vector[Int](1, 2, 3)).seqStream: IntStream
+ ^
+/Users/jz/code/scala-java8-compat/src/test/scala/scala/compat/java8/StreamConvertersTest.scala:10: java8.this.StreamShape.IntValue is not a valid implicit value for scala.compat.java8.StreamShape[Int,S] because:
+type parameters weren't correctly instantiated outside of the implicit tree: inferred type arguments [java.util.stream.IntStream] do not conform to method EnrichAnySteppableWithSeqStream's type parameter bounds [S <: java.util.stream.BaseStream[_, java.util.stream.Stream[Int]]]
+ def x = EnrichAnySteppableWithSeqStream(Vector[Int](1, 2, 3)).seqStream: IntStream
+ ^
+/Users/jz/code/scala-java8-compat/src/test/scala/scala/compat/java8/StreamConvertersTest.scala:10: error: type mismatch;
+ found : java.util.stream.Stream[Int]
+ required: java.util.stream.IntStream
+ def x = EnrichAnySteppableWithSeqStream(Vector[Int](1, 2, 3)).seqStream: IntStream
+ ^
[[syntax trees at end of typer]] // StreamConvertersTest.scala
package scala.compat.java8 {
import java.util.stream._;
import StreamConverters._;
class Test extends scala.AnyRef {
def <init>(): scala.compat.java8.Test = {
Test.super.<init>();
()
};
- Test.this.x;
Test.this.y;
- def x: java.util.stream.IntStream = (StreamConverters.EnrichAnySteppableWithSeqStream[Int, java.util.stream.IntStream, scala.collection.immutable.Vector[Int]](scala.`package`.Vector.apply[Int](1, 2, 3))({
+ Test.this.x;
+ def x: java.util.stream.IntStream = (StreamConverters.EnrichAnySteppableWithSeqStream[Int, java.util.stream.Stream[Int], scala.collection.immutable.Vector[Int]](scala.`package`.Vector.apply[Int](1, 2, 3))({
((underlying: Vector[Int]) => StreamConverters.richVectorCanStep[Int](underlying))
-}, java8.this.StreamShape.IntValue).seqStream: java.util.stream.IntStream);
+}, java8.this.StreamShape.anyStreamShape[Int]).<seqStream: error>: java.util.stream.IntStream);
def y: java.util.stream.Stream[String] = (StreamConverters.EnrichAnySteppableWithSeqStream[String, java.util.stream.Stream[String], Array[String]](scala.Array.apply[String]("a", "b")((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))({
((underlying: Array[String]) => StreamConverters.richArrayCanStep[String](underlying))
}, java8.this.StreamShape.anyStreamShape[String]).seqStream: java.util.stream.Stream[String])
}
}
+one error found |
Standalone: package scala.compat.java8
trait BaseStream[T, S <: BaseStream[T, S]]
trait Stream[T] extends BaseStream[T, Stream[T]]
trait IntStream extends BaseStream[Integer, IntStream]
sealed trait SS[T, S <: BaseStream[_, S]]
object SSImplicits extends Low {
implicit val IntValue: SS[Int, IntStream] = null
}
trait Low {
implicit def anyStreamShape[T]: SS[T, Stream[T]] = null
}
import SSImplicits.{IntValue, anyStreamShape}
class Test {
implicit def f[A, S <: BaseStream[_, S], CC](a: A)(implicit ss: SS[A, S]): S = ???
// switch these lines and typechecking the body of `def x` fails in 2.13.x
x
y
def x = f(0): IntStream
def y = f[String, Stream[String], Vector[String]]("")
} |
Regressed in scala/scala#6140 |
The bounds propagation introduced in scala#6140 caused a regression in scala/scala-java8-compat#97 because bounds sharpened while ranking implicit candidates leaked from candidates tested earlier to those tested later. This commit fixes that by saving and restoring the infos of the symbols of the undetermined type parameters around the call to type check the implicit candidate which tests for it's applicability. Initially it seemed like this ought to be a job for undoLog or Context#savingUndeteriminedTypeParams, but neither of those do the right thing here. UndoLog doesn't help because it affects the constraint on the corresponding TypeVar rather than the info of the symbol; and savingUndeterminedTypeParams doesn't help because the relevant call to typedImplicit shares the enclosing ImplicitSearch#undetParams rather than looking at the context.
Hopefully fixed in scala/scala#6308. |
for version 0.9.0, I will drop 2.13.0-M3 from the cross-build. once M4 is out (and genjavadoc has been published for it), we should re-add it. |
the issue seems to be fixed in M5. as for the cross-build, for now we're on a separate 2.13.x branch, #113 is about eventually merging that branch |
from https://scala-ci.typesafe.com/view/scala-2.13.x/job/scala-2.13.x-integrate-community-build/905/consoleFull :
The text was updated successfully, but these errors were encountered: