Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle TypeApply(fun, ...) for symbol-less funs

Such as class literals, as one could conjure in `classOf[Int][Int]`

Before, this would crash with a `NullPointerException`
  • Loading branch information...
commit 33a086b97a5a7763acbf70e42edadace4d4cff95 1 parent c243435
@retronym retronym authored
2  src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -5051,7 +5051,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
// @M: fun is typed in TAPPmode because it is being applied to its actual type parameters
val fun1 = typed(fun, mode.forFunMode | TAPPmode)
- val tparams = fun1.symbol.typeParams
+ val tparams = if (fun1.symbol == null) Nil else fun1.symbol.typeParams
//@M TODO: val undets_fun = context.undetparams ?
// "do args first" (by restoring the context.undetparams) in order to maintain context.undetparams on the function side.
4 test/files/neg/class-of-double-targs.check
@@ -0,0 +1,4 @@
+class-of-double-targs.scala:2: error: expression of type Class[Int](classOf[scala.Int]) does not take type parameters.
+ classOf[Int][Int]
+ ^
+one error found
3  test/files/neg/class-of-double-targs.scala
@@ -0,0 +1,3 @@
+object Test {
+ classOf[Int][Int]
Please sign in to comment.
Something went wrong with that request. Please try again.