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

Improve error message if importing type using the value import syntax or vice versa #3028

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

Pi-Cla
Copy link

@Pi-Cla Pi-Cla commented Apr 22, 2024

Resolves #2576
Now they look like this:

error: Unknown module field
  ┌─ /src/one/two.gleam:1:19
  │
1 │ import gleam/foo.{Bar}
  │                   ^^^ Did you mean `type Bar`?
`Bar` is only a type, it cannot be imported as a value.
error: Unknown module type
  ┌─ /src/one/two.gleam:1:19
  │
1 │ import gleam/foo.{type Baz}
  │                   ^^^^^^^^ Did you mean `Baz`?
`Baz` is only a value, it cannot be imported as a type.

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! Thank you

@lpil lpil merged commit 65f6a1d into gleam-lang:main Apr 22, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error message if importing type using the value import syntax
2 participants