Open oscar-broman opened 2 years ago
Surely a better summonAll should be possible to make internally, that doesn't have this limitation.
That's what we do not want to do, however. summonAll
is just a normal macro, and should stay that way.
Note, there is no longer an assertion error that happens here using 3.3.1-RC1-bin-20230514-b0ccf40-NIGHTLY
you get the following:
[error] No given instance of type ApiSpec[A] was found.
[error] I found:
[error]
[error] ApiSpec.derived[A](
[error] {
[error] final class $anon() extends Object(), Serializable {
[error] type MirroredMonoType = A
[error] }
[error] (new $anon():Object & Serializable)
[error] }.$asInstanceOf[
[error]
[error] scala.deriving.Mirror.Sum{
[error] type MirroredMonoType² = A; type MirroredType = A;
[error] type MirroredLabel = ("A" : String);
[error] type MirroredElemTypes = (B, C, D, E, F, G, H, I, J, K, L, M, N, O,
[error] B2, C2, D2, E2, F2, G2, H2, I2, J2, K2, L2, M2, N2, O2);
[error] type MirroredElemLabels = (("B" : String), ("C" : String),
[error] ("D" : String), ("E" : String), ("F" : String), ("G" : String),
[error] ("H" : String), ("I" : String), ("J" : String), ("K" : String),
[error] ("L" : String), ("M" : String), ("N" : String), ("O" : String),
[error] ("B2" : String), ("C2" : String), ("D2" : String), ("E2" : String),
[error] ("F2" : String), ("G2" : String), ("H2" : String), ("I2" : String),
[error] ("J2" : String), ("K2" : String), ("L2" : String), ("M2" : String),
[error] ("N2" : String), ("O2" : String))
[error] }
[error]
[error] ]
[error] )
[error]
[error] But given instance derived in object ApiSpec does not match type ApiSpec[A]
[error]
[error] where: MirroredMonoType is a type in an anonymous class locally defined in object Test which is an alias of A
[error] MirroredMonoType² is a type in trait Mirror with bounds
[error] .
[error]
[error] Note: given instance derived in object ApiSpec was not considered because it was not imported with `import given`.
[error] summon[ApiSpec[Interface]]
[error] ^
Error compiling project (Scala 3.3.1-RC1-bin-20230514-b0ccf40-NIGHTLY, JVM)
Compilation failed
Compiler version
Every version, latest version tested is 3.1.2-RC1-bin-20211102-82172ed-NIGHTLY
Minimized code
Output
Note
Compiles just fine with
-Xmax-inlines:33
.Expectation
No crash. Possibly an error showing max inlines reached.
Surely a better
summonAll
should be possible to make internally, that doesn't have this limitation.