Skip to content

content of modules with name ending by $package are always accessible #24535

@hamzaremmal

Description

@hamzaremmal

Compiler version

d5fec8f

Minimized code

object $package:
    def foo(x: Int): Unit = ???

object Foo:
    val x = foo(1)

Output

Compiles

Expectation

It should not compile. At no point did I import the content of $package so that I can use it without the qualifier.

Notes

This probably has to do with the logic to handle top-level definitions since this the desugared version of:

def foo(x: Int): Unit = ???

object Foo:
    val x = foo(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions