Skip to content

Commit ea9e4ec

Browse files
oderskygkossakowski
authored andcommitted
Fixed problem in SI-6408
Fixed problem reported in comment, where inner classes of value classe caused a compiler crash.
1 parent ef93449 commit ea9e4ec

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/compiler/scala/tools/nsc/transform/Constructors.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ abstract class Constructors extends Transform with ast.TreeDSL {
127127
import CODE._
128128
val result = mkAssign(to, Ident(from))
129129

130-
if (from.name != nme.OUTER) result
130+
if (from.name != nme.OUTER ||
131+
from.tpe.typeSymbol.isPrimitiveValueClass) result
131132
else localTyper.typedPos(to.pos) {
132133
IF (from OBJ_EQ NULL) THEN Throw(NullPointerExceptionClass.tpe) ELSE result
133134
}

test/files/run/t6408.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class X(val i: Int) extends AnyVal {
2+
class Inner(val q: Int) {
3+
def plus = i + q
4+
}
5+
}
6+
7+
object Test extends App {
8+
val x = new X(11)
9+
val i = new x.Inner(22)
10+
assert(i.plus == 33)
11+
}

0 commit comments

Comments
 (0)