Skip to content
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

Missing error on synchronized from value class #17493

Closed
som-snytt opened this issue May 14, 2023 · 2 comments · Fixed by #20312
Closed

Missing error on synchronized from value class #17493

som-snytt opened this issue May 14, 2023 · 2 comments · Fixed by #20312
Assignees
Labels
exp:novice itype:bug Spree Suitable for a future Spree
Milestone

Comments

@som-snytt
Copy link
Contributor

Compiler version

Scala compiler version 3.3.1-RC1-bin-SNAPSHOT-git-4cb6ee6

Minimized code

class A(val s: String) extends AnyVal {
  //def f = eq("hello, world")  // missing argument list for method eq in object Predef

  def g = synchronized { println("hello, world") }
}

Output

g does not compile in Scala 2, but in Scala 3 is accepted, as though written A.synchronized.

The error on f is charming. I was expecting it to use (Predef: AnyRef).eq and was hoping for a warning.

Expectation

Error on synchronized. Warnings for accidental selections from Predef, as for top-level defs.

@som-snytt som-snytt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 14, 2023
@nicolasstucki nicolasstucki removed the stat:needs triage Every issue needs to have an "area" and "itype" label label May 15, 2023
@mbovel
Copy link
Member

mbovel commented Apr 26, 2024

Related previous PRs: #17449 #18021.

@mbovel mbovel added exp:novice Spree Suitable for a future Spree labels Apr 26, 2024
@mbovel
Copy link
Member

mbovel commented Apr 26, 2024

This issue was picked for the Scala Issue Spree of April 30th. @EugeneFlesselle, @mbovel and @nox213 will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

odersky added a commit that referenced this issue May 1, 2024
)

751cc2f is a more direct way to fix
#17493 than #20301.

7a9102a further generalizes
`checkAnyRefMethodCall`, as suggested by @odersky.
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp:novice itype:bug Spree Suitable for a future Spree
Projects
None yet
4 participants