flix / flix

The Flix Programming Language
https://flix.dev/
Other
2.08k stars 149 forks source link

Resiliant error cascade #7648

Open JonathanStarup opened 1 month ago

JonathanStarup commented 1 month ago
def example(): Unit \ SomeEffect = checked_ecast(())

This program has the errors

-- Resolution Error -------------------------------------------------- [...]\test.flix
>> Undefined type 'SomeEffect'.
8 | def example(): Unit \ SomeEffect = checked_ecast(())
                          ^^^^^^^^^^
                          type not found.

-- Redundancy Error -------------------------------------------------- [...]\test.flix
>> Redundant effect cast. The expression already has the required effect.
8 | def example(): Unit \ SomeEffect = checked_ecast(())
                                       ^^^^^^^^^^^^^^^^^
                                       redundant cast.

So it seems that it continues typing with the pure effect, but instead it would perhaps be better to continue with the non-existing effect SomeEffect or in some other way remember that there is a constant effect

magnus-madsen commented 1 month ago

I am looking for a general solution (but I don't have one yet)