Skip to content

Commit

Permalink
Type bounds: empty block adds Unit bound
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Sep 10, 2024
1 parent e063b13 commit ee3bd47
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/phase/type-bound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export const collectTypeBounds = (node: AstNode, ctx: Context, parentBound?: Inf
if (lastStmt) {
addBounds(node.type!, [lastStmt.type!])
}
if (node.statements.length === 0) {
addBounds(node.type!, [
instantiateDefType(ctx.stdTypeIds.unit?.type ?? makeErrorType('no def', 'no-def'))
])
}
break
}
case 'param': {
Expand Down

0 comments on commit ee3bd47

Please sign in to comment.