From: Ben Pfaff Date: Sun, 6 Jun 2010 19:41:08 +0000 (-0700) Subject: expressions: Improve "type mismatch" error messages from expression parser. X-Git-Tag: v0.7.6~381 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c75618f950e1c68790ff3193ca9ae97edb4a3c9;p=pspp-builds.git 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. --- 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"; }