Skip to content

Add regression test #17389

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

Merged
merged 1 commit into from
May 3, 2023
Merged
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
4 changes: 4 additions & 0 deletions tests/neg-macros/i14123a.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import scala.quoted._

def f(foo: Any => Any)(using Quotes): Expr[Any] =
'{ println(${ foo[Int]('{???}); ??? }) } // error
23 changes: 23 additions & 0 deletions tests/neg-macros/i14123b.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package x

import scala.quoted._

object Impl {

sealed trait UpdateOp[+T]
case class Assignment[T](value:Expr[T]) extends UpdateOp[T]
case class Update(operation:Expr[Unit]) extends UpdateOp[Nothing]

def genRead[B:Type](newBuilder: Expr[B],
readVal: (Expr[B]) => UpdateOp[B]
)(using Quotes): Expr[B] =
'{
var x = $newBuilder
${readVal[B]('x) match { // error: method apply in trait Function1 does not take type parameters
case Assignment(value) => '{ x = $value } // error
case Update(operation) => operation // error
}}
x
}

}