Skip to content

summonInline crashes when there is no instance available #8942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cb372 opened this issue May 11, 2020 · 2 comments
Closed

summonInline crashes when there is no instance available #8942

cb372 opened this issue May 11, 2020 · 2 comments

Comments

@cb372
Copy link
Contributor

cb372 commented May 11, 2020

Minimized code

trait Show[A] {
  def show(a: A): String
}

object Main {

  inline def foo: String =
    scala.compiletime.summonInline[Show[Int]].show(123)

  println(foo)

}

Output (click arrow to expand)

sbt:dotty-simple> compile
[info] Compiling 1 Scala source to /Users/chris/code/dotty-summonInline-issue/target/scala-0.24/classes ...
[info] exception occurred while typechecking /Users/chris/code/dotty-summonInline-issue/src/main/scala/Main.scala
[info] exception occurred while compiling /Users/chris/code/dotty-summonInline-issue/src/main/scala/Main.scala
java.nio.file.NoSuchFileException: /__w/dotty/dotty/library/src/scala/compiletime/package.scala while compiling /Users/chris/code/dotty-summonInline-issue/src/main/scala/Main.scala
[error] ## Exception when compiling 1 sources to /Users/chris/code/dotty-summonInline-issue/target/scala-0.24/classes
[error] java.nio.file.NoSuchFileException: /__w/dotty/dotty/library/src/scala/compiletime/package.scala
[error] sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
[error] sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
[error] sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
[error] sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
[error] java.nio.file.Files.newByteChannel(Files.java:361)
[error] java.nio.file.Files.newByteChannel(Files.java:407)
[error] java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
[error] java.nio.file.Files.newInputStream(Files.java:152)
[error] dotty.tools.io.File.inputStream(File.scala:51)
[error] dotty.tools.io.PlainFile.input(PlainFile.scala:44)
[error] dotty.tools.io.AbstractFile.toByteArray(AbstractFile.scala:170)
[error] dotty.tools.dotc.util.SourceFile.SourceFile$superArg$1$$anonfun$1(SourceFile.scala:55)
[error] dotty.tools.dotc.util.SourceFile.content(SourceFile.scala:47)
[error] dotty.tools.dotc.util.SourceFile.lineIndices(SourceFile.scala:114)
[error] dotty.tools.dotc.util.SourceFile.offsetToLine(SourceFile.scala:133)
[error] dotty.tools.dotc.util.SourcePosition.line(SourcePosition.scala:25)
[error] xsbt.DelegatingReporter$2.line(DelegatingReporter.java:90)
[error] sbt.internal.server.LanguageServerReporter.$anonfun$toDiagnostics$2(LanguageServerReporter.scala:109)
[error] scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:245)
[error] scala.collection.Iterator.foreach(Iterator.scala:941)
[error] scala.collection.Iterator.foreach$(Iterator.scala:941)
[error] scala.collection.AbstractIterator.foreach(Iterator.scala:1429)
[error] scala.collection.IterableLike.foreach(IterableLike.scala:74)
[error] scala.collection.IterableLike.foreach$(IterableLike.scala:73)
[error] scala.collection.AbstractIterable.foreach(Iterable.scala:56)
[error] scala.collection.TraversableLike.flatMap(TraversableLike.scala:245)
[error] scala.collection.TraversableLike.flatMap$(TraversableLike.scala:242)
[error] scala.collection.AbstractTraversable.flatMap(Traversable.scala:108)
[error] sbt.internal.server.LanguageServerReporter.toDiagnostics(LanguageServerReporter.scala:107)
[error] sbt.internal.server.LanguageServerReporter.$anonfun$aggregateProblems$1(LanguageServerReporter.scala:97)
[error] sbt.internal.server.LanguageServerReporter.$anonfun$aggregateProblems$1$adapted(LanguageServerReporter.scala:94)
[error] scala.Option.foreach(Option.scala:407)
[error] sbt.internal.server.LanguageServerReporter.aggregateProblems(LanguageServerReporter.scala:94)
[error] sbt.internal.server.LanguageServerReporter.logError(LanguageServerReporter.scala:62)
[error] sbt.internal.inc.LoggedReporter.display(LoggedReporter.scala:167)
[error] sbt.internal.inc.LoggedReporter.log(LoggedReporter.scala:142)
[error] sbt.internal.server.LanguageServerReporter.log(LanguageServerReporter.scala:58)
[error] xsbt.DelegatingReporter.doReport(DelegatingReporter.java:134)
[error] dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:266)
[error] dotty.tools.dotc.reporting.Reporter.flush$$anonfun$1(Reporter.scala:323)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.reporting.Reporter.flush(Reporter.scala:323)
[error] dotty.tools.dotc.core.TyperState.commit(TyperState.scala:157)
[error] dotty.tools.dotc.typer.Applications.fail$1(Applications.scala:928)
[error] dotty.tools.dotc.typer.Applications.realApply$7$$anonfun$6$$anonfun$2(Applications.scala:934)
[error] scala.Option.getOrElse(Option.scala:201)
[error] dotty.tools.dotc.typer.Applications.realApply$8$$anonfun$7(Applications.scala:935)
[error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2577)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:936)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:972)
[error] dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:85)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2345)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2500)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2522)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2003)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2333)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2337)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2403)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2477)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2522)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2129)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2376)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2443)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2452)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2455)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2566)
[error] dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
[error] dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
[error] dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
[error] dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:85)
[error] dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:165)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$5(Run.scala:175)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:183)
[error] dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:190)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:127)
[error] dotty.tools.dotc.Run.compile(Run.scala:110)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
[error] dotty.tools.dotc.Driver.process(Driver.scala:194)
[error] dotty.tools.dotc.Main.process(Main.scala)
[error] xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
[error] xsbt.CompilerInterface.run(CompilerInterface.java:41)
[error] sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
[error] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] java.lang.reflect.Method.invoke(Method.java:498)
[error] sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
[error] sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
[error] sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
[error] sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
[error] sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
[error] sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1762)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1735)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error] sbt.Execute.work(Execute.scala:290)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] java.lang.Thread.run(Thread.java:748)
[error]
[error] stack trace is suppressed; run last Compile / compileIncremental for the full output
[error] (Compile / compileIncremental) java.nio.file.NoSuchFileException: /__w/dotty/dotty/library/src/scala/compiletime/package.scala
@smarter
Copy link
Member

smarter commented May 11, 2020

Should be fixed in master and recent nightlies: #8897

@smarter smarter closed this as completed May 11, 2020
@cb372
Copy link
Contributor Author

cb372 commented May 11, 2020

Thanks. Confirmed fixed in 0.25.0-bin-20200510-5154641-NIGHTLY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants