This is not a bug per se, I think, but maybe it's something that's worth taking a look at.
I have a type with two constructors, Global and Local. At one point, I do this:
let Global(table: new_table) as new_env = Global(map.insert(into: table, for: name, insert: value))
As it is, gleam complains that new_env could be a Local instead of a Global. I mean, the r-value is explicitly a Global, but okay - I change it to
let assert Global(table: new_table) as new_env = Global(map.insert(into: table, for: name, insert: value)).
Now, when it compiles, Erlang gives a warning:
_assert_subject = {global, gleam@map:insert(Table, Name, Value)},
{global, New_table} = New_env = case _assert_subject of
{global, _} -> _assert_subject;
_assert_fail -> erlang:error(#{gleam_error => let_assert etc etc etc})
The warning says the _assert_fail clause cannot match because the previous one always matches... there's a redundancy here that's slightly annoying. This particular case is not high-priority, but hopefully the type checker will improve in the future and make this assert unnecessary? 😄