snag icon indicating copy to clipboard operation
snag copied to clipboard

Improve error message when using wrong syntax to import a type

Open xhh opened this issue 2 years ago • 3 comments

Code:

import gleam/io
import gleam/string.{inspect}
import snag.{Result, Snag}

pub fn main() {
  let r: snag.Snag = snag.new("hello")
  io.println(inspect(r))
}

Error:

Unknown module field

Did you mean `error`?

The module `snag` does not have a `Result` value.

OS: Windows 11

xhh avatar Dec 22 '23 09:12 xhh

Hello! The syntax is import snag.{type Result}

lpil avatar Dec 22 '23 09:12 lpil

Let's improve this error message.

lpil avatar Dec 22 '23 09:12 lpil

Ah, thanks! Another issue of mine can be closed as well then.

xhh avatar Dec 22 '23 09:12 xhh

I think this is fixed in Gleam v1.2.0 @lpil ?

bruse avatar May 30 '24 09:05 bruse

Yes, thank you

lpil avatar May 30 '24 09:05 lpil