Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support type aliases #14

Open
poslegm opened this issue Mar 18, 2021 · 1 comment
Open

Support type aliases #14

poslegm opened this issue Mar 18, 2021 · 1 comment

Comments

@poslegm
Copy link
Owner

poslegm commented Mar 18, 2021

  test("work with type alias") {
    type PositiveInt = Int Refined Positive
    @Validation case class Test(a: PositiveInt)
    // compilation fails
    assertEquals(Test.create(2), Validated.valid(Test(2))) 
    assertEquals(
      Test.create(-2),
      Validated.invalidNec[String, Test]("For field Test.ref: Predicate failed: (-2 > 0).")
    )
  }

create argument has type PositiveInt instead of int

@poslegm poslegm modified the milestone: First release Mar 18, 2021
@poslegm
Copy link
Owner Author

poslegm commented Mar 20, 2021

field.tpt.tpe.dealias should help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant