This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val outer1: Outer[Any] = Outer.apply(in1) | |
// ❌ Found: (Playground.in1 : Playground.Inner[String]) | |
// Required: Playground.Inner[Any] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Inner[A](a: A) | |
case class Outer[A](a: Inner[A]) | |
val in1 = Inner("foo") | |
val in2 = Inner(3) | |
// Doesn't work as we'd hoped | |
val outsFromInsAny: List[Outer[Any]] = List(in1, in2).map(Outer.apply) | |
// ❌ Found: Playground.Inner[?1.CAP] | |
// Required: Playground.Inner[Any] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These don't work, but why? | |
val u1 = funPoly(someStuffEx) | |
// ❌ Found: (Playground.someStuffEx : List[Playground.SomeClass[?]]) | |
// Required: List[Playground.SomeClass[A]] | |
// where: A is a type variable | |
val u2 = funAny(someStuffEx) | |
// ❌ Found: (Playground.someStuffEx : List[Playground.SomeClass[?]]) | |
// Required: List[Playground.SomeClass[Any]] | |
// This works fine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class SomeClass[A](a: A) | |
val someStuffAny: List[SomeClass[Any]] = List(SomeClass("foo"), SomeClass(1)) | |
val someStuffEx: List[SomeClass[?]] = List(SomeClass("foo"), SomeClass(1)) | |
def funPoly[A](ss: List[SomeClass[ A ]]): Unit = () | |
def funAny(ss: List[SomeClass[Any]]): Unit = () | |
def funEx(ss: List[SomeClass[ ? ]]): Unit = () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait At | |
trait Bt extends At | |
trait Ct extends Bt | |
trait Dt extends Ct | |
trait Et extends Dt | |
val bcd: List[? <: Bt] = List(new Bt {}, new Ct {}, new Dt {}) | |
val acd: List[? <: Bt] = List(new At {}, new Ct {}, new Dt {}) | |
// ❌ Found: Object with Playground.At {...} | |
// Required: Playground.Bt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val anythings1: List[Any] = List("foo", 3.14, new java.lang.Object) | |
val anythings2: List[?] = List("foo", 3.14, new java.lang.Object) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.softwaremill.diffx.{ConsoleColorConfig, Diff} | |
import zio.test.Assertion.Render.* | |
import zio.test.* | |
trait DiffxAssertions { | |
val matchesToAssertionName = "matchesTo" | |
/** | |
* Just like isTrue from zio-test, but with a different name parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.softwaremill.diffx.{ConsoleColorConfig, Diff} | |
import zio.UIO | |
import zio.test.AssertionM.Render.* | |
import zio.test.* | |
trait DiffxAssertionsM { | |
val matchesToAssertionNameM = "matchesTo" | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"io.github.bbarker" %% "zio-diffx" % "0.0.5" % Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resolvers ++= Seq( | |
"jitpack.io" at "https://jitpack.io/", | |
), |