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

From TypeTag to =:= #11215

Open
durban opened this Issue Oct 19, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@durban

durban commented Oct 19, 2018

Unless I'm missing something, there is no safe way (i.e., without using an asInstanceOf) to go from two TypeTags with equal types (as computed by tag.tpe.=:=) to an instance of =:=. Is this actually unsafe? If not, would it make sense to have a way to do this in the standard library?

For reference, the unsafe way to write this is:

def fromTags[A, B](A: TypeTag[A], B: TypeTag[B]): Option[A =:= B] = {
  if (A.tpe =:= B.tpe) Some(=:=.tpEquals[A].asInstanceOf[A =:= B])
  else None
}

@hrhino hrhino added this to the Backlog milestone Oct 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment