diff --git a/compile.rkt b/compile.rkt index 6d62720..9d75159 100644 --- a/compile.rkt +++ b/compile.rkt @@ -774,14 +774,8 @@ [(and (LocalRef? exp) (not (LocalRef-unbox? exp))) (let ([entry (list-ref cenv (LocalRef-depth exp))]) - (printf "~s\n" entry) - (cond - [(StaticallyKnownLam? entry) - entry] - [(Const? entry) - entry] - [else - '?]))] + entry)] + [(ToplevelRef? exp) (let: ([name : (U Symbol False ModuleVariable) (list-ref (Prefix-names (ensure-prefix (list-ref cenv (ToplevelRef-depth exp)))) @@ -791,8 +785,10 @@ name] [else '?]))] + [(Constant? exp) (make-Const (Constant-v exp))] + [else '?])) diff --git a/test-browser-evaluate.rkt b/test-browser-evaluate.rkt index 70f07d8..e4e8897 100644 --- a/test-browser-evaluate.rkt +++ b/test-browser-evaluate.rkt @@ -303,6 +303,11 @@ EOF "4\n5\n16\n") +(test/exn '(let ([x 0]) + (set! x "foo") + (add1 x)) + "Error: Expected number as argument 1 but received foo") + #;(test (read (open-input-file "tests/conform/program0.sch")) (port->string (open-input-file "tests/conform/expected0.txt"))) \ No newline at end of file