Skip to content

dotr crashes with NullPointerException processing a higher kinded type parameterized function #8548

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
landlockedsurfer opened this issue Mar 15, 2020 · 1 comment · Fixed by #8549

Comments

@landlockedsurfer
Copy link

Minimized code

Start dotr using version 0.22.0-RC1. Immediately enter the following function definition:

def foo[F[_],A](f:F[A]):F[A] = f

Crash output

$ dotr
Starting dotty REPL...
scala> def foo[F[_],A](f:F[A]):F[A] = f                                                                                                                                  
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:2864)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$2$$anonfun$1(Parsers.scala:2872)
        at dotty.tools.dotc.parsing.Parsers$Parser.tokenSeparated(Parsers.scala:601)
        at dotty.tools.dotc.parsing.Parsers$Parser.commaSeparated(Parsers.scala:609)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$1(Parsers.scala:2872)
        at dotty.tools.dotc.parsing.Parsers$Parser.enclosed(Parsers.scala:569)
        at dotty.tools.dotc.parsing.Parsers$Parser.inBrackets(Parsers.scala:578)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause(Parsers.scala:2873)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClauseOpt(Parsers.scala:2876)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParam$1(Parsers.scala:2867)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$2$$anonfun$1(Parsers.scala:2872)
        at dotty.tools.dotc.parsing.Parsers$Parser.tokenSeparated(Parsers.scala:601)
        at dotty.tools.dotc.parsing.Parsers$Parser.commaSeparated(Parsers.scala:609)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause$$anonfun$1(Parsers.scala:2872)
        at dotty.tools.dotc.parsing.Parsers$Parser.enclosed(Parsers.scala:569)
        at dotty.tools.dotc.parsing.Parsers$Parser.inBrackets(Parsers.scala:578)
        at dotty.tools.dotc.parsing.Parsers$Parser.typeParamClause(Parsers.scala:2873)
        at dotty.tools.dotc.parsing.Parsers$Parser.defDefOrDcl(Parsers.scala:3257)
        at dotty.tools.dotc.parsing.Parsers$Parser.defOrDcl(Parsers.scala:3140)
        at dotty.tools.dotc.parsing.Parsers$Parser.localDef(Parsers.scala:3838)
        at dotty.tools.dotc.parsing.Parsers$Parser.blockStatSeq$$anonfun$1(Parsers.scala:3860)
        at dotty.tools.dotc.parsing.Parsers$Parser.checkNoEscapingPlaceholders(Parsers.scala:510)
        at dotty.tools.dotc.parsing.Parsers$Parser.blockStatSeq(Parsers.scala:3868)
        at dotty.tools.repl.ParseResult$.parseStats(ParseResult.scala:113)
        at dotty.tools.repl.ParseResult$.isIncomplete$$anonfun$2(ParseResult.scala:165)
        at dotty.tools.dotc.reporting.Reporter.withIncompleteHandler(Reporter.scala:221)
        at dotty.tools.repl.ParseResult$.isIncomplete(ParseResult.scala:166)
        at dotty.tools.repl.JLineTerminal$Parser.acceptLine$1(JLineTerminal.scala:130)
        at dotty.tools.repl.JLineTerminal$Parser.parse(JLineTerminal.scala:134)
        at org.jline.reader.impl.LineReaderImpl.acceptLine(LineReaderImpl.java:2731)
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:585)
        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)

Note: I noticed that the crash does not happen when entering anything else into the REPL first. This initial input does not even have to compile.
E.g.:

$ dotr
Starting dotty REPL...
scala> a                                                                                                                                                                 
1 |a
  |^
  |Not found: a

scala> def foo[F[_],A](f:F[A]):F[A] = f
def foo[F[_$2], A](f: F[A]): F[A]

scala> foo(1)                                                                                                                                                            
val res0: Comparable[Integer] = 1

scala>                  
@hrhino
Copy link
Contributor

hrhino commented Mar 15, 2020

#7934? (#8221)

liufengyun added a commit to dotty-staging/dotty that referenced this issue Mar 15, 2020
nicolasstucki added a commit that referenced this issue Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants