Skip to content

Commit

Permalink
Dedup reported type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Aug 24, 2024
1 parent 290377a commit b6da05a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/phase/type-unify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { unreachable } from '../util/todo'
/**
* Unify type bounds
*/
export const unifyTypeBounds = (node: AstNode, ctx: Context): void => {
export const unifyTypeBounds = (node: AstNode, ctx: Context, report = true): void => {
if (node.type) {
unifyType(node.type)
}
Expand Down Expand Up @@ -85,7 +85,7 @@ export const unifyTypeBounds = (node: AstNode, ctx: Context): void => {
break
}
case 'unary-expr': {
unifyTypeBounds(node.operand, ctx)
unifyTypeBounds(node.operand, ctx, false)
switch (node.op.kind) {
case 'call-op': {
node.op.args.forEach(a => unifyTypeBounds(a, ctx))
Expand Down Expand Up @@ -157,7 +157,7 @@ export const unifyTypeBounds = (node: AstNode, ctx: Context): void => {
break
}
}
if (node.type) {
if (node.type && report) {
reportErrors(ctx, node)
}
}
Expand Down Expand Up @@ -232,6 +232,7 @@ const unifyType = (type: InferredType): void => {
break
}
Object.assign(type, ret)
unifyType(type)
break
}
case 'identifier':
Expand Down

0 comments on commit b6da05a

Please sign in to comment.