Interactive: Failed functions should not bind variables

Bug #482941 reported by Matt Giuca
6
This bug affects 1 person
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(univ_cons(univ_cons("Interpreter Error: Undefined variable x")))

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.)

Tags: interpreter

Related branches

Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r912.

Changed in mars:
status: Triaged → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.