Skip to content

Function lookup fails when two same-named but aliased modules are imported #10202

Description

@jrrrp

The following, using basic-cli and roc-random

app [main!] { 
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.21.0-rc4/FvCh4vdqm3nBY6DWEfZ8RuGCVfjuMY43HA8KSNk9qVDn.tar.zst",
    random: "https://github.com/kili-ilo/roc-random/releases/download/0.7.0/2LdxsJEfiBKwTBZc8SF1SidGC68wKCvfAwVREwWKwZu7.tar.zst"
}

import pf.Random as PfR
import random.Random

main! = |_| {
    gen = Random.seed(PfR.seed_u32!()?)

    Ok({})
}

errors with

┌────────────────┐
│ DOES NOT EXIST ├─ random.Random.seed does not exist. ────────────────────┐
└┬───────────────┘                                                         │
 │                                                                         │
 │  gen = Random.seed(PfR.seed_u32!()?)                                    │
 │        ‾‾‾‾‾‾‾‾‾‾‾                                                      │
 └─────────────────────────── .../roc/random/main.roc:10:11 ┘

    random.Random is in scope, but it has no associated seed.

If the order of the imports is swapped, the error display that PfR.seed_u32! does not exist. Aliasing both or just one of the modules has no effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions