Skip to content

False negative for duplicated private top-level definitions in multiple files #22884

Closed as not planned
@WojciechMazur

Description

@WojciechMazur

Based on OpenCB failure in theiterators/kebs - build logs

Compiler version

Last good release: 3.7.1-RC1-bin-20250316-28072c5-NIGHTLY
First bad release: 3.7.1-RC1-bin-20250317-744ba92-NIGHTLY

Bisect points to either 28072c5 or 744ba92

Minimized code

// test.scala
inline private def widen[A, B](a: A): A & B =
  inline a match {
    case b: B => b
  }
// test2.scala
inline private def widen[A, B](a: A): A & B =
  inline a match {
    case b: B => b
  }

Output

[error] ./test2.scala:1:1
[error] widen is already defined as method widen in /Users/wmazur/projects/scala/sandbox/test.scala
[error] 
[error] Note that overloaded methods must all be defined in the same group of toplevel definitions

Expectation

It should allow to define 2 private inline methods in 2 different files.
These are produced to 2 different classfiles:

-rw-r--r--  1 wmazur  staff  572 Mar 28 15:58 test$package$.class
-rw-r--r--  1 wmazur  staff  142 Mar 28 15:58 test$package.class
-rw-r--r--  1 wmazur  staff  684 Mar 28 15:58 test$package.tasty
-rw-r--r--  1 wmazur  staff  575 Mar 28 15:58 test2$package$.class
-rw-r--r--  1 wmazur  staff  144 Mar 28 15:58 test2$package.class
-rw-r--r--  1 wmazur  staff  686 Mar 28 15:58 test2$package.tasty

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions