-
Notifications
You must be signed in to change notification settings - Fork 701
Closed
Labels
Milestone
Description
Feels like there are some corner cases with type checking, and AFAIK there hasn't really been much discussion on it. Right now I am looking at cases like the following pseudo-code for a function which has been defined with an int result type:
(func
(if condition
(ret (const 1))
else
(ret (const 2))
)
)
Should this validate? All paths return an int but the if/else doesn't yield a value.
If that should validate, what about this?
(func
(if condition
(ret (const 1))
(const 1.5)
else
(ret (const 2))
(const 1.5)
)
)
Same type of scenario, but now it's arguable whether we consider that the if/else yields float or doesn't yield. If it yields, then I suppose we fail validation, because that (unreachable) path yields a float.
How are you guys handling this type of scenario today?
Reactions are currently unavailable