Skip to content

Commit 6a3bdb7

Browse files
committed
Fix leak in encapsulated type
1 parent d1ee562 commit 6a3bdb7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/interpreter/PickledQuotes.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ object PickledQuotes {
4242
* `package _root_ { def '(hole$1: String, hole$2: String): String = "foo" + hole$1 + "bar" + hole$2 }`
4343
*/
4444
private def encapsulateQuote(tree: Tree)(implicit ctx: Context): Tree = {
45-
val quotedVal = SyntheticValDef("'".toTermName, tree)
45+
val sym = ctx.newSymbol(ctx.owner, "'".toTermName, Synthetic, defn.AnyType, coord = tree.pos)
46+
val quotedVal = ValDef(sym, tree)
4647
PackageDef(ref(defn.RootPackage).asInstanceOf[Ident], quotedVal :: Nil)
4748
}
4849

tests/pos/quote-1.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ object Test {
1111
f('{ true })('[Boolean])
1212

1313
def g(es: Expr[String], t: Type[String]) =
14-
??? // FIXME
15-
// f('{ (~es + "!") :: Nil })('[List[~t]])
14+
f('{ (~es + "!") :: Nil })('[List[~t]])
1615
}

0 commit comments

Comments
 (0)