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
Reflection: == on equal types returns false #5959
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5959?orig=1 |
@dgruntz said: scala> t1.typeSymbol
res29: reflect.runtime.universe.Symbol = class Int
scala> t2.typeSymbol
res30: reflect.runtime.universe.Symbol = class Int
scala> t1.typeSymbol == t2.typeSymbol
res32: Boolean = true |
@adriaanm said: |
@dgruntz said: |
@adriaanm said: scala> TypeRef.unapply(t1.asInstanceOf[TypeRef])
res2: Option[(reflect.runtime.universe.Type, reflect.runtime.universe.Symbol, List[reflect.runtime.universe.Type])] = Some((scala.type,class Int,List()))
scala> TypeRef.unapply(t2.asInstanceOf[TypeRef])
res3: Option[(reflect.runtime.universe.Type, reflect.runtime.universe.Symbol, List[reflect.runtime.universe.Type])] = Some((scala.type,class Int,List()))
scala> TypeRef.unapply(t1.asInstanceOf[TypeRef]).get._1 == TypeRef.unapply(t2.asInstanceOf[TypeRef]).get._1
res9: Boolean = false
scala> System.identityHashCode(t1)
res10: Int = 598346035
scala> System.identityHashCode(t2)
res11: Int = 1622300681 |
@xeno-by said (edited on Jun 21, 2012 10:57:28 PM UTC): scala> mirrorThatLoaded(pre1.typeSymbol)
res2 @ 6547bc27: reflect.runtime.universe.Mirror = JavaMirror with scala.tools.nsc.interpreter.IMain
$TranslatingClassLoader@4069b25f of type class scala.tools.nsc.interpreter.IMain$TranslatingClassLoa
der with classpath <unknown>
scala> mirrorThatLoaded(pre2.typeSymbol)
res3 @ 4b59df6c: reflect.runtime.universe.Mirror = JavaMirror with sun.misc.Launcher$AppClassLoader@
546b97fd of type class sun.misc.Launcher$AppClassLoader with classpath [file:/C:/Projects/Kepler/tes
t/files/codelib/code.jar,file:/C:/Projects/Kepler/lib/jline.jar,file:/C:/Projects/Kepler/lib/fjbg.ja
r,file:/C:/Projects/Kepler/build/locker/classes/compiler/,file:/C:/Projects/Kepler/build/locker/clas
ses/reflect/,file:/C:/Projects/Kepler/build/locker/classes/library/] Very well. It seems that we need to disable symbol sharing altogether. |
@xeno-by said: |
@xeno-by said: |
I access the result type of a method (
{Int
) and compiare it withtypeOf[Int]
, but that returnsfalse
. I expected to seetrue
.and now the output from the REPL:
The text was updated successfully, but these errors were encountered: