Skip to content

Inconsistent compilation results in mirror-deriving code #13001

Closed
@Daenyth

Description

@Daenyth

Compiler version

3.0.0

Minimized code

Not minimized, but the github4s project at this specific commit:
https://github.com/47degrees/github4s/tree/bab2cd491d948807d364fa73687138d35f9feb6c

Output

With the file: https://github.com/47degrees/github4s/blob/gb-scala3/github4s/src/test/scala/github4s/unit/EncoderDecoderSpec.scala#L83

I've observed three different, seemingly-unrelated behaviors so far:

  • If I comment out all test invocations except the first one, compilation succeeds.
  • If I comment out all test invocations except the first two, compilation fails on both, with errors about not finding the Mirror:
Compiler output
[error] -- Error: /Users/gavin/Code/github4s/github4s/src/test/scala/github4s/unit/EncoderDecoderSpec.scala:83:19 
[error] 83 |  test[BlobContent]
[error]    |                   ^
[error]    |no implicit argument of type org.scalacheck.Arbitrary[github4s.domain.BlobContent] was found for an implicit parameter of method test in class EncoderDecoderSpec.
[error]    |I found:
[error]    |
[error]    |    github4s.ArbitraryDerivation.auto.deriveArb[A](
[error]    |      github4s.DerivedGen.derived[A](
[error]    |        /* missing */
[error]    |          summon[
[error]    |            deriving.Mirror{
[error]    |              Kind = shapeless3.deriving.K0.type; 
[error]    |                MirroredType <: github4s.domain.BlobContent
[error]    |              ; MirroredElemTypes <: Tuple
[error]    |            }
[error]    |          ]
[error]    |      )
[error]    |    )
[error]    |
[error]    |But no implicit values were found that match type deriving.Mirror{
[error]    |  Kind = shapeless3.deriving.K0.type; 
[error]    |    MirroredType <: github4s.domain.BlobContent
[error]    |  ; MirroredElemTypes <: Tuple
[error]    |}.
[error] -- Error: /Users/gavin/Code/github4s/github4s/src/test/scala/github4s/unit/EncoderDecoderSpec.scala:84:20 
[error] 84 |  test[BranchCommit]
[error]    |                    ^
[error]    |no implicit argument of type org.scalacheck.Arbitrary[github4s.domain.BranchCommit] was found for an implicit parameter of method test in class EncoderDecoderSpec.
[error]    |I found:
[error]    |
[error]    |    github4s.ArbitraryDerivation.auto.deriveArb[A](
[error]    |      github4s.DerivedGen.derived[A](
[error]    |        /* missing */
[error]    |          summon[
[error]    |            deriving.Mirror{
[error]    |              Kind = shapeless3.deriving.K0.type; 
[error]    |                MirroredType <: github4s.domain.BranchCommit
[error]    |              ; MirroredElemTypes <: Tuple
[error]    |            }
[error]    |          ]
[error]    |      )
[error]    |    )
[error]    |
[error]    |But no implicit values were found that match type deriving.Mirror{
[error]    |  Kind = shapeless3.deriving.K0.type; 
[error]    |    MirroredType <: github4s.domain.BranchCommit
[error]    |  ; MirroredElemTypes <: Tuple
[error]    |}.
[error] two errors found
[error] two errors found
[error] (github4s / Test / compileIncremental) Compilation failed

I've also tried with the first 10-20 or so uncommented, and it fails with those same Mirror errors on each.

  • If I uncomment all test invocations, and try compiling the file as-is, compilation prints no output, the compiler never terminates (I've left it for >20 minutes), and it ignores ctrl-c inputs

Expectation

If the code is correct, it should compile.
If it's incorrect, it should fail consistent, the compiler shouldn't run forever and be uncancelable.

Code that compiles without error should not start producing errors when an unrelated statement is added to the file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions