gleam
gleam copied to clipboard
Emit an error when external modules and Gleam modules would collide
To replicate:
-
create a gleam program
-
create a mjs file with the same name (excluding the .mjs/.gleam extension) as one of your gleam files OR
-
create an erlang file with the same name as one of your gleam files
-
attempt to import an external gleam function from one of the external files with the same name
Problem: Gleam will not recognize any exports from the .mjs or .erl and throw the following error: SyntaxError: The requested module '(mjs/erlang file path)' does not provide an export named '(imported external function name)' It would be much more clear if the error was specific to having a mjs or erlang file with the same name as a gleam file importing from it, instead of stating that the module does not have the specified export
Thank you
Hey @lpil do you mind if I pick up this issue?
Go for it! Thank you
I've just ran into this issue with using @external(erlang, "zlib", "open"), and naturally naming the file zlib.gleam. The error is even more unclear in this case, where it just says "function open/0 undefined". Definitely interested in seeing this resolved.
@louiidev are you still planning to work on this? Otherwise I could try and pick it up
@louiidev are you still planning to work on this? Otherwise I could try and pick it up
Go ahead