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
dealias is not working for Predef.String #9323
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9323?orig=1 |
@som-snytt said: scala> import reflect.runtime._,universe._
import reflect.runtime._
import universe._
scala> typeOf[String] == typeOf[java.lang.String]
res0: Boolean = false
scala> typeOf[String].dealias == typeOf[java.lang.String]
res1: Boolean = true |
@adriaanm said: |
@retronym said: https://gist.github.com/retronym/0440cd94f6b531d0e5a0 If you need performance, you can use |
Zhu, Chenye (maxcellent) said: scala> import scala.reflect.runtime.{universe => ru} scala> ru.typeOf[String].dealias == ru.typeOf[java.lang.String] |
Zhu, Chenye (maxcellent) said: Would you please indicated the fixed version? If this is already fixed. |
@som-snytt said: $ scala
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.reflect.runtime.{ universe => ru }
import scala.reflect.runtime.{universe=>ru}
scala> ru.typeOf[String].dealias == ru.typeOf[java.lang.String]
res0: Boolean = true
scala> :quit
$ ./scala-2.11.5/bin/scala
Welcome to Scala version 2.11.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.reflect.runtime.{ universe => ru }
import scala.reflect.runtime.{universe=>ru}
scala> ru.typeOf[String].dealias == ru.typeOf[java.lang.String]
res0: Boolean = true Maybe verify your platform and classpath etc. |
Zhu, Chenye (maxcellent) said:
|
@mpociecha said (edited on Jun 2, 2015 9:39:10 AM UTC): Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\michal>scala
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51). // also tested with 1.8.0_45
Type in expressions to have them evaluated.
Type :help for more information.
scala> :paste
// Entering paste mode (ctrl-D to finish)
import reflect.runtime._,universe._
import reflect.runtime._
import universe._
// Exiting paste mode, now interpreting.
import reflect.runtime._
import universe._
import reflect.runtime._
import universe._
scala> typeOf[String] == typeOf[java.lang.String]
res2: Boolean = false
scala> typeOf[String].dealias == typeOf[java.lang.String]
res3: Boolean = false |
I am not sure if this is only Predef.String. There may be other classes having the same issue.
This bug means we have to always use =:=, instead of == on dealiased type directly, which is really slow
=============================================
The text was updated successfully, but these errors were encountered: