This snippet fails with a NPE as expected:
class A {
class B // 1
}
val a: A = null
val b = new a.B // 2
The position that the stack trace points to, however, is (1), not (2) as one would expect when dereferencing a def or a val. This is not helped by not giving an error message that would make this situation clearer (e.g. "Cannot instantiate inner class where outer is null").
See slick/slick#722 for a motivating example.