Skip to content
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

crash when trying completions on a specific library #1567

Open
bishabosha opened this issue Oct 8, 2024 · 0 comments · May be fixed by #1581
Open

crash when trying completions on a specific library #1567

bishabosha opened this issue Oct 8, 2024 · 0 comments · May be fixed by #1581

Comments

@bishabosha
Copy link

bishabosha commented Oct 8, 2024

So I was experimenting with my own enum-extensions library in amm and I managed to crash the shell with an autocompletion.

I could not replicate the crash in the standard dotty repl.

Here is the prelude:

amm
Loading...
Welcome to the Ammonite Repl 3.0.0-2-6342755f (Scala 3.5.1 Java 17)
@ import $ivy.`io.github.bishabosha::enum-extensions:0.1.1`
import $ivy.$

@ import enumextensions.EnumMirror
import enumextensions.EnumMirror

@ enum Foo derives EnumMirror:
    case A, B, C

defined class Foo

@ EnumMirror[Foo]
res3: EnumMirror[Foo] = ammonite.$sess.cmd2$Foo$$anon$2@72443081

now the crash happens when I try to tab-complete after EnumMirror[Foo].

tried to show that
  enumextensions.EnumMirror[ammonite.$sess.cmd2.Foo]
conforms to
  ammonite.$sess.cmd2.Foo

on the face of it, I don't know why this type comparison would be made, i.e. there are no F-bounds in the library.

Here is the full crash:

@ EnumMirror[Foo].Exception in thread "main" java.lang.AssertionError: assertion failed: type error: enumextensions.EnumMirror[ammonite.$sess.cmd2.Foo] does not conform to ammonite.$sess.cmd2.FooI tried to show that
  enumextensions.EnumMirror[ammonite.$sess.cmd2.Foo]
conforms to
  ammonite.$sess.cmd2.Foo
but none of the attempts shown below succeeded:

  ==> enumextensions.EnumMirror[ammonite.$sess.cmd2.Foo]  <:  ammonite.$sess.cmd2.Foo  = false

