git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix name shadowing issue in bindings
commit38c685d927c370df514fa9945680d73d7b6ac2b2 authorPhil Freeman <paf31@cantab.net> dateWed 27 Nov 2013, 15:53 (13 years ago) parentd3c5372
3 files changed+4−5
examples/passing/Auto.ps+1−1 src/Language/PureScript/Pretty/Values.hs+1−1 src/Language/PureScript/TypeChecker/Types.hs+2−3
examples/passing/Auto.ps+1−1
@@ -6,4 +6,4 @@ exists :: forall s1 i o. s1 -> (s1 -> i -> o) -> SomeAuto i o
66exists = \state step f -> f (Auto { state: state, step: step })
77
88run :: forall i o. SomeAuto i o -> i -> o
9−run = \s i -> s (\a -> case a of Auto x -> x.step x.state i)
9+run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
src/Language/PureScript/Pretty/Values.hs+1−1
@@ -155,7 +155,7 @@ prettyPrintBinder (BooleanBinder True) = "true"
155155prettyPrintBinder (BooleanBinder False) = "false"
156156prettyPrintBinder (VarBinder ident) = show ident
157157prettyPrintBinder (NullaryBinder ctor) = show ctor
158−prettyPrintBinder (UnaryBinder ctor b) = show ctor ++ prettyPrintBinder b
158+prettyPrintBinder (UnaryBinder ctor b) = show ctor ++ " " ++ prettyPrintBinder b
159159prettyPrintBinder (ObjectBinder bs) = "{ " ++ intercalate ", " (map (uncurry prettyPrintObjectPropertyBinder) bs) ++ " }"
160160prettyPrintBinder (ArrayBinder bs rest) = "[ " ++ intercalate ", " (map prettyPrintBinder bs) ++ maybe "" (("; " ++) . prettyPrintBinder) rest ++ " ]"
161161prettyPrintBinder (NamedBinder ident binder) = show ident ++ "@" ++ prettyPrintBinder binder
src/Language/PureScript/TypeChecker/Types.hs+2−3
@@ -497,8 +497,7 @@ inferBinder val (NamedBinder name binder) = do
497497inferGuardedBinder :: M.Map Ident Type -> Type -> Binder -> Subst Check (M.Map Ident Type)
498498inferGuardedBinder m val (GuardedBinder cond binder) = do
499499 m1 <- inferBinder val binder
500− ty <- infer (m `M.union` m1) cond
501− ty ~~ Boolean
500+ check (m1 `M.union` m) cond Boolean
502501 return m1
503502inferGuardedBinder m val b = inferBinder val b
504503
@@ -506,7 +505,7 @@ checkBinders :: M.Map Ident Type -> Type -> Type -> [(Binder, Value)] -> Subst C
506505checkBinders _ _ _ [] = return ()
507506checkBinders m nval ret ((binder, val):bs) = do
508507 m1 <- inferGuardedBinder m nval binder
509− check (m `M.union` m1) val ret
508+ check (m1 `M.union` m) val ret
510509 checkBinders m nval ret bs
511510
512511assignVariable :: Ident -> M.Map Ident Type -> Subst Check ()