Created
June 30, 2021 07:20
-
-
Save lewapek/3cbf003a000bbe9bf479607e9967d201 to your computer and use it in GitHub Desktop.
Inconsistency between 0.9.25 and 0.9.26 refined versions
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 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