Skip to content

Commit c1b4c72

Browse files
committed
Remove inline function and use as regression test
1 parent 047309f commit c1b4c72

File tree

4 files changed

+1
-23
lines changed

4 files changed

+1
-23
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ object Splicer {
6565
val args1 = args.head.zip(tp.paramInfos).map {
6666
case (arg: Literal, tp) if tp.hasAnnotation(defn.InlineParamAnnot) => arg.const.value
6767
case (arg, tp) =>
68-
assert(!tp.hasAnnotation(defn.InlineParamAnnot) || defn.isFunctionType(tp))
68+
assert(!tp.hasAnnotation(defn.InlineParamAnnot))
6969
// Replace argument by its binding
7070
val arg1 = bindMap.getOrElse(arg, arg)
7171
new scala.quoted.Exprs.TastyTreeExpr(arg1)

tests/run/quote-inline-function.check

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,3 @@ By name function
2929
else ()
3030
while$()
3131
}
32-
33-
inline function
34-
{
35-
var i: Int = 0
36-
val j: Int = 5
37-
<label> def while$(): Unit =
38-
if i.<(j) then
39-
{
40-
val x$1: Int = i
41-
scala.Predef.println(x$1)
42-
i = i.+(1)
43-
while$()
44-
}
45-
else ()
46-
while$()
47-
}

tests/run/quote-inline-function/quoted_1.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ object Macros {
66

77
inline def foreach1(start: Int, end: Int, f: Int => Unit): String = ~impl('(start), '(end), '(f))
88
inline def foreach2(start: Int, end: Int, f: => Int => Unit): String = ~impl('(start), '(end), '(f))
9-
inline def foreach3(start: Int, end: Int, inline f: Int => Unit): String = ~impl('(start), '(end), '(f))
109

1110
def impl(start: Expr[Int], end: Expr[Int], f: Expr[Int => Unit]): Expr[String] = {
1211
val res = '{

tests/run/quote-inline-function/quoted_2.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,5 @@ object Test {
99

1010
println("By name function")
1111
println(foreach2(0, 5, x => println(x)))
12-
println()
13-
14-
println("inline function")
15-
println(foreach3(0, 5, x => println(x)))
16-
1712
}
1813
}

0 commit comments

Comments
 (0)