Closed
Description
//> using scala 3.6.2
import util.chaining.*
class ann(x: Int = 1, y: Int) extends annotation.Annotation
@ann(y = 22.tap(println)) @main def main = ()
Error: scala.MatchError: Block(List(ValDef(y$1,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],Apply(TypeApply(Select(Apply(TypeApply(TypedSplice(Ident(scalaUtilChainingOps)),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Literal(Constant(22)))),tap),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Unit)])),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any)],EmptyTree))),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Unit)],Apply(TypedSplice(Ident(println)),List(TypedSplice(Ident(x)))))),Closure(List(),TypedSplice(Ident($anonfun)),EmptyTree))))), ValDef(x$1,TypeTree[AnnotatedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Int),ConcreteAnnotation(Apply(Select(New(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class unchecked)),class uncheckedVariance)]),<init>),List())))],Select(TypedSplice(Ident(ann)),$lessinit$greater$default$1))),Apply(Select(New(TypedSplice(Ident(ann))),<init>),List(TypedSplice(Ident(x$1)), NamedArg(y,TypedSplice(Ident(y$1)))))) (of class dotty.tools.dotc.ast.Trees$Block)
at dotty.tools.dotc.typer.Namer.typedAheadAnnotationClass(Namer.scala:1774)
at dotty.tools.dotc.typer.Namer$Completer.addAnnotations$$anonfun$1(Namer.scala:883)