You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered this error trying to compile code that uses the shapeless ~?> typeclass with the toolbox, and simplified it to this:
importscala.reflect.runtime.currentMirrorimportscala.tools.reflect.ToolBoxvaltb=ToolBox(currentMirror).mkToolBox()
valsource="""{ import scala.language.higherKinds class Outer[X] { class Inner[Y] } class Other[T[_]] new Other[Outer[Int]#Inner]()}"""valtree= tb.parse(source)
tb.typecheck(tree).tpe
This fails with:
Exception in thread "main" scala.MatchError: <tree with deferred refcheck> (of class scala.tools.nsc.ast.Trees$TypeTreeWithDeferredRefCheck)
at scala.reflect.internal.Importers$StandardImporter.recreateTree(Importers.scala:309)
Importers doesn't deal with the extra AST node types introduced in nsc.Global, namely TypeTreeWithDeferredRefCheck
The text was updated successfully, but these errors were encountered:
@retronym said (edited on Jul 28, 2015 11:39:43 PM UTC):
Fixing it would require adding a default case in src/reflect/scala/reflect/internal/Importers.scala importTree that forwards to an extension hook that could be implemented in nsc.Global. This pattern is already used in TreePrinters, see in particular xprinttree
It wasn't working as I had hoped, I suspect there is an underlying bug in the compiler generating the right bridge methods down the cake for the method I added.
As reported by Daniel Armak on the mailing list:
I encountered this error trying to compile code that uses the shapeless ~?> typeclass with the toolbox, and simplified it to this:
This fails with:
Importers doesn't deal with the extra AST node types introduced in nsc.Global, namely
TypeTreeWithDeferredRefCheck
The text was updated successfully, but these errors were encountered: