From 6daf647fb0c3b8cab20acb3010d58ac910665d94 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Tue, 3 Sep 2024 19:36:22 +0200 Subject: [PATCH] surface: Fix macros under Scala 3.6 change to context bounds (#3623) Since Scala 3.6 context bounds would be mapped to using arguments, previously they were using implicit arguments. This change affects the macros which eliminate ClassTag context bound arguments. The issue was detected by the Scala 3 Open Community build - [build logs](https://github.com/VirtusLab/community-build3/actions/runs/10640209328) --- .../airframe/surface/CompileTimeSurfaceFactory.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/airframe-surface/src/main/scala-3/wvlet/airframe/surface/CompileTimeSurfaceFactory.scala b/airframe-surface/src/main/scala-3/wvlet/airframe/surface/CompileTimeSurfaceFactory.scala index 6e493f3df..80c6f75e7 100644 --- a/airframe-surface/src/main/scala-3/wvlet/airframe/surface/CompileTimeSurfaceFactory.scala +++ b/airframe-surface/src/main/scala-3/wvlet/airframe/surface/CompileTimeSurfaceFactory.scala @@ -527,7 +527,14 @@ private[surface] class CompileTimeSurfaceFactory[Q <: Quotes](using quotes: Q): // Empty arg is allowed lst.isEmpty || // Remove type params or implicit ClassTag evidences as MethodSurface can't pass type parameters - !lst.forall(x => x.isTypeParam || (x.flags.is(Flags.Implicit) && x.typeRef <:< TypeRepr.of[ClassTag[_]])) + !lst.forall { x => + def hasFlag(flag: Flags) = x.flags.is(flag) + def isClassTag = x.typeRef <:< TypeRepr.of[ClassTag[_]] + // Since Scala 3.6 context bounds are mapped to using parameters + // In Scala 3.5 and earlier context bounds are mapped to implicit arguments + x.isTypeParam || + ((hasFlag(Flags.Implicit) || hasFlag(Flags.Given)) && isClassTag) + } } paramss.map { params =>