Skip to content
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

“No TypeTag available” regression #6649

Closed
scabug opened this issue Nov 11, 2012 · 2 comments
Closed

“No TypeTag available” regression #6649

scabug opened this issue Nov 11, 2012 · 2 comments
Assignees

Comments

@scabug
Copy link

scabug commented Nov 11, 2012

In REPL:

scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._

scala> { class B(b:Int); typeTag[B] }
<console>:11: error: No TypeTag available for B
              { class B(b:Int); typeTag[B] }
                                       ^

In 2.10.0-M7, this compiles fine.

@scabug
Copy link
Author

scabug commented Nov 11, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6649?orig=1
Reporter: Platon Pronko (rogach)
Affected Versions: 2.10.0-RC1, 2.10.0-RC2

@scabug
Copy link
Author

scabug commented Nov 11, 2012

@xeno-by said (edited on Nov 11, 2012 11:55:50 AM UTC):
This is intentional. If you run scala with -Xlog-implicits, it will explain the reason:

scala> { class B(b:Int); typeTag[B] }
materializing requested reflect.runtime.universe.type.TypeTag[B] using `package`.this.materializeTypeTag[B](scala.reflect.runtime.`package`.universe)
<console>:30: `package`.this.materializeTypeTag[B](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[B] because:
failed to typecheck the materialized tag: 
cannot create a TypeTag referring to local class B
              { class B(b:Int); typeTag[B] }
                                       ^
<console>:30: error: No TypeTag available for B
              { class B(b:Int); typeTag[B] }
                                       ^

scala> { class B(b:Int); weakTypeTag[B] }
res0: reflect.runtime.universe.WeakTypeTag[_ <: Object] = WeakTypeTag[B]

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

No branches or pull requests

2 participants