gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
17.42k stars 723 forks source link

gleam run -m can run duplicate module from path dependency #2780

Open JohnBjrk opened 5 months ago

JohnBjrk commented 5 months ago

Create two projects with gleam new: demo1 and demo2.

In both project create a file demo.gleam.

In demo1 with content:

import gleam/io

pub fn main() {
  "demo in demo1"
  |> io.debug()
}

In demo2 with content:

import gleam/io

pub fn main() {
  "demo in demo2"
  |> io.debug()
}

In demo2 add the following to [dependencies] in gleam.toml: demo1 = { path = "../demo1"}

The run the demo module in demo2: gleam run -m demo

On my side I get the output: "demo in demo1"

Expected error or maybe "demo in demo2" with a warning that demo module was shadowed in demo1 dependency.

Note: If the dependency was made in the other direction (demo1 -> demo2) the module from the main project was run.

lpil commented 5 months ago

Oh dear! Thank you