New interface to Typer: the function TypeName() returns a more readable type name

This commit is contained in:
2024-05-19 02:23:28 +02:00
parent 9967918418
commit b92b19e1dd
4 changed files with 37 additions and 3 deletions
+10 -3
View File
@@ -161,11 +161,18 @@ func (self *term) toInt(computedValue any, valueDescription string) (i int, err
}
func (self *term) errIncompatibleTypes(leftValue, rightValue any) error {
leftType := getTypeName(leftValue)
rightType := getTypeName(rightValue)
return self.tk.Errorf(
"left operand '%v' [%T] and right operand '%v' [%T] are not compatible with operator %q",
leftValue, leftValue,
rightValue, rightValue,
"left operand '%v' [%s] and right operand '%v' [%s] are not compatible with operator %q",
leftValue, leftType,
rightValue, rightType,
self.source())
// return self.tk.Errorf(
// "left operand '%v' [%T] and right operand '%v' [%T] are not compatible with operator %q",
// leftValue, leftValue,
// rightValue, rightValue,
// self.source())
}
func (self *term) errIncompatibleType(value any) error {