Skip to content

Commit

Permalink
Fix #198 - empty if (#217)
Browse files Browse the repository at this point in the history
Co-authored-by: Nahuel Palumbo <[email protected]>
  • Loading branch information
fdodino and PalumboN authored Feb 28, 2024
1 parent 2431dec commit 6d9422c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/typeSystem/typeVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ const inferIf = (_if: If) => {
typeVariableFor(_if)
.beSupertypeOf(typeVariableFor(last(_if.elseBody.sentences)!))
}
return typeVariableFor(_if) // TODO: only for if-expression
.beSupertypeOf(typeVariableFor(last(_if.thenBody.sentences)!))
if (_if.thenBody.sentences.length) {
return typeVariableFor(_if) // TODO: only for if-expression
.beSupertypeOf(typeVariableFor(last(_if.thenBody.sentences)!))
}
}

const inferReference = (r: Reference<Node>) => {
Expand Down

0 comments on commit 6d9422c

Please sign in to comment.