The tests were made under the empty constraint
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1086)
	at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:860)
	at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:145)
	at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:900)
	at dotty.tools.dotc.typer.Implicits.inferView$(Implicits.scala:860)
	at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:145)
	at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:4551)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:4372)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4452)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4682)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3954)
	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:534)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:996)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:996)
	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:688)
	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:752)
	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:574)
	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:878)
	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:995)
	at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1257)
	at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:434)
	at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:145)
	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1068)
	at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$2(Applications.scala:1178)
	at dotty.tools.dotc.typer.Typer$.tryEither(Typer.scala:118)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1193)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1231)
	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:434)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:145)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3414)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3499)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3576)
	at dotty.tools.dotc.typer.Applications.extMethodApply(Applications.scala:2591)
	at dotty.tools.dotc.typer.Applications.extMethodApply$(Applications.scala:434)
	at dotty.tools.dotc.typer.Typer.extMethodApply(Typer.scala:145)
	at dotty.tools.dotc.typer.Applications.tryApplyingExtensionMethod(Applications.scala:2636)
	at dotty.tools.dotc.typer.Applications.tryApplyingExtensionMethod$(Applications.scala:434)
	at dotty.tools.dotc.typer.Typer.tryApplyingExtensionMethod(Typer.scala:145)
	at dotty.tools.dotc.interactive.Completion$Completer.tryApplyingReceiverToExtension$1(Completion.scala:526)
	at dotty.tools.dotc.interactive.Completion$Completer.$anonfun$23(Completion.scala:569)
	at scala.collection.immutable.List.flatMap(List.scala:294)
	at scala.collection.immutable.List.flatMap(List.scala:79)
	at dotty.tools.dotc.interactive.Completion$Completer.extensionCompletions(Completion.scala:566)
	at dotty.tools.dotc.interactive.Completion$Completer.selectionCompletions(Completion.scala:446)
	at dotty.ammonite.compiler.AmmCompletion$.computeCompletions(AmmCompletion.scala:44)
	at dotty.ammonite.compiler.AmmCompletion$.completions(AmmCompletion.scala:26)
	at ammonite.compiler.Compiler.complete(Compiler.scala:392)
	at ammonite.compiler.CompilerLifecycleManager.complete(CompilerLifecycleManager.scala:112)
	at ammonite.repl.Repl.action$$anonfun$2$$anonfun$2$$anonfun$1(Repl.scala:199)
	at ammonite.repl.Repl.action$$anonfun$2$$anonfun$2$$anonfun$adapted$1(Repl.scala:199)
	at ammonite.repl.AmmoniteFrontEnd.$anonfun$3(AmmoniteFrontEnd.scala:57)
	at ammonite.terminal.TTY$.withSttyOverride(Utils.scala:120)
	at ammonite.repl.AmmoniteFrontEnd.$anonfun$1(AmmoniteFrontEnd.scala:58)
	at ammonite.terminal.Filter$$anon$3$$anon$4.applyOrElse(Filter.scala:71)
	at ammonite.terminal.Filter$$anon$3$$anon$4.applyOrElse(Filter.scala:71)
	at scala.collection.IterableOnceOps.collectFirst(IterableOnce.scala:1256)
	at scala.collection.IterableOnceOps.collectFirst$(IterableOnce.scala:1248)
	at scala.collection.AbstractIterator.collectFirst(Iterator.scala:1303)
	at ammonite.terminal.Filter$$anon$3.op(Filter.scala:71)
	at ammonite.terminal.Filter$.ammonite$terminal$Filter$$anon$7$$_$op$$anonfun$3(Filter.scala:92)
	at scala.collection.Iterator$$anon$9.next(Iterator.scala:584)
	at scala.collection.IterableOnceOps.find(IterableOnce.scala:677)
	at scala.collection.IterableOnceOps.find$(IterableOnce.scala:674)
	at scala.collection.AbstractIterator.find(Iterator.scala:1303)
	at ammonite.terminal.Filter$$anon$7.op(Filter.scala:92)
	at ammonite.terminal.LineReader.readChar(LineReader.scala:155)
	at ammonite.terminal.Terminal$.readLine$$anonfun$2(Terminal.scala:36)
	at ammonite.terminal.TTY$.withSttyOverride(Utils.scala:120)
	at ammonite.terminal.Terminal$.readLine(Terminal.scala:38)
	at ammonite.repl.AmmoniteFrontEnd.readLine(AmmoniteFrontEnd.scala:137)
	at ammonite.repl.AmmoniteFrontEnd.action(AmmoniteFrontEnd.scala:30)
	at ammonite.repl.Repl.action$$anonfun$2$$anonfun$2(Repl.scala:201)
	at ammonite.repl.Scoped.flatMap$$anonfun$1(Signaller.scala:45)
	at ammonite.repl.Signaller.apply(Signaller.scala:28)
	at ammonite.repl.Scoped.flatMap(Signaller.scala:45)
	at ammonite.repl.Scoped.flatMap$(Signaller.scala:42)
	at ammonite.repl.Signaller.flatMap(Signaller.scala:16)
	at ammonite.repl.Repl.action$$anonfun$2(Repl.scala:185)
	at ammonite.util.Res$Success.flatMap(Res.scala:58)
	at ammonite.repl.Repl.action(Repl.scala:175)
	at ammonite.repl.Repl.loop$1(Repl.scala:218)
	at ammonite.repl.Repl.run(Repl.scala:233)
	at ammonite.Main.run(Main.scala:249)
	at ammonite.MainRunner.runRepl$$anonfun$1(MainRunner.scala:76)
	at ammonite.MainRunner.watchLoop(MainRunner.scala:57)
	at ammonite.MainRunner.runRepl(MainRunner.scala:76)
	at ammonite.AmmoniteMain$.main0(AmmoniteMain.scala:98)
	at ammonite.AmmoniteMain$.main(AmmoniteMain.scala:31)
	at ammonite.AmmoniteMain.main(AmmoniteMain.scala)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at coursier.bootstrap.launcher.a.a(Unknown Source)
	at coursier.bootstrap.launcher.Launcher.main(Unknown Source)
@kiendang kiendang linked a pull request Nov 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant