diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2016-11-16 21:57:19 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-11-22 01:35:08 +0100 |
commit | ce23380cbcec633cba63f19bc8f02c1d2b8048bb (patch) | |
tree | df1a365afb9491be4d817c70d80dc7b5cf0e2036 /tests/pos/leaks.scala | |
parent | 19c4c24f884b8e7245ffdd26fbb573761703496a (diff) | |
download | dotty-ce23380cbcec633cba63f19bc8f02c1d2b8048bb.tar.gz dotty-ce23380cbcec633cba63f19bc8f02c1d2b8048bb.tar.bz2 dotty-ce23380cbcec633cba63f19bc8f02c1d2b8048bb.zip |
checkNoPrivateLeaks: handle references to companion members
Previously Outer2#Inner#foo failed to compile with:
```
non-private method foo refers to private value x in its type signature
```
This should compile because the boundary of `foo` is `class Outer2`
and the boundary of `x` is `object Outer2`. This commit fixes this by
also considering the linked boundary in `checkNoPrivateLeaks`.
Diffstat (limited to 'tests/pos/leaks.scala')
-rw-r--r-- | tests/pos/leaks.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/pos/leaks.scala b/tests/pos/leaks.scala new file mode 100644 index 000000000..dbb47d75a --- /dev/null +++ b/tests/pos/leaks.scala @@ -0,0 +1,17 @@ +class Outer1 { + private val x: Int = 1 + + private class Inner { + def foo: x.type = x // OK + } +} + +object Outer2 { + private val x: Int = 1 +} + +class Outer2 { + private class Inner { + def foo: Outer2.x.type = Outer2.x // OK + } +} |