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

Refined types within a companion objection #6

Open
gvolpe opened this issue Oct 29, 2020 · 2 comments
Open

Refined types within a companion objection #6

gvolpe opened this issue Oct 29, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@gvolpe
Copy link
Member

gvolpe commented Oct 29, 2020

Similar to what happens with newtypes in #4, I guess this is related.

This works:

type MyId = String Refined Uuid

sealed trait Yay
object Yay {
  case class Foo(x: Int) extends Yay
  case class Bar(y: MyId, z: String) extends Yay
}

Check[Yay]

This doesn't:

sealed trait Yay
object Yay {
  type MyId = String Refined Uuid

  case class Foo(x: Int) extends Yay
  case class Bar(y: MyId, z: String) extends Yay
}

Check[Yay]
@gvolpe
Copy link
Member Author

gvolpe commented Oct 29, 2020

This works too!

sealed trait Yay
object Yay {
  case class Foo(x: Int) extends Yay
  case class Bar(y: String Refined Uuid, z: String) extends Yay
}

Check[Yay]

@gvolpe
Copy link
Member Author

gvolpe commented Oct 29, 2020

@gvolpe gvolpe added the bug Something isn't working label Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant