diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t3871.check | 7 | ||||
-rw-r--r-- | test/files/neg/t3871.scala | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/files/neg/t3871.check b/test/files/neg/t3871.check new file mode 100644 index 0000000000..b920357ee6 --- /dev/null +++ b/test/files/neg/t3871.check @@ -0,0 +1,7 @@ +t3871.scala:4: error: variable foo in class Sub2 cannot be accessed in Sub2 + Access to protected method foo not permitted because + enclosing class Base is not a subclass of + class Sub2 where target is defined + s.foo = true + ^ +one error found diff --git a/test/files/neg/t3871.scala b/test/files/neg/t3871.scala new file mode 100644 index 0000000000..fc459867df --- /dev/null +++ b/test/files/neg/t3871.scala @@ -0,0 +1,11 @@ +class Base { + def mkNew() = { + val s = new Sub2 + s.foo = true + s + } +} + +class Sub2 extends Base { + protected var foo = false +} |