dotty-0.24-RC1
https://scastie.scala-lang.org/Odomontois/fKGIdKrGStyTNTF3juhxAQ/1
import scala.compiletime.{erasedValue, summonInline}
import scala.deriving.Mirror
inline def summonAll[T <: Tuple, TC[Any]]: List[TC[Any]] = inline erasedValue[T] match
case _: Unit => Nil
case _: (t *: ts) => summonInline[TC[t]].asInstanceOf[TC[Any]] :: summonAll[ts, TC]
trait Semigroup[A]:
def combine(a: A, b: A): A
final def (a: A) <+> (b: A): A = combine(a, b)
object Semigroup:
given Semigroup[Int] = _ + _
given Semigroup[String] = _ + _
given[A] as Semigroup[List[A]] = _ ++ _
given[A] as Semigroup[Option[A]] = _ orElse _
inline def derived[A] (using m: Mirror.Of[A]): Semigroup[A] = inline m match
case p: Mirror.ProductOf[A] => productOf(p)
case _ => compiletime.error("can derive only products")
private inline def productOf[A](m: Mirror.ProductOf[A]): Semigroup[A] = new:
val instances = IArray(summonAll[m.MirroredElemTypes, Semigroup]:_*)
def combine(a: A, b: A) = m fromProduct new:
val ap = a.asInstanceOf[Product]
val bp = b.asInstanceOf[Product]
def productArity = ap.productArity
def productElement(i: Int) = instances(i).combine(ap.productElement(i), bp.productElement(i))
def canEqual(that: Any) = true
final case class ExampleValue[c[_[_]]](get: c[Option])
object ExampleValue:
given [c[_[_]]] as Semigroup[ExampleValue[c]] = Semigroup.derived
java.nio.file.NoSuchFileException: /__w/dotty/dotty/library/src/scala/compiletime/package.scala
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at dotty.tools.io.File.inputStream(File.scala:51)
at dotty.tools.io.PlainFile.input(PlainFile.scala:44)
at dotty.tools.io.AbstractFile.toByteArray(AbstractFile.scala:170)
at dotty.tools.dotc.util.SourceFile.SourceFile$superArg$1$$anonfun$1(SourceFile.scala:55)
at dotty.tools.dotc.util.SourceFile.content(SourceFile.scala:47)
at dotty.tools.dotc.util.SourceFile.lineIndices(SourceFile.scala:114)
at dotty.tools.dotc.util.SourceFile.offsetToLine(SourceFile.scala:133)
at dotty.tools.dotc.util.SourcePosition.line(SourcePosition.scala:25)
at xsbt.DelegatingReporter$2.line(DelegatingReporter.java:90)
at com.olegych.scastie.sbtscastie.CompilerReporter$$anon$1.toApi$1(CompilerReporter.scala:43)
at com.olegych.scastie.sbtscastie.CompilerReporter$$anon$1.$anonfun$printSummary$2(CompilerReporter.scala:46)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:238)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
at scala.collection.TraversableLike.map(TraversableLike.scala:238)
at scala.collection.TraversableLike.map$(TraversableLike.scala:231)
at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:198)
at com.olegych.scastie.sbtscastie.CompilerReporter$$anon$1.printSummary(CompilerReporter.scala:46)
at xsbt.DelegatingReporter.printSummary(DelegatingReporter.java:57)
at dotty.tools.dotc.Run.printSummary(Run.scala:268)
at dotty.tools.dotc.Driver.finish$1(Driver.scala:41)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:51)
at dotty.tools.dotc.Driver.process(Driver.scala:194)
at dotty.tools.dotc.Main.process(Main.scala)
at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
at xsbt.CompilerInterface.run(CompilerInterface.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
at sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1765)
at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1738)
at scala.Function1.$anonfun$compose$1(Function1.scala:49)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
at sbt.std.Transform$$anon$4.work(Transform.scala:67)
at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
at sbt.Execute.work(Execute.scala:290)
at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
That seems to be scastie related. If I compile this as a standalone file I get:
37 | given [c[_[_]]] as Semigroup[ExampleValue[c]] = Semigroup.derived
| ^^^^^^^^^^^^^^^^^
| cannot reduce summonFrom with
| patterns : case t @ _:Semigroup[c[Option]]
| This location contains code that was inlined from package.scala:72
| This location contains code that was inlined from test.scala:7
| This location contains code that was inlined from test.scala:25
| This location contains code that was inlined from test.scala:21
I think this should be refiled as an issue against scastie.
I have this problem in linux as well in windows in this branch https://github.com/Odomontois/kuraga/tree/semigroup-repro
Reproduced on MacOs 10.15.3
@odersky can this be reopened?
Same on MacOs 10.15.4
error.txt
Most helpful comment
I have this problem in linux as well in windows in this branch https://github.com/Odomontois/kuraga/tree/semigroup-repro