mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 20:49:05 +03:00
Don't visit type object in concretizing of "the"-expression.
This commit is contained in:
parent
c6e7ba890e
commit
ecfe36a7c0
@ -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) []))
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user