Skip to content

API derivation broken in Scala 3.7 #6

Open
@WojciechMazur

Description

@WojciechMazur

Issue spotted in Scala 3 Open Community Build - build logs
API derivation used unsafe access to newClass from Quotes API using reflection. This call is now broken in Scala 3.7. The experimental method signature has changes and is now taking additional arguments, see scala/scala3#21880 for details

[error] -- Error: /Users/wmazur/projects/scala/community-build3/repo/core/src/test/scala/respectfully/test/ClientTests.scala:78:28 
[error] 78 |    trait SimpleApi derives API {
[error]    |                            ^
[error]    |Exception occurred while executing macro expansion.
[error]    |java.lang.IllegalArgumentException: wrong number of arguments: 5 expected: 8
[error]    |    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.checkArgumentCount(DirectMethodHandleAccessor.java:329)
[error]    |    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:101)
[error]    |    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[error]    |    at respectfully.API$.proxy(API.scala:244)
[error]    |    at respectfully.API$.$anonfun$8$$anonfun$1(API.scala:172)
[error]    |    at respectfully.API$.$anonfun$8(API.scala:172)
[error]    |    at respectfully.API$.$anonfun$adapted$3(API.scala:172)
[error]    |    at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:111)
[error]    |    at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1574)
[error]    |    at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:136)
[error]    |    at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformBlock$$anonfun$1$$anonfun$1(tpd.scala:1313)
[error]    |    at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1295)
[error]    |    at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1308)
[error]    |    at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformBlock(tpd.scala:1313)
[error]    |    at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1554)
[error]    |    at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:136)
[error]    |    at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1606)
[error]    |    at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:136)
[error]    |    at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1308)
[error]    |    at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1308)
[error]    |    at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformBlock(tpd.scala:1313)
[error]    |    at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1554)
[error]    |    at dotty.tools.dotc.quoted.PickledQuotes$$anon$1.transform(PickledQuotes.scala:136)
[error]    |    at dotty.tools.dotc.quoted.PickledQuotes$.spliceTerms(PickledQuotes.scala:153)
[error]    |    at dotty.tools.dotc.quoted.PickledQuotes$.unpickleTerm(PickledQuotes.scala:89)
[error]    |    at scala.quoted.runtime.impl.QuotesImpl.unpickleExprV2(QuotesImpl.scala:3505)
[error]    |    at respectfully.API$.derivedImpl(API.scala:172)
[error]    |    at respectfully.API$.inline$derivedImpl(API.scala:55)
[error]    |
[error]    |----------------------------------------------------------------------------
[error]    |Inline stack trace
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from API.scala:53
[error] 53 |  inline def derived[Alg]: API[Alg] = ${ derivedImpl[Alg] }
[error]    |                                      ^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions