Skip to content

Commit 94987ea

Browse files
committed
Fix interpretation of inlined sequence literals
1 parent 7f2f5ce commit 94987ea

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

compiler/src/dotty/tools/dotc/transform/Splicer.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,10 @@ object Splicer {
318318

319319
case Inlined(EmptyTree, Nil, expansion) => interpretTree(expansion)
320320

321-
case Typed(SeqLiteral(elems, _), _) =>
321+
case Typed(expr, _) =>
322+
interpretTree(expr)
323+
324+
case SeqLiteral(elems, _) =>
322325
interpretVarargs(elems.map(e => interpretTree(e)))
323326

324327
case _ =>

compiler/test/dotc/run-test-pickling.blacklist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ i4803f
2222
i4947b
2323
i5119
2424
i5119b
25+
i5188a
2526
inline-varargs-1
2627
implicitShortcut
2728
inline-case-objects

tests/run/i5188a.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0
2+
1
3+
3
4+
6

tests/run/i5188a/Macro_1.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import scala.quoted._
2+
3+
object Lib {
4+
inline def sum(inline args: Int*): Int = ~impl(args: _*)
5+
def impl(args: Int*): Expr[Int] = args.sum.toExpr
6+
}

tests/run/i5188a/Test_2.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
object Test {
3+
def main(args: Array[String]): Unit = {
4+
println(Lib.sum())
5+
println(Lib.sum(1))
6+
println(Lib.sum(1, 2))
7+
println(Lib.sum(1, 2, 3))
8+
}
9+
}

0 commit comments

Comments
 (0)