Skip to content

Commit

Permalink
surface: Fix macros under Scala 3.6 change to context bounds (#3623)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
WojciechMazur authored Sep 3, 2024
1 parent 87883d6 commit 6daf647
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down

0 comments on commit 6daf647

Please sign in to comment.