Skip to content

Missing error on synchronized from value class #17493

Closed
@som-snytt

Description

@som-snytt

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions