diff --git a/Architecture.md b/architecture.md similarity index 100% rename from Architecture.md rename to architecture.md diff --git a/cmd/cmd.go b/cmd/cmd.go index ff1fe8d..3c1026a 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -128,7 +128,7 @@ func Compile(args Arguments) { tprogram, err := typechecker.New().CheckProgram(program) if err != nil { - fmt.Printf("Typechecker failed with: %v\n", err) + fmt.Printf("%v\n", err) os.Exit(1) } if (args.ToPrint & PrintTAst) != 0 { diff --git a/test.tt b/test.tt index b854b64..57ee435 100644 --- a/test.tt +++ b/test.tt @@ -1 +1 @@ -fn main() = 3 + 3; +fn main() = 3 + 3 != false; diff --git a/typechecker/check.go b/typechecker/check.go index 6dfa2c6..2fba81d 100644 --- a/typechecker/check.go +++ b/typechecker/check.go @@ -78,9 +78,9 @@ func (c *Checker) checkExpression(expr tast.Expression) error { var operandErr error if lhsErr == nil && rhsErr == nil { if !expr.Lhs.Type().IsSameType(expr.Rhs.Type()) { - operandErr = fmt.Errorf("the lhs of the expression does not have the same type then the rhs, lhs=%q, rhs=%q", expr.Lhs.Type().Name(), expr.Rhs.Type().Name()) + operandErr = c.error(expr.Token, "the lhs of the expression does not have the same type then the rhs, lhs=%q, rhs=%q", expr.Lhs.Type().Name(), expr.Rhs.Type().Name()) } else if !expr.Lhs.Type().SupportsBinaryOperator(expr.Operator) { - operandErr = fmt.Errorf("the operator %q is not supported by the type %q", expr.Operator, expr.Lhs.Type().Name()) + operandErr = c.error(expr.Token, "the operator %q is not supported by the type %q", expr.Operator, expr.Lhs.Type().Name()) } }