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
Inconsistent TypeTag for String #9402
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9402?orig=1 |
@retronym said: Runtime reflection can end up with different symbols to represent the same package, due to the way it models classloader heirarchies: |
Mikael Ståldal (mikaelstaldal) said: trait TypeTag[T] extends WeakTypeTag[T] with Equals with Serializable {
override def equals(x: Any) = x.isInstanceOf[TypeTag[_]] && this.tpe =:= x.asInstanceOf[TypeTag[_]].tpe
} |
@retronym said: |
Mikael Ståldal (mikaelstaldal) said: What about adding =:= directly to TypeTag? trait TypeTag[T] extends WeakTypeTag[T] with Equals with Serializable {
def =:= (that: Type) = this.tpe =:= that.tpe
} |
Mikael Ståldal (mikaelstaldal) said: |
Mikael Ståldal (mikaelstaldal) said: |
@retronym said: scala/scala@2b09d8c#diff-60210be5d1c8c7fc228f97c97d5a8941R125 |
@retronym said: The |
Mikael Ståldal (mikaelstaldal) said: |
When using an implicit TypeTag parameter, you get
TypeTag[java.lang.String]
for a string literal or typejava.lang.String
in a type application, but you getTypeTag[String]
for the typeString
in a type application. These two type tags do not compare equal.This is confusing, I expect the type application
[String]
to correspond to a string literal. Just like the type application[Int]
corresponds to an integer literal.The text was updated successfully, but these errors were encountered: