Skip to content

Commit

Permalink
type-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Dec 2, 2023
1 parent e99d960 commit 50bc7fe
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkg/dsl/cst/builtin_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ func (node *LogicalANDOperatorNode) Evaluate(
if btype == mlrval.MT_VOID || btype == mlrval.MT_ABSENT {
return mlrval.ABSENT
}
if btype != mlrval.MT_BOOL {
return mlrval.FromNotNamedTypeError("&&", bout, "absent or boolean")
}
return bout
}

Expand All @@ -763,11 +766,14 @@ func (node *LogicalANDOperatorNode) Evaluate(
return bout
}
if btype == mlrval.MT_VOID {
return mlrval.VOID
return mlrval.FromNotNamedTypeError("&&", bout, "absent or boolean")
}
if btype == mlrval.MT_ABSENT {
return mlrval.ABSENT
}
if btype != mlrval.MT_BOOL {
return mlrval.FromNotNamedTypeError("&&", bout, "absent or boolean")
}
return bout
}

Expand Down Expand Up @@ -827,6 +833,12 @@ func (node *LogicalOROperatorNode) Evaluate(
if btype == mlrval.MT_VOID || btype == mlrval.MT_ABSENT {
return mlrval.ABSENT
}
if btype == mlrval.MT_VOID {
return mlrval.FromNotNamedTypeError("||", bout, "absent or boolean")
}
if btype != mlrval.MT_BOOL {
return mlrval.FromNotNamedTypeError("||", bout, "absent or boolean")
}
return bout
}

Expand All @@ -837,11 +849,14 @@ func (node *LogicalOROperatorNode) Evaluate(
return bout
}
if btype == mlrval.MT_VOID {
return mlrval.VOID
return mlrval.FromNotNamedTypeError("||", bout, "absent or boolean")
}
if btype == mlrval.MT_ABSENT {
return mlrval.ABSENT
}
if btype != mlrval.MT_BOOL {
return mlrval.FromNotNamedTypeError("||", bout, "absent or boolean")
}
return bout
}

Expand Down

0 comments on commit 50bc7fe

Please sign in to comment.