Skip to content

Incremental compiler does not account for top level definition conflicts #22804

Open
@jchyb

Description

@jchyb

Compiler version

any

Minimized code

Split across 2 files:
A.scala:

package test

object A
// def a() = ??? // [1]

B.scala

package test

object B
def a() = ???

scalac will not show the issue - use scalacli with a build server (or another built tool):

  1. scala-cli A.scala B.scala
  2. uncomment [1]
  3. scala-cli A.scala B.scala

Output

no error, successful compilation

Expectation

Same error as when initially compiling A.scala and B.scala with uncommented [1], where we get:

[error] ./B.scala:4:1
[error] a is already defined as method a in /Users/jchyb/workspace/scala3/A.scala
[error] 
[error] Note that overloaded methods must all be defined in the same group of toplevel definitions
[error] def a() = ???
[error] ^^^^^^^^^^^^^

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