Skip to content

Ambiguous names in imports aren't refused #179

Open

Description

@Kinflou

Three ways a name means two things, all of which build:

An import shadowing a local declaration:

use types::S       // types.ids also declares S
struct S {
    a: u8
}

Two glob imports exporting the same name, then using it:

use one::*         // declares T
use two::*         // also declares T
struct R {
    t: T
}

A dependency with the same name as one of the package's own schemas:

dependencies = {
    api = { path = "dep" }     # the package also has src/api.ids
}
use api::S

This last one builds, and logs an internal warning, Symbol 'S' not found, leaving unclear which api::S was used.

Fix: an error for each ambiguity, naming both sources: an import that clashes with a local name; a name two glob imports provide, where it's used; a dependency key equal to an own schema's name.

Found on core master (a8aee68).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2SoonbugSomething isn't workingcompilerParser, IR, CAS

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions