Skip to content

Commit

Permalink
Adjust function literal return type inference to avoid spurious null
Browse files Browse the repository at this point in the history
  • Loading branch information
eernstg committed Dec 17, 2024
1 parent 9f594ce commit 17a97e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resources/type-system/inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Status: Draft

## CHANGELOG

2024.12.17
- Change the function literal return type inference rules to ignore
`return;` statements in generators (it doesn't actually cause null to be
returned).

2022.05.12
- Define the notions of "constraint solution for a set of type variables" and
"Grounded constraint solution for a set of type variables". These
Expand Down Expand Up @@ -324,7 +329,8 @@ schema.
`e`, using the local type inference algorithm described below with typing
context `K`, and update `T` to be `UP(flatten(S), T)` if the enclosing
function is `async`, or `UP(S, T)` otherwise.
- For each `return;` statement in the block, update `T` to be `UP(Null, T)`.
- If the enclosing function is not marked `sync*` or `async*`: For each
`return;` statement in the block, update `T` to be `UP(Null, T)`.
- For each `yield e;` statement in the block, let `S` be the inferred type of
`e`, using the local type inference algorithm described below with typing
context `K`, and update `T` to be `UP(S, T)`.
Expand Down

0 comments on commit 17a97e5

Please sign in to comment.