gleam-lang/gleam

False positive `This imported module is never used` when aliasing

Open

#5.145 aberto em 20 de nov. de 2025

Ver no GitHub
 (2 comments) (0 reactions) (1 assignee)Rust (960 forks)batch import
help wanted

Métricas do repositório

Stars
 (21.417 stars)
Métricas de merge de PR
 (Mesclagem média 10d 19h) (69 fundiu PRs em 30d)

Description

import bar/foo
import foo as baz

pub fn main() -> Nil {
  foo.go()
  baz.thing()
}

When running gleam check (or build, or the language server) on this code, it incorrectly states:

warning: Unused imported module
  ┌─ /tmp/tmp.0xlJkPoggL/import_shadow/src/import_shadow.gleam:1:1
  │
1 │ import bar/foo
  │ ^^^^^^^^^^^^^^ This imported module is never used

Hint: You can safely remove it.

See https://github.com/bo0tzz/gleam_reproductions/blob/import-shadow/src/import_shadow.gleam for a minimal project that reproduces this.

Guia do colaborador