Permalink
Browse files

SI-7015 Cleanup from review of null duplication

Based on feedback on #2147

* Assertion in GenICode#adaptNullRef reports the erroneous type
* Test makes the Null type explicit for greater clarity
  • Loading branch information...
1 parent 1b6661b commit 62fcd3d922056407703ac3363b897f82980b0926 @JamesIry JamesIry committed Feb 22, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
  2. +1 −1 test/files/run/t7015.scala
View
2 src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -1025,7 +1025,7 @@ abstract class GenICode extends SubComponent {
// this value into a local of type Null and we want the JVM to see that it's
// a null value so we don't have to also adapt local loads.
if (from == NullReference && to != UNIT && to != ObjectReference && to != AnyRefReference) {
- assert(to.isReferenceType, "Attempt to adapt a null to a non reference type")
+ assert(to.isReferenceType, "Attempt to adapt a null to a non reference type $to.")
// adapt by dropping what we've got and pushing a null which
// will convince the JVM we really do have null
ctx.bb.emit(DROP(from), pos)
View
2 test/files/run/t7015.scala
@@ -24,7 +24,7 @@ object Test {
println(s"method that takes any: ${s(f)}")
}
- def f = null
+ def f: Null = null
def g(x: String) = x

0 comments on commit 62fcd3d

Please sign in to comment.