Skip to content

RPPL crashes on fresh names #7694

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
nicolasstucki opened this issue Dec 6, 2019 · 1 comment
Closed

RPPL crashes on fresh names #7694

nicolasstucki opened this issue Dec 6, 2019 · 1 comment

Comments

@nicolasstucki
Copy link
Contributor

minimized code

scala> def g[C[_

This issue was introduced in #7620. The problem is that there is no compilation unit set when parsing in the highlighter of the REPL.

Stack trace
cala> def g[C[Exception in thread "main" java.lang.NullPointerException
        at dotty.tools.dotc.core.NameKinds$UniqueNameKind.fresh(NameKinds.scala:218)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParam$1(Parsers.scala:2744)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$2$$anonfun$1(Parsers.scala:2752)
        at dotty.tools.dotc.parsing.Parsers$Parser.tokenSeparated(Parsers.scala:586)
        at dotty.tools.dotc.parsing.Parsers$Parser.commaSeparated(Parsers.scala:594)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$1(Parsers.scala:2752)
        at dotty.tools.dotc.parsing.Parsers$Parser.enclosed(Parsers.scala:554)
        at dotty.tools.dotc.parsing.Parsers$Parser.inBrackets(Parsers.scala:563)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause(Parsers.scala:2753)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClauseOpt(Parsers.scala:2756)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParam$1(Parsers.scala:2747)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$2$$anonfun$1(Parsers.scala:2752)
        at dotty.tools.dotc.parsing.Parsers$Parser.tokenSeparated(Parsers.scala:586)
        at dotty.tools.dotc.parsing.Parsers$Parser.commaSeparated(Parsers.scala:594)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$1(Parsers.scala:2752)
        at dotty.tools.dotc.parsing.Parsers$Parser.enclosed(Parsers.scala:554)
        at dotty.tools.dotc.parsing.Parsers$Parser.inBrackets(Parsers.scala:563)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause(Parsers.scala:2753)
        at dotty.tools.dotc.parsing.Parsers$Parser.defDefOrDcl(Parsers.scala:3137)
        at dotty.tools.dotc.parsing.Parsers$Parser.defOrDcl(Parsers.scala:3024)
        at dotty.tools.dotc.parsing.Parsers$Parser.localDef(Parsers.scala:3704)
        at dotty.tools.dotc.parsing.Parsers$Parser.blockStatSeq$$anonfun$1(Parsers.scala:3726)
        at dotty.tools.dotc.parsing.Parsers$Parser.checkNoEscapingPlaceholders(Parsers.scala:495)
        at dotty.tools.dotc.parsing.Parsers$Parser.blockStatSeq(Parsers.scala:3734)
        at dotty.tools.dotc.printing.SyntaxHighlighting$.highlight(SyntaxHighlighting.scala:122)
        at dotty.tools.repl.JLineTerminal$Highlighter.highlight(JLineTerminal.scala:76)
        at org.jline.reader.impl.LineReaderImpl.getHighlightedBuffer(LineReaderImpl.java:3633)
        at org.jline.reader.impl.LineReaderImpl.getDisplayedBufferWithPrompts(LineReaderImpl.java:3615)
        at org.jline.reader.impl.LineReaderImpl.redisplay(LineReaderImpl.java:3554)
        at org.jline.reader.impl.LineReaderImpl.doCleanup(LineReaderImpl.java:2340)
        at org.jline.reader.impl.LineReaderImpl.cleanup(LineReaderImpl.java:2332)
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:626)
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:404)
        at dotty.tools.repl.JLineTerminal.readLine(JLineTerminal.scala:68)
        at dotty.tools.repl.ReplDriver.readLine$1(ReplDriver.scala:115)
        at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:125)
        at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:130)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:148)
        at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:130)
        at dotty.tools.repl.Main$.main(Main.scala:6)
        at dotty.tools.repl.Main.main(Main.scala)
@smarter
Copy link
Member

smarter commented Dec 6, 2019

Thanks for the repro, I pushed a fix as part of #7691

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