Skip to content

Missing hole in quote #3847

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 Jan 16, 2018 · 4 comments
Closed

Missing hole in quote #3847

nicolasstucki opened this issue Jan 16, 2018 · 4 comments

Comments

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Jan 16, 2018

import scala.quoted._
import scala.reflect.ClassTag
object Arrays {
  implicit def ArrayIsLiftable[T: Liftable](implicit t: Type[T], ct: Expr[ClassTag[T]]): Liftable[Array[T]] = (arr: Array[T]) => '{
    new Array[~t](~(arr.length: Expr[Int]))(~ct)
    // TODO add elements
  }
}

fails with

assertion failed: unresolved symbols: value t when pickling Foo.scala
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:635)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.pickle(PickledQuotes.scala:74)
	at dotty.tools.dotc.core.quoted.PickledQuotes$.pickleQuote(PickledQuotes.scala:24)
	at dotty.tools.dotc.transform.ReifyQuotes$Reifier.quotation(ReifyQuotes.scala:272)
	at dotty.tools.dotc.transform.ReifyQuotes$Reifier.$anonfun$transform$3(ReifyQuotes.scala:320)

when trying to pickle the quote

dotty.runtime.Arrays.newGenericArray[t.unary_~]([[0| ]])([[1| ]])

Note that there should be a hole in place of t.unary_~.

@nicolasstucki
Copy link
Contributor Author

02f88fe contains two tests for this.

@nicolasstucki
Copy link
Contributor Author

The second test is identical to the original one except that the ~t is nested into the type. In this case new Array[List[~t]](~(arr.length: Expr[Int]))(~ct)

@nicolasstucki nicolasstucki added this to the 0.7 Tech Preview milestone Jan 21, 2018
@biboudis biboudis self-assigned this Feb 19, 2018
@biboudis
Copy link
Contributor

@nicolasstucki what is the current status of this? I don't get unresolved symbols on master.

@nicolasstucki
Copy link
Contributor Author

I got this on master

Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value t when pickling Foo.scala
        at scala.Predef$.assert(Predef.scala:219)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:629)
        at dotty.tools.dotc.core.quoted.PickledQuotes$.pickle(PickledQuotes.scala:89)
        at dotty.tools.dotc.core.quoted.PickledQuotes$.pickleQuote(PickledQuotes.scala:28)
        at dotty.tools.dotc.transform.ReifyQuotes$Reifier.quotation(ReifyQuotes.scala:269)
        at dotty.tools.dotc.transform.ReifyQuotes$Reifier.$anonfun$transform$2(ReifyQuotes.scala:317)
        at dotty.tools.dotc.reporting.trace$.op1$2(trace.scala:25)
        at dotty.tools.dotc.reporting.trace$.apply(trace.scala:26)
        at dotty.tools.dotc.reporting.trace$.apply(trace.scala:36)
        at dotty.tools.dotc.transform.ReifyQuotes$Reifier.transform(ReifyQuotes.scala:307)
        at dotty.tools.dotc.transform.MacroTransformWithImplicits$ImplicitsTransformer.transform(MacroTransformWithImplicits.scala:84)
        at dotty.tools.dotc.transform.ReifyQuotes$Reifier.super$transform(ReifyQuotes.scala:309)
        at dotty.tools.dotc.transform.ReifyQuotes$Reifier.mapOverTree$1(ReifyQuotes.scala:309)
        at dotty.tools.dotc.transform.ReifyQuotes$Reifier.$anonfun$transform$2(ReifyQuotes.scala:338)
        at dotty.tools.dotc.reporting.trace$.op1$2(trace.scala:25)
        at dotty.tools.dotc.reporting.trace$.apply(trace.scala:26)
        at dotty.tools.dotc.reporting.trace$.apply(trace.scala:36)
        at dotty.tools.dotc.transform.ReifyQuotes$Reifier.transform(ReifyQuotes.scala:307)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.$anonfun$transform$6(Trees.scala:1225)
        ...

@nicolasstucki nicolasstucki removed this from the 0.7 Tech Preview milestone Mar 5, 2018
biboudis pushed a commit to dotty-staging/dotty that referenced this issue Mar 14, 2018
biboudis added a commit to dotty-staging/dotty that referenced this issue Mar 14, 2018
biboudis added a commit to dotty-staging/dotty that referenced this issue Mar 15, 2018
biboudis added a commit to dotty-staging/dotty that referenced this issue Mar 16, 2018
biboudis pushed a commit to dotty-staging/dotty that referenced this issue Mar 16, 2018
biboudis added a commit to dotty-staging/dotty that referenced this issue Mar 16, 2018
biboudis added a commit to dotty-staging/dotty that referenced this issue Mar 20, 2018
nicolasstucki added a commit that referenced this issue Mar 20, 2018
Fix #3847: Handle correctly splicing of (possibly) nested type parameters
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

3 participants