Skip to content

Reference to quoted local member fails to in quote pickling #17103

Closed
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.3.1-RC1-bin-20230313-f28d708-NIGHTLY and before

Minimized code

import scala.quoted.*

def test(using Quotes): Expr[Unit] =
  '{
    trait C:
      val d: Int
    val c: C = ???
    ${
      val expr = '{
        val cRef: c.type = ???
        cRef.d
        ()
      }
      expr
    }
  }

Output (click arrow to expand)

Exception in thread "main" 
  unhandled exception while running pickleQuotes on tests/neg-macros/path-dependent-type-capture.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose

     while compiling: <no file>
        during phase: <no phase>
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.10
    compiler version: version 3.3.1-RC1-bin-SNAPSHOT-nonbootstrapped-git-29e229b
            settings: -Vprint List(splicing, staging) -classpath /Users/nicolasstucki/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar:/Users/nicolasstucki/Github/dotty/library/../out/bootstrap/scala3-library-bootstrapped/scala-3.3.1-RC1-bin-SNAPSHOT-nonbootstrapped/scala3-library_3-3.3.1-RC1-bin-SNAPSHOT.jar -d t/out -pagewidth 120

                tree: EmptyTree
       tree position: :<unknown>
           tree type: <notype>
              symbol: val <none>
           call site: package <root> in module class <root>

  == Source file context for tree position ==
java.lang.AssertionError: assertion failed: unresolved symbols: value cRef (line 11) #15683 when pickling tests/neg-macros/path-dependent-type-capture.scala
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:809)
        at dotty.tools.dotc.quoted.PickledQuotes$.pickle(PickledQuotes.scala:222)
        at dotty.tools.dotc.quoted.PickledQuotes$.pickleQuote(PickledQuotes.scala:34)
        at dotty.tools.dotc.transform.PickleQuotes$.pickleAsTasty$1(PickleQuotes.scala:291)
        ...

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions