links icon indicating copy to clipboard operation
links copied to clipboard

REPL name shadowing bug

Open dhil opened this issue 3 years ago • 0 comments

Shadowing of let-bound names is broken in the REPL, when some redefinition of a let-bound name makes use of the previous definition. A few examples

links> var x = 1;
x = 1 : Int
links> var x = x;
***: Error: Links_core.Notfound.NotFound("2235 (in Map.find)") 

links> var xs = [];
xs = [] : [_::Any]
links> var xs = 1 :: xs;
***: Error: Links_core.Notfound.NotFound("2237 (in Map.find)") 

links> var f = fun(x) { x };
f = fun : (a::Any) -> a::Any
links> var f = f(f);
***: Error: Links_core.Notfound.NotFound("2242 (in Map.find)")

The same examples work fine if run from a file.

# bindings.links
var x = 1;
var x = x;

var xs = [];
var xs = 1 :: xs;

var f = fun(x) { x };
var f = f(f);

$ ./links bindings.links
() : ()

dhil avatar Oct 01 '20 11:10 dhil