Confusing error when working with aliases
In the case of errors happening, with a concrete Thing enum variant like struct or entity, the error gets properly resolved. Here is an example of how it works when not aliasing:
enum Opt<T> {
Test1 {value: T},
Test2,
}
entity main() -> Opt<int<8>> {
Opt::Test1
}
This is the error to be expected:
┌─ input.spade:7:5
│
2 │ Some {value: T},
│ ---- Opt::Test1 is a enum variant
·
7 │ Opt::Test1
│ ^^^^^^^^^ Expected a value
│
= Consider specifying the arguments to the variant
│
7 │ Opt::Test1(/* value */)
│
When aliasing Test1 instead, the Thing enum variant is a alias and not the actual Type that is being aliasd which results in the wrong error.
enum Opt<T> {
Test1 {value: T},
Test2,
}
use Opt::Test1;
entity main() -> Opt<int<8>> {
Test1
}
Wrong error due to the type being alias instead of the actual type:
┌─ input.spade:9:5
│
6 │ use Opt::Test1;
│ ---------- Test1 is a alias
·
9 │ Test1
│ ^^^^^ Expected a value
In order for the suggestion to work as well, the error would need to resolve the alias to the actual Thing enum variant that is being aliased.