Skip to content

Commit ebaceb8

Browse files
Add regression test (#17389)
Fix #14123
2 parents 65900c0 + fb23568 commit ebaceb8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/neg-macros/i14123a.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import scala.quoted._
2+
3+
def f(foo: Any => Any)(using Quotes): Expr[Any] =
4+
'{ println(${ foo[Int]('{???}); ??? }) } // error

tests/neg-macros/i14123b.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package x
2+
3+
import scala.quoted._
4+
5+
object Impl {
6+
7+
sealed trait UpdateOp[+T]
8+
case class Assignment[T](value:Expr[T]) extends UpdateOp[T]
9+
case class Update(operation:Expr[Unit]) extends UpdateOp[Nothing]
10+
11+
def genRead[B:Type](newBuilder: Expr[B],
12+
readVal: (Expr[B]) => UpdateOp[B]
13+
)(using Quotes): Expr[B] =
14+
'{
15+
var x = $newBuilder
16+
${readVal[B]('x) match { // error: method apply in trait Function1 does not take type parameters
17+
case Assignment(value) => '{ x = $value } // error
18+
case Update(operation) => operation // error
19+
}}
20+
x
21+
}
22+
23+
}

0 commit comments

Comments
 (0)