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

Compiler crash with multiple param lists, defaults, erroneous argument to secondary param list. #6907

Closed
scabug opened this issue Jan 3, 2013 · 3 comments

Comments

@scabug
Copy link

scabug commented Jan 3, 2013

class M {
  def g[A](a: Any = null)(f: A) {}
}

trait I {
  def m: M = ???
}

class Test extends I {
  def g1[A](a: Any = null)(f: A) {}

  def foo(a: MissingType) {
    m.g(/* use default */)(a)
  }
}
error: 
     while compiling: <console>
        during phase: typer
     library version: version 2.10.0
    compiler version: version 2.10.0
  reconstructed args: -deprecation -classpath C:\Users\zgg\.sbt\boot\scala-2.10.0\lib\scala-compiler.jar;C:\Users\zgg\.sbt\boot\scala-2.10.0\lib\jansi.jar;C:\Users\zgg\.sbt\boot\scala-2.10.0\lib\jline.jar;C:\Users\zgg\.sbt\boot\scala-2.10.0\lib\scala-reflect.jar -unchecked -bootclasspath c:\tools\jdk1.6.0_25\jre\lib\resources.jar;c:\tools\jdk1.6.0_25\jre\lib\rt.jar;c:\tools\jdk1.6.0_25\jre\lib\sunrsasign.jar;c:\tools\jdk1.6.0_25\jre\lib\jsse.jar;c:\tools\jdk1.6.0_25\jre\lib\jce.jar;c:\tools\jdk1.6.0_25\jre\lib\charsets.jar;c:\tools\jdk1.6.0_25\jre\lib\modules\jdk.boot.jar;c:\tools\jdk1.6.0_25\jre\classes;C:\Users\zgg\.sbt\boot\scala-2.10.0\lib\scala-library.jar -Yrepl-sync

  last tree to typer: Ident(a)
              symbol: value a (flags: <param> <triedcooking>)
   symbol definition: a: <error>
                 tpe: <error>
       symbol owners: value a -> method foo -> class Test -> object $iw -> object $iw -> object $read -> package $line10
      context owners: method foo -> class Test -> object $iw -> object $iw -> object $read -> package $line10

== Expanded type of tree ==

<error>

uncaught exception during compilation: java.lang.NullPointerException
java.lang.NullPointerException
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1131)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5467)
	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5658)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2169)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5386)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
	at scala.collection.immutable.List.loop$1(List.scala:164)
	at scala.collection.immutable.List.mapConserve(List.scala:180)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2870)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1862)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1726)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5400)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1$$anon$2.typed(ReplGlobal.scala:29)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)

The example was distilled from typical Scala usage of Yammer's metrics library.

@scabug
Copy link
Author

scabug commented Jan 3, 2013

Imported From: https://issues.scala-lang.org/browse/SI-6907?orig=1
Reporter: @retronym
Assignee: @JamesIry
Affected Versions: 2.10.0-M6
Duplicates #6829

@scabug
Copy link
Author

scabug commented Jan 4, 2013

@JamesIry said:
Looks like a dup of #6829 which Paul fixed already

@scabug
Copy link
Author

scabug commented Jan 4, 2013

@JamesIry said:
Confirmed. Crashes under 2.10.0 final but gives proper "error: not found: type MissingType" using the current 2.10.x branch.

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

1 participant