Skip to content

[Modules] Questionable snippet in “Scoped Imports” spec #23520

Description

@0xEAB
void main()
{
    void writeln(string) {}
    void foo()
    {
        writeln("bar"); // calls main.writeln
        import std.stdio;
        writeln("bar"); // calls std.stdio.writeln        ← HOW SO!?
        void writeln(string) {}
        writeln("bar"); // calls main.foo.writeln
    }
    writeln("bar"); // calls main.writeln
    std.stdio.writeln("bar");  // error, std is undefined
}

Discovered by a someone on Discord:
https://discord.com/channels/242094594181955585/242122752436338688/1533984975735755013

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions