Skip to content

Drop invalid assumption from TastyUnpickler #23353

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,6 @@ class TreeUnpickler(reader: TastyReader,
inline def readImportOrExport(inline mkTree:
(Tree, List[untpd.ImportSelector]) => Tree)()(using Context): Tree = {
val start = currentAddr
assert(sourcePathAt(start).isEmpty)
readByte()
readEnd()
val expr = readTree()
Expand Down
13 changes: 13 additions & 0 deletions scaladoc-testcases/src/tests/22265/macro.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import scala.quoted._

object TestBuilder:
// transparent is needed
transparent inline def apply(inline expr: Unit): Any =
${ TestBuilder.processTests('expr) }

def processTests(using Quotes)(body: Expr[Unit]): Expr[Any] =
import quotes.reflect._
body.asTerm match {
case Inlined(_, _, bindings) =>
'{ ${bindings.asExpr}; () } // can also be List(${bindings})
}
4 changes: 4 additions & 0 deletions scaladoc-testcases/src/tests/22265/test.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object breaks {
TestBuilder:
import List.empty
}
Loading