From 6c75618f950e1c68790ff3193ca9ae97edb4a3c9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 6 Jun 2010 12:41:08 -0700 Subject: [PATCH] expressions: Improve "type mismatch" error messages from expression parser. Before this commit, type mismatches invoking functions in expressions would yield confusing error messages due to missing type names, e.g.: Type mismatch invoking MISSING(number) as missing(string). This commit fills in the missing type names: Type mismatch invoking MISSING(number) as missing(). An upcoming commit will start checking error messages as part of the tests for expressions, which should ensure that the problem does not recur. --- src/language/expressions/parse.incpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/language/expressions/parse.incpl b/src/language/expressions/parse.incpl index 4e7243c1..7f9af1b9 100644 --- a/src/language/expressions/parse.incpl +++ b/src/language/expressions/parse.incpl @@ -12,9 +12,9 @@ sub generate_output { next if $type->{ROLE} eq 'fixed'; my ($human_name) = $type->{HUMAN_NAME}; - $human_name = "" if !defined $human_name; + $human_name = $type->{NAME} if !defined $human_name; - my (@members) = ("\"$type->{NAME}\"", "\"\"", + my (@members) = ("\"$type->{NAME}\"", "\"$human_name\"", 0, "OP_$type->{NAME}", 0, "{}", 0, 0); print "{", join (', ', @members), "},\n"; } -- 2.30.2