Skip to content

Empty package object #10927

@som-snytt

Description

@som-snytt

If I create a package object in the empty package:

object `package` {
  implicit class sss(s: String) {
    def d: Double = s.toDouble
  }
}

then I have to import its members explicitly:

import `package`._

package x {
  object X { def f = "3.14".d }
}

If the empty package is allowed to have a package object, then the workaround also bends the rule that members of the empty package cannot be imported.

Edit: obviously this is more interesting if they're importing in a named package. Also, same behavior on dotty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)package objects

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions