gleam icon indicating copy to clipboard operation
gleam copied to clipboard

Add Never type to Prelude (WIP on warning for expressions after a function with return type Never)

Open Pi-Cla opened this issue 9 months ago • 1 comments

As discussed in #3044 it would be neat to add a type to the Prelude which could represent functions which never return.

The Never type can not be constructed because if it could be constructed then someone could write a function which does return at some point with it. For example we don't want this to be possible:

fn go_forever() -> Never {
    // oh no it actually does stop!
    Never
}

WIP on figuring out where to add in the Warning for expressions coming after a function/expression of type Never.

Pi-Cla avatar Apr 26 '24 23:04 Pi-Cla

I see... then I guess I will just mark this as a draft for now and wait until a final design has been decided on. (This PR can also just be closed if it is taking up space)

Pi-Cla avatar Apr 27 '24 07:04 Pi-Cla

Closing due to inactivity. Please feel free to reopen! Thank you

lpil avatar May 20 '24 15:05 lpil