Don't visit type object in concretizing of "the"-expression.

This commit is contained in:
Erik Svedäng 2017-09-04 16:03:15 +02:00
parent c6e7ba890e
commit ecfe36a7c0
2 changed files with 24 additions and 11 deletions

View File

@ -26,17 +26,23 @@
;;(def x (the (Array Int) NULL))
(defn main []
(let [x [10]
y 123]
(do
(set! &x [1 2 3])
(set! &x [4 5 6])
(set! &y 10)
(println (ref (str &x)))
(println (ref (str y)))
)))
;; (defn main []
;; (let [x [10]
;; y 123]
;; (do
;; (set! &x [1 2 3])
;; (set! &x [4 5 6])
;; (set! &y 10)
;; (println (ref (str &x)))
;; (println (ref (str y)))
;; )))
;; BUG when flipping type and name in deftype:
;; (deftype AHA [int x])
;; (defn foo [] (AHA.init 3))
(defn g []
[1 2 3])
(defn f []
(the (Array Int) []))

View File

@ -47,13 +47,20 @@ concretizeXObj allowAmbiguity typeEnv rootEnv root =
functionEnv argsArr
visitedBody <- (visit envWithArgs) body
return $ do okBody <- visitedBody
return [defn, nameSymbol, args, okBody]
return [defn, nameSymbol, args, okBody]
visitList env (letExpr@(XObj Let _ _) : (XObj (Arr bindings) bindi bindt) : body : []) =
do visitedBindings <- fmap sequence (mapM (visit env) bindings)
visitedBody <- (visit env) body
return $ do okVisitedBindings <- visitedBindings
okVisitedBody <- visitedBody
return [letExpr, XObj (Arr okVisitedBindings) bindi bindt, okVisitedBody]
visitList env (theExpr@(XObj The _ _) : typeXObj : value : []) =
do visitedValue <- visit env value
return $ do okVisitedValue <- visitedValue
return [theExpr, typeXObj, okVisitedValue]
visitList env (func : args) =
do f <- visit env func
a <- fmap sequence (mapM (visit env) args)