scalalandio / chimney

Scala library for boilerplate-free, type-safe data transformations
https://chimney.readthedocs.io
Apache License 2.0
1.15k stars 91 forks source link

Add better error message on StackOverflow in macros, prevent SO in some cases with Scala 3 enums mapping #528

Closed MateuszKubuszok closed 4 months ago

MateuszKubuszok commented 4 months ago

Description:

TODO 1: fix ignored snippets in docs once this is figured out

TODO 2:

  exception while retyping PaymentMethod.this of class This # -1

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose

     while compiling: /private/tmp/eldupa3/.scala-build/eldupa3_d091e5187c/src_generated/main/snippet.scala
        during phase: MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, etaReduce, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.3.3
            settings: -J<flag> List(-Xss128m) -classpath /Users/dev/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.3/scala3-library_3-3.3.3.jar:/Users/dev/.ivy2/local/io.scalaland/chimney_3/1.0.0-RC1-51-g4a37a24-SNAPSHOT/jars/chimney_3.jar:/Users/dev/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar:/Users/dev/.ivy2/local/io.scalaland/chimney-macro-commons_3/1.0.0-RC1-51-g4a37a24-SNAPSHOT/jars/chimney-macro-commons_3.jar:/Users/dev/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_3/2.11.0/scala-collection-compat_3-2.11.0.jar -d /private/tmp/eldupa3/.scala-build/eldupa3_d091e5187c/classes/main -java-output-version 17 -sourceroot /private/tmp/eldupa3

in one of these snippets. Reported as https://github.com/scala/scala3/issues/20349

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 87.72%. Comparing base (4a37a24) to head (e62ccf0).

Files Patch % Lines
...chimney/internal/compiletime/DerivationError.scala 75.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #528 +/- ## ========================================== + Coverage 87.60% 87.72% +0.11% ========================================== Files 136 136 Lines 5488 5440 -48 Branches 440 455 +15 ========================================== - Hits 4808 4772 -36 + Misses 680 668 -12 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

MateuszKubuszok commented 4 months ago

After talking to @jchyb these fixes makes sense, but with the solution for a compiler crash we would probably have to wait for new compiler version, I'll merge it for now to proceed with docs improvements.