Skip to content
This repository was archived by the owner on Jun 5, 2023. It is now read-only.
This repository was archived by the owner on Jun 5, 2023. It is now read-only.

Several imports of the same name should form an overloaded definition #143

@rjolly

Description

@rjolly

Minimized code + Output

object A:
  def f(s: Int) = s

object B:
  def f(s: String) = s

import A.f
import B.f

println(f(1))
        ^
        Reference to f is ambiguous,
        it is both imported by name by import A.f
        and imported by name subsequently by import B.f

Expectation

The compiler should behave the same as in the code below, that is, as if the definitions above is overloaded.

object C:
  def f(s: Int) = s
  def f(s: String) = s

import C.f

println(f(1))
//1

See https://docs.oracle.com/javase/specs/jls/se15/html/jls-15.html#jls-15.12.1 for how member methods that are imported by static-import declarations are processed in Java.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions