Interactive: Failed functions should not bind variables
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mars |
Fix Released
|
Medium
|
Matt Giuca |
Bug Description
The following code causes an internal interpreter error in the interactive mode:
?> x = error("Hello")
Runtime Error: Hello
?> :t x
x :: t_1
?> x
Uncaught Mercury exception:
univ_cons(
The error function (or any function which raises an error) has no result, so it should not bind a variable if used in an assignment statement. Currently, it binds a variable in the local type table (x has a type) but it doesn't have a binding in the local environment (:e).
It needs to *not* be given a local type table binding. (This is what causes the unpleasant Interpreter error rather than the user-level error, "Undefined variable: x.", which it would give if x was not bound in the type table.)
Related branches
Changed in mars: | |
status: | Fix Committed → Fix Released |
Fixed in trunk r912.