Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused import warning on constructor if type alias with the same name exists #3552

Open
joshi-monster opened this issue Aug 21, 2024 · 1 comment · May be fixed by #3560
Open

Unused import warning on constructor if type alias with the same name exists #3552

joshi-monster opened this issue Aug 21, 2024 · 1 comment · May be fixed by #3560
Labels
bug Something isn't working help wanted Contributions encouraged priority:medium

Comments

@joshi-monster
Copy link

wibble.gleam

pub type Wibble {
  Wibble(String)
}

wobble.gleam

import gleam/io
import wibble.{Wibble}

type Wibble =
  wibble.Wibble

pub fn main() {
  let wibble = Wibble("hello")
  io.debug(wibble)
}

gleam check

warning: Unused imported item
  ┌─ /home/arkan/Projects/oss/gleam/bug/src/bug.gleam:2:16
  │
2 │ import wibble.{Wibble}
  │                ^^^^^^ This imported constructor is never used

Hint: You can safely remove it.

I use the constructor in main, and type aliases do not produce new constructors, so I believe this is a false positive. Removing the type alias also gets rid of the warning for some reason.

@joshi-monster joshi-monster added the bug Something isn't working label Aug 21, 2024
@lpil
Copy link
Member

lpil commented Aug 22, 2024

Thank you. This system is due to be deleted and replaced with a call graph traversal.

@lpil lpil added help wanted Contributions encouraged priority:medium labels Aug 22, 2024
@Acepie Acepie linked a pull request Aug 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Contributions encouraged priority:medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants