Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Inconsistency between 0.9.25 and 0.9.26 refined versions
import eu.timepit.refined.W
import eu.timepit.refined.api.Refined
import eu.timepit.refined.boolean.And
import eu.timepit.refined.char.LetterOrDigit
import eu.timepit.refined.collection.{Forall, Size}
import eu.timepit.refined.generic.Equal
import eu.timepit.refined.string.StartsWith
object Runner {
import eu.timepit.refined.auto._
type BaseRefinement = And[Size[Equal[10]], Forall[LetterOrDigit]]
type Base = String Refined BaseRefinement
type ConcreteRefinement = And[StartsWith[W.`"001"`.T], BaseRefinement]
type Concrete = String Refined ConcreteRefinement
def funBase(b: Base): Unit = println(b)
def funConcrete(c: Concrete): Unit = println(c)
def main(args: Array[String]): Unit = {
val b: Base = "1234567890"
val c: Concrete = "0012345678"
funBase(b)
funBase(c) // with 0.9.26 doesn't compile, with 0.9.25 works fine
// funConcrete(b) // doesn't compile on both versions - that's fine
funConcrete(c)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment