Skip to content

From TypeTag to =:= #11215

@durban

Description

@durban

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
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions