8000 Fail compilation if multiple conflicting top-level private defs/vals are in the same package by jchyb · Pull Request #22759 · scala/scala3 · GitHub
[go: up one dir, main page]

Skip to content

Fail compilation if multiple conflicting top-level private defs/vals are in the same package #22759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Adjust test case
  • Loading branch information
jchyb committed Mar 13, 2025
commit db2eb1925dd13c5982f39e154e4c37f607f657b3
10 changes: 6 additions & 4 deletions tests/neg/i22721.check
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
-- [E161] Naming Error: tests/neg/i22721/test2.scala:3:4 ---------------------------------------------------------------
3 |val foobar: Int = 0 // error
|^^^^^^^^^^^^^^^^^^^
|foobar is already defined as value foobar in tests/neg/i22721/test1.scala
-- [E161] Naming Error: tests/neg/i22721/test2.scala:3:12 --------------------------------------------------------------
3 |private def foobar: Int = 0 // error
|^^^^^^^^^^^^^^^^^^^^^^^^^^^
|foobar is already defined as method foobar in tests/neg/i22721/test1.scala
|
|Note that overloaded methods must all be defined in the same group of toplevel definitions
2 changes: 1 addition & 1 deletion tests/neg/toplevel-overload/moredefs_1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ trait B

def f(x: B) = s"B" // error: has already been compiled

private def g(): Unit = () // OK, since it is private
private def g(): Unit = () // error: has already been compiled (def is visible in package)
Loading
0