You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compilation fails (both in bloop and sbt) with
diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbContainer2 in traitArbitraryLowPriority
but if the file containing the problematic line is successfully compiled (e.g. by commenting and uncommenting the line again), it works.
This happens on 2.12.12 but not on 2.13.0, 2.13.3 or 2.13.4 - I thought it could've been resolved by one of the issues making scala/scala-dev#405, but scala/scala#7203 (backporting them to 2.12) didn't seem to alleviate the issue.
External libraries are involved in the reproduction (both use macros, as one is shapeless and the other one interacts with magnolia) - I wasn't able to reproduce the issue without them.
Output of `-Xlog-implicits` on a clean compile
[E] [E20] src/main/scala/demo/Demo.scala:13:22
[E] not enough arguments for method arbitrary: (implicita: org.scalacheck.Arbitrary[(Long, Long)])org.scalacheck.Gen[(Long, Long)].
[E] Unspecified value parameter a.
[E] L13:Arbitrary.arbitrary[(Long, Long)]
[E] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E] [E19] src/main/scala/demo/Demo.scala:13:22
[E] diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
[E] starting with method arbContainer2 in traitArbitraryLowPriority
[E] L13:Arbitrary.arbitrary[(Long, Long)]
[E] ^
[E18] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbContainer is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbContainer2 in traitArbitraryLowPriorityL13:Arbitrary.arbitrary[(Long, Long)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E17] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbEnum is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbContainer2 in traitArbitraryLowPriorityL13:Arbitrary.arbitrary[(Long, Long)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E16] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbTuple2 is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbContainer2 in traitArbitraryLowPriorityL13:Arbitrary.arbitrary[(Long, Long)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E15] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbContainer2 is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
hasMatchingSymbol reported error: diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbitrarySingleton in objectArbitrariesL13:Arbitrary.arbitrary[(Long, Long)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E14] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbContainer is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbitrarySingleton in objectArbitrariesL13:Arbitrary.arbitrary[(Long, Long)]
^
[E13] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbEnum is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbitrarySingleton in objectArbitrariesL13:Arbitrary.arbitrary[(Long, Long)]
^
[E12] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbTuple2 is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbitrarySingleton in objectArbitrariesL13:Arbitrary.arbitrary[(Long, Long)]
^
[E11] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbContainer2 is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
hasMatchingSymbol reported error: diverging implicit expansion fortypeorg.scalacheck.Arbitrary[(Long, Long)]
starting with method arbContainer2 in traitArbitraryLowPriorityL13:Arbitrary.arbitrary[(Long, Long)]
^
[E10] src/main/scala/demo/Demo.scala:13:22
arbitrarySingleton is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
hasMatchingSymbol reported error: could not find implicit value for evidence parameter of typeshapeless.Witness.Aux[(Long, Long)]
L13:Arbitrary.arbitrary[(Long, Long)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E9] src/main/scala/demo/Demo.scala:13:22
shapeless.this.Witness.apply is not a valid implicit value for shapeless.Witness.Aux[(Long, Long)] because:
hasMatchingSymbol reported error: Type argument (Long, Long) is not a singleton typeL13:Arbitrary.arbitrary[(Long, Long)]
^
[E8] src/main/scala/demo/Arbitraries.scala:17:19
scalacheck.this.Arbitrary.arbEnum is not a valid implicit value for org.scalacheck.Arbitrary[Map[K,V]] because:
typing TypeApply reported errors for the implicittree: typearguments [Map[K,V]] do not conform to method arbEnum'stypeparameter bounds [A<:Enum[A]]
L17:Gen.resultOf(???:T)
^^^^^^^^^^^^^^^^^^^^^
[E7] src/main/scala/demo/Arbitraries.scala:17:19
materializing requested scala.reflect.type.ClassTag[Map[K,V]] using scala.reflect.`package`.materializeClassTag[Map[K,V]]()
L17:Gen.resultOf(???:T)
^
[E6] src/main/scala/demo/Arbitraries.scala:17:19
arbitrarySingleton is not a valid implicit value for org.scalacheck.Arbitrary[Map[K,V]] because:
hasMatchingSymbol reported error: could not find implicit value for evidence parameter of typeshapeless.Witness.Aux[Map[K,V]]
L17:Gen.resultOf(???:T)
^^^^^^^^^^^^^^^^^^^^^
[E5] src/main/scala/demo/Arbitraries.scala:17:19
shapeless.this.Witness.apply is not a valid implicit value for shapeless.Witness.Aux[Map[K,V]] because:
hasMatchingSymbol reported error: Type argument scala.collection.immutable.Map[K,V] is not a singleton typeL17:Gen.resultOf(???:T)
^
[E4] src/main/scala/demo/Arbitraries.scala:17:19
apply is not a valid implicit value for org.scalacheck.Arbitrary[Map[K,V]] because:
hasMatchingSymbol reported error: magnolia: could not infer ArbitraryDerivation.TypeclassfortypeMap[K,V]
L17:Gen.resultOf(???:T)
^^^^^^^^^^^^^^^^^^^^^
[E3] src/main/scala/demo/Arbitraries.scala:17:19
materializing requested scala.reflect.type.ClassTag[Any] using scala.reflect.`package`.materializeClassTag[Any]()
L17:Gen.resultOf(???:T)
^
[E2] src/main/scala/demo/Arbitraries.scala:17:19
arbitrarySingleton is not a valid implicit value for org.scalacheck.Arbitrary[(K, V)] because:
hasMatchingSymbol reported error: could not find implicit value for evidence parameter of typeshapeless.Witness.Aux[(K, V)]
L17:Gen.resultOf(???:T)
^^^^^^^^^^^^^^^^^^^^^
[E1] src/main/scala/demo/Arbitraries.scala:17:19
shapeless.this.Witness.apply is not a valid implicit value for shapeless.Witness.Aux[(K, V)] because:
hasMatchingSymbol reported error: Type argument (K, V) is not a singleton typeL17:Gen.resultOf(???:T)
^
[E] src/main/scala/demo/Demo.scala:L13 [E9], L13 [E10], L13 [E11], L13 [E12], L13 [E13], L13 [E14], L13 [E15], L13 [E16], L13 [E17], L13 [E18], L13 [E19], L13 [E20]
[E] src/main/scala/demo/Arbitraries.scala:L17 [E1], L17 [E2], L17 [E3], L17 [E4], L17 [E5], L17 [E6], L17 [E7], L17 [E8]
Output of -Xlog-implicits when the line is being added back
[E8] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbEnum is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
typing TypeApply reported errors for the implicittree: typearguments [(Long, Long)] do not conform to method arbEnum'stypeparameter bounds [A<:Enum[A]]
L13:Arbitrary.arbitrary[(Long, Long)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E7] src/main/scala/demo/Demo.scala:13:22
materializing requested scala.reflect.type.ClassTag[(Long, Long)] using scala.reflect.`package`.materializeClassTag[(Long, Long)]()
L13:Arbitrary.arbitrary[(Long, Long)]
^
[E6] src/main/scala/demo/Demo.scala:13:22
scalacheck.this.Arbitrary.arbEnum is not a valid implicit value for org.scalacheck.Arbitrary[Long] because:
typing TypeApply reported errors for the implicittree: typearguments [Long] do not conform to method arbEnum'stypeparameter bounds [A<:Enum[A]]
L13:Arbitrary.arbitrary[(Long, Long)]
^
[E5] src/main/scala/demo/Demo.scala:13:22
materializing requested scala.reflect.type.ClassTag[Long] using scala.reflect.`package`.materializeClassTag[Long]()
L13:Arbitrary.arbitrary[(Long, Long)]
^
[E4] src/main/scala/demo/Demo.scala:13:22
arbitrarySingleton is not a valid implicit value for org.scalacheck.Arbitrary[Long] because:
hasMatchingSymbol reported error: could not find implicit value for evidence parameter of typeshapeless.Witness.Aux[Long]
L13:Arbitrary.arbitrary[(Long, Long)]
^
[E3] src/main/scala/demo/Demo.scala:13:22
shapeless.this.Witness.apply is not a valid implicit value for shapeless.Witness.Aux[Long] because:
hasMatchingSymbol reported error: Type argument Long is not a singleton typeL13:Arbitrary.arbitrary[(Long, Long)]
^
[E2] src/main/scala/demo/Demo.scala:13:22
arbitrarySingleton is not a valid implicit value for org.scalacheck.Arbitrary[(Long, Long)] because:
hasMatchingSymbol reported error: could not find implicit value for evidence parameter of typeshapeless.Witness.Aux[(Long, Long)]
L13:Arbitrary.arbitrary[(Long, Long)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E1] src/main/scala/demo/Demo.scala:13:22
shapeless.this.Witness.apply is not a valid implicit value for shapeless.Witness.Aux[(Long, Long)] because:
hasMatchingSymbol reported error: Type argument (Long, Long) is not a singleton typeL13:Arbitrary.arbitrary[(Long, Long)]
^
src/main/scala/demo/Demo.scala:L13 [E1], L13 [E2], L13 [E3], L13 [E4], L13 [E5], L13 [E6], L13 [E7], L13 [E8]
The text was updated successfully, but these errors were encountered:
dwijnand
changed the title
Implicits diverge on the first compilation but not in recompilation
[2.12] Implicits diverge on the first compilation but not in recompilation
Dec 23, 2020
We don't keep open tickets on 2.12-only bugs (this one slipped through the cracks).
Does that mean we wouldn't accept a 2.12-only PR with a fix? Well, we might... it would really depend on a risk/reward assessment depending on the nature of the fix.
reproduction steps
See repository and open Demo.scala for instructions.
problem
The compilation fails (both in bloop and sbt) with
but if the file containing the problematic line is successfully compiled (e.g. by commenting and uncommenting the line again), it works.
This happens on 2.12.12 but not on 2.13.0, 2.13.3 or 2.13.4 - I thought it could've been resolved by one of the issues making scala/scala-dev#405, but scala/scala#7203 (backporting them to 2.12) didn't seem to alleviate the issue.
External libraries are involved in the reproduction (both use macros, as one is shapeless and the other one interacts with magnolia) - I wasn't able to reproduce the issue without them.
Output of `-Xlog-implicits` on a clean compile
Output of -Xlog-implicits when the line is being added back
The text was updated successfully, but these errors were encountered: