question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Completion on self type crashes Dotty IDE

See original GitHub issue

Steps:

  1. launchIDE
  2. Open a file, NameBuffer.scala for instance.
  3. Add a new class before class NameBuffer:
    class MyClass { self => }
    
  4. Change it to:
    class MyClass { self: M => }
    
  5. As soon as the M is typed, the following stack trace appears:
[Error - 10:24:04 AM] Request textDocument/completion failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.AssertionError: assertion failed
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:604)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
	at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.AssertionError: assertion failed
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:35)
	at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:350)
	at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:335)
	at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:335)
	at dotty.tools.dotc.interactive.Interactive$.completions(Interactive.scala:103)
	at dotty.tools.languageserver.DottyLanguageServer.completion$$anonfun$1(DottyLanguageServer.scala:232)
	at dotty.tools.languageserver.DottyLanguageServer.liftedTree1$1(DottyLanguageServer.scala:139)
	at dotty.tools.languageserver.DottyLanguageServer.computeAsync$$anonfun$1(DottyLanguageServer.scala:144)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
	... 6 more

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Duhemmcommented, Aug 30, 2018

This test reproduces the crash:

  @Test def completeSelfType: Unit = {
    code"""class Foo { self: Fo${m1} => }""".withSource
      .completion(m1, Set(("Foo", CompletionItemKind.Class, "Object{...}")))
  }

To be pasted in language-server/test/dotty/tools/languageserver/CompletionTest.scala, and run with:

sbt:dotty> dotty-language-server/testOnly dotty.tools.languageserver.CompletionTest -- --tests=completeSelfType
[info] Compiling 1 Scala source to /Users/martin/Documents/Projects.nosync/Duhemm/dotty/language-server/../out/bootstrap/dotty-language-server/scala-0.10/test-classes ...
[info] Done compiling.
[info] Test dotty.tools.languageserver.CompletionTest.completion0 ignored
[info] Test dotty.tools.languageserver.CompletionTest.completionWithImplicitConversion ignored
[info] Test run started
[info] Test dotty.tools.languageserver.CompletionTest.completeSelfType started
java.lang.AssertionError: assertion failed
        at dotty.DottyPredef$.assertFail(DottyPredef.scala:37)
        at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:350)
        at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:335)
        at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:335)
        at dotty.tools.dotc.interactive.Interactive$.completions(Interactive.scala:103)
        at dotty.tools.languageserver.DottyLanguageServer.completion$$anonfun$1(DottyLanguageServer.scala:232)
        at dotty.tools.languageserver.DottyLanguageServer.liftedTree1$1(DottyLanguageServer.scala:139)
        at dotty.tools.languageserver.DottyLanguageServer.computeAsync$$anonfun$1(DottyLanguageServer.scala:144)
        at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
        at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
        at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[error] Test dotty.tools.languageserver.CompletionTest.completeSelfType failed: java.util.concurrent.ExecutionException: java.lang.AssertionError: assertion failed, took 1.857 sec
[error]     at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
[error]     at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
[error]     at dotty.tools.languageserver.util.actions.CodeCompletion.execute$direct(CodeCompletion.scala:23)
[error]     at dotty.tools.languageserver.util.CodeTester.doAction(CodeTester.scala:121)
[error]     at dotty.tools.languageserver.util.CodeTester.completion(CodeTester.scala:80)
[error]     at dotty.tools.languageserver.CompletionTest.completeSelfType(CompletionTest.scala:25)
[error]     ...
[error] Caused by: java.lang.AssertionError: assertion failed
[error]     at dotty.DottyPredef$.assertFail(DottyPredef.scala:37)
[error]     at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:350)
[error]     at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:335)
[error]     at dotty.tools.dotc.interactive.Interactive$.contextOfPath(Interactive.scala:335)
[error]     at dotty.tools.dotc.interactive.Interactive$.completions(Interactive.scala:103)
[error]     at dotty.tools.languageserver.DottyLanguageServer.completion$$anonfun$1(DottyLanguageServer.scala:232)
[error]     at dotty.tools.languageserver.DottyLanguageServer.liftedTree1$1(DottyLanguageServer.scala:139)
[error]     at dotty.tools.languageserver.DottyLanguageServer.computeAsync$$anonfun$1(DottyLanguageServer.scala:144)
[error]     at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
[error]     at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
[error]     at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
[error]     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
[error]     at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
[error]     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
[error]     at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[info] Test run finished: 1 failed, 0 ignored, 1 total, 1.863s
[error] Failed: Total 3, Failed 1, Errors 0, Passed 0, Skipped 2
[error] Failed tests:
[error]         dotty.tools.languageserver.CompletionTest
[error] (dotty-language-server / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 3 s, completed Aug 30, 2018 1:35:23 PM
0reactions
Duhemmcommented, Aug 30, 2018

I can still reliably reproduce on current HEAD: 1d24eaaeff847b8b67fa914b56a8005c8cf4a094

Read more comments on GitHub >

github_iconTop Results From Across the Web

VS Code: CompletionException caused by AssertionError #4836
VS Code: CompletionException caused by AssertionError #4836 ... Completion on self type crashes Dotty IDE #4646.
Read more >
ACCIDENT REGISTER
ACCIDENT REGISTER. FROM. , 20____ TO. , 20____. Date & Hour of Accident. Location of Accident. No. of. Deaths. No. of. Non-Fatal. Injuries....
Read more >
Crash Analysis Toolbox
https://clear.dot.ny.gov/clear/cdv/; CLEAR Interactive Crash Editor (ICE) ... tables contain accident rates for State Highways, based on facility type and ...
Read more >
User Manual - rust-analyzer
If rust-analyzer outright crashes, try running rust-analyzer analysis-stats /path/to/project/directory/ on the command line. This command type checks the ...
Read more >
Modern IDEs are magic. Why are so many coders still using ...
While an IDE is some weird new food with all kinds of exotic ... With code completion, Git control, and even automatic deployment...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found