gleam-lang/gleam

Dependency version constraint from path dependency not respected

Open

#3,890 opened on Nov 25, 2024

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Rust (21,417 stars) (960 forks)batch import
help wantedhigh priority

Description

Version: gleam@1.6.2 (OTP26)

Steps

Clone this version of lustre and try to build one of the test projects

git clone https://github.com/lustre-labs/lustre.git
cd lustre
git checkout 969f77de72ca9502aa160e637d2f4fce86f94053
cd test-apps/vdom-test-templates
gleam build

The following error appears:

error: Unknown module
   ┌─ /Users/jonas/Projects/lustre/src/lustre/internals/vdom.gleam:10:1
   │
10 │ import gleam/string_tree.{type StringTree}
   │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

No module has been found with the name `gleam/string_tree`.

error: Unknown type
    ┌─ /Users/jonas/Projects/lustre/src/lustre/internals/vdom.gleam:184:60
    │
184 │ pub fn element_to_string_builder(element: Element(msg)) -> StringTree {
    │                                                            ^^^^^^^^^^ Did you mean `String`?

The type `StringTree` is not defined or imported in this module.

Indicating that a pre-0.43 version of the gleam_stdlib is pulled into that project, but lustre, has this constraint:

https://github.com/lustre-labs/lustre/blob/969f77de72ca9502aa160e637d2f4fce86f94053/gleam.toml#L40-L40

And is referenced as a path dependency like so:

https://github.com/lustre-labs/lustre/blob/969f77de72ca9502aa160e637d2f4fce86f94053/test-apps/vdom-test-templates/gleam.toml#L6-L7

So I would have expected it to either respect the version constraint given by lustre, or throw a dependency resolution error if that's not possible, rather than compiling and erroring since the stdlib version is too old

Contributor guide