Skip to content

Type splices containing TypeVars not handled #4774

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

Closed
nicolasstucki opened this issue Jul 7, 2018 · 0 comments
Closed

Type splices containing TypeVars not handled #4774

nicolasstucki opened this issue Jul 7, 2018 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

object Test {
  def loop[T](x: Expr[T])(implicit t: Type[T]): Expr[T] =
    '{ val y: ~t = ~x; ~loop('(y)) }
}

crashes with

Exception in thread "main" java.lang.ClassCastException: dotty.tools.dotc.core.Types$TypeVar cannot be cast to dotty.tools.dotc.core.Types$TypeRef
	at dotty.tools.dotc.transform.ReifyQuotes$Reifier.$anonfun$transform$2(ReifyQuotes.scala:570)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:48)
	at dotty.tools.dotc.transform.ReifyQuotes$Reifier.transform(ReifyQuotes.scala:558)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.$anonfun$transform$6(Trees.scala:1256)
	at scala.collection.immutable.List.mapConserve(List.scala:176)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1256)
	at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1170)
	at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:63)
	at dotty.tools.dotc.transform.MacroTransformWithImplicits$ImplicitsTransformer.transform(MacroTransformWithImplicits.scala:86)
...
@odersky odersky closed this as completed in f51c3f8 Jul 8, 2018
odersky added a commit that referenced this issue Jul 8, 2018
Fix #4774: Skip TypeVars and skip if level is equal
smarter referenced this issue Jul 10, 2018
Disallow inferred splices and set the correct position
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

1 participant