Skip to content

Instantly share code, notes, and snippets.

@lewapek
Created June 30, 2021 07:20
Show Gist options
  • Save lewapek/3cbf003a000bbe9bf479607e9967d201 to your computer and use it in GitHub Desktop.
Save lewapek/3cbf003a000bbe9bf479607e9967d201 to your computer and use it in GitHub Desktop.
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