-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message for inaccessible types (#18406)
* If accessed from an object: ```diff - from module class B$ + from object B ``` * If accessed from a package: ```diff - from module class <filename>$package$ + from top-level definition in package foo ```
- Loading branch information
Showing
9 changed files
with
74 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
-- [E008] Not Found Error: tests/neg/i12573.scala:23:38 ---------------------------------------------------------------- | ||
23 |val w: Value[8] = DFBits(Value[8](8)).getDFType.width // error | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| value getDFType is not a member of DFBits[(8 : Int)]. | ||
| Extension methods were tried, but the search failed with: | ||
|value getDFType is not a member of DFBits[(8 : Int)]. | ||
|Extension methods were tried, but the search failed with: | ||
| | ||
| method getDFType cannot be accessed as a member of DFType.type from module class i12573$package$. | ||
| Access to protected method getDFType not permitted because enclosing package object i12573$package | ||
| is not a subclass of object DFType where target is defined | ||
| method getDFType cannot be accessed as a member of DFType.type from the top-level definitions in package <empty>. | ||
| Protected method getDFType can only be accessed from object DFType. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- [E173] Reference Error: tests/neg/not-accessible.scala:8:23 --------------------------------------------------------- | ||
8 | def test(a: A) = a.x // error | ||
| ^^^ | ||
| value x cannot be accessed as a member of (a : foo.A) from class B. | ||
-- [E173] Reference Error: tests/neg/not-accessible.scala:10:23 -------------------------------------------------------- | ||
10 | def test(a: A) = a.x // error | ||
| ^^^ | ||
| value x cannot be accessed as a member of (a : foo.A) from object B. | ||
-- [E173] Reference Error: tests/neg/not-accessible.scala:13:23 -------------------------------------------------------- | ||
13 | def test(a: A) = a.x // error | ||
| ^^^ | ||
| value x cannot be accessed as a member of (a : foo.A) from the top-level definitions in package bar. | ||
-- [E173] Reference Error: tests/neg/not-accessible.scala:5:21 --------------------------------------------------------- | ||
5 | def test(a: A) = a.x // error | ||
| ^^^ | ||
| value x cannot be accessed as a member of (a : foo.A) from the top-level definitions in package foo. | ||
-- [E173] Reference Error: tests/neg/not-accessible.scala:15:23 -------------------------------------------------------- | ||
15 |def test(a: foo.A) = a.x // error | ||
| ^^^ | ||
| value x cannot be accessed as a member of (a : foo.A) from the top-level definitions in package <empty>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package foo: | ||
|
||
class A(private[A] val x: Int) | ||
|
||
def test(a: A) = a.x // error | ||
|
||
class B: | ||
def test(a: A) = a.x // error | ||
object B: | ||
def test(a: A) = a.x // error | ||
|
||
package bar: | ||
def test(a: A) = a.x // error | ||
|
||
def test(a: foo.A) = a.x // error |