-
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.
Explain accessible scope of private members in error message
Fixes #18686
- Loading branch information
1 parent
8aec15b
commit 899dc46
Showing
7 changed files
with
48 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
-- [E173] Reference Error: tests/neg/i18686.scala:9:16 ----------------------------------------------------------------- | ||
9 | println(Foo.Bar1) // error | ||
| ^^^^^^^^ | ||
| value Bar1 cannot be accessed as a member of Foo.type from object Main. | ||
-- [E173] Reference Error: tests/neg/i18686.scala:10:16 ---------------------------------------------------------------- | ||
10 | println(Foo.Bar2) // error | ||
-- [E173] Reference Error: tests/neg/i18686.scala:11:16 ---------------------------------------------------------------- | ||
11 | println(Foo.Bar1) // error | ||
| ^^^^^^^^ | ||
| value Bar1 cannot be accessed as a member of Foo.type from object Main. | ||
| private value Bar1 can only be accessed from object Foo. | ||
-- [E173] Reference Error: tests/neg/i18686.scala:12:16 ---------------------------------------------------------------- | ||
12 | println(Foo.Bar2) // error | ||
| ^^^^^^^^ | ||
| value Bar2 cannot be accessed as a member of Foo.type from object Main. | ||
-- [E173] Reference Error: tests/neg/i18686.scala:11:16 ---------------------------------------------------------------- | ||
11 | println(Foo.Bar3) // error | ||
| private[Foo] value Bar2 can only be accessed from object Foo. | ||
-- [E173] Reference Error: tests/neg/i18686.scala:13:16 ---------------------------------------------------------------- | ||
13 | println(Foo.Bar3) // error | ||
| ^^^^^^^^ | ||
| value Bar3 cannot be accessed as a member of Foo.type from object Main. | ||
| Protected value Bar3 can only be accessed from object Foo. | ||
| protected value Bar3 can only be accessed from object Foo. | ||
-- [E173] Reference Error: tests/neg/i18686.scala:14:20 ---------------------------------------------------------------- | ||
14 | println(Foo.Baz.Bar4) // error | ||
| ^^^^^^^^^^^^ | ||
| value Bar4 cannot be accessed as a member of Foo.Baz.type from object Main. | ||
| private[Foo] value Bar4 can only be accessed from object Foo. |
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,13 +1,16 @@ | ||
object Foo: | ||
private val Bar1: Int = 3 | ||
private[Foo] val Bar2: Int = 3 | ||
private val Bar1: Int = 1 | ||
private[Foo] val Bar2: Int = 2 | ||
protected val Bar3: Int = 3 | ||
object Baz: | ||
private[Foo] val Bar4: Int = 4 | ||
end Foo | ||
|
||
object Main: | ||
def main(args: Array[String]): Unit = | ||
println(Foo.Bar1) // error | ||
println(Foo.Bar2) // error | ||
println(Foo.Bar3) // error | ||
println(Foo.Baz.Bar4) // error | ||
end main | ||
end Main |
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