The following code:
pub type UnknownTypeAlias = UnknownType
pub type UsageOfUnknownTypeAlias = UnknownTypeAlias
Produces the error:
error: Unknown type
┌─ /src/main.gleam:1:29
│
1 │ pub type UnknownTypeAlias = UnknownType
│ ^^^^^^^^^^^
The type `UnknownType` is not defined or imported in this module.
error: Unknown type
┌─ /src/main.gleam:3:36
│
3 │ pub type UsageOfUnknownTypeAlias = UnknownTypeAlias
│ ^^^^^^^^^^^^^^^^
The type `UnknownTypeAlias` is not defined or imported in this module.
I would expect the first error to be reported as the type UnknownType really doesn't exist. However with the second error, I wouldn't expect it to be reported to the user until they get the previous error fixed to prevent cascading errors.
Interestingly enough:
pub type UnknownTypeAlias = UnknownType
pub type UnknownTypeAlias {}
reports
error: Duplicate type definition
┌─ /src/main.gleam:1:1
│
1 │ pub type UnknownTypeAlias = UnknownType
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Redefined here
·
5 │ pub type UnknownTypeAlias {}
│ ------------------------- First defined here
The type `UnknownTypeAlias` has been defined multiple times.
Names in a Gleam module must be unique so one will need to be renamed.
which acknowledges that the alias UnknownTypeAlias has already been defined which contradicts
error: Unknown type
┌─ /src/main.gleam:3:36
│
3 │ pub type UsageOfUnknownTypeAlias = UnknownTypeAlias
│ ^^^^^^^^^^^^^^^^
The type `UnknownTypeAlias` is not defined or imported in this module.
Tested on the Gleam Playground with Gleam version 1.17.0 and on Arch Linux with Gleam version 1.18.0
The following code:
Produces the error:
I would expect the first error to be reported as the type
UnknownTypereally doesn't exist. However with the second error, I wouldn't expect it to be reported to the user until they get the previous error fixed to prevent cascading errors.Interestingly enough:
reports
which acknowledges that the alias
UnknownTypeAliashas already been defined which contradictsTested on the Gleam Playground with Gleam version 1.17.0 and on Arch Linux with Gleam version 1.18.0