syntax icon indicating copy to clipboard operation
syntax copied to clipboard

Maybe improve error messages of option<`bla> and others

Open chenglou opened this issue 4 years ago • 2 comments

chenglou avatar Mar 19 '21 23:03 chenglou

If this is referring to what I think it's referring to I see this trip up a lot of newcomers, especially with generics.

Here's one example:

type foo = {bar: unit => unit}

external foo: unit => foo = "foo"

let x = foo()

switch x {
| Some(foo) => foo.bar()
| None => ()
}
This pattern matches values of type option<'a>
but a pattern was expected which matches values of type foo

Is it possible to show option<foo> here? Alternatively perhaps give a more specific hint of what might be wrong? 🤷

lessp avatar Mar 29 '21 17:03 lessp

No that's unrelated. What I filed is a syntax error, where someone used ’ instead of '

chenglou avatar Mar 30 '21 00:03 chenglou

The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.

stale[bot] avatar May 28 '23 23:05 stale[bot]