git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix name shadowing issue in bindings
38c685dPhil Freeman
examples/passing/Auto.ps+1−1
@@ -6,4 +6,4 @@ exists :: forall s1 i o. s1 -> (s1 -> i -> o) -> SomeAuto i o
6exists = \state step f -> f (Auto { state: state, step: step })
6exists = \state step f -> f (Auto { state: state, step: step })
7
7
8run :: forall i o. SomeAuto i o -> i -> o
8run :: 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"
155prettyPrintBinder (BooleanBinder False) = "false"
155prettyPrintBinder (BooleanBinder False) = "false"
156prettyPrintBinder (VarBinder ident) = show ident
156prettyPrintBinder (VarBinder ident) = show ident
157prettyPrintBinder (NullaryBinder ctor) = show ctor
157prettyPrintBinder (NullaryBinder ctor) = show ctor
158−prettyPrintBinder (UnaryBinder ctor b) = show ctor ++ prettyPrintBinder b
158+prettyPrintBinder (UnaryBinder ctor b) = show ctor ++ " " ++ prettyPrintBinder b
159prettyPrintBinder (ObjectBinder bs) = "{ " ++ intercalate ", " (map (uncurry prettyPrintObjectPropertyBinder) bs) ++ " }"
159prettyPrintBinder (ObjectBinder bs) = "{ " ++ intercalate ", " (map (uncurry prettyPrintObjectPropertyBinder) bs) ++ " }"
160prettyPrintBinder (ArrayBinder bs rest) = "[ " ++ intercalate ", " (map prettyPrintBinder bs) ++ maybe "" (("; " ++) . prettyPrintBinder) rest ++ " ]"
160prettyPrintBinder (ArrayBinder bs rest) = "[ " ++ intercalate ", " (map prettyPrintBinder bs) ++ maybe "" (("; " ++) . prettyPrintBinder) rest ++ " ]"
161prettyPrintBinder (NamedBinder ident binder) = show ident ++ "@" ++ prettyPrintBinder binder
161prettyPrintBinder (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
497inferGuardedBinder :: M.Map Ident Type -> Type -> Binder -> Subst Check (M.Map Ident Type)
497inferGuardedBinder :: M.Map Ident Type -> Type -> Binder -> Subst Check (M.Map Ident Type)
498inferGuardedBinder m val (GuardedBinder cond binder) = do
498inferGuardedBinder m val (GuardedBinder cond binder) = do
499 m1 <- inferBinder val binder
499 m1 <- inferBinder val binder
500− ty <- infer (m `M.union` m1) cond
500+ check (m1 `M.union` m) cond Boolean
501− ty ~~ Boolean
502 return m1
501 return m1
503inferGuardedBinder m val b = inferBinder val b
502inferGuardedBinder m val b = inferBinder val b
504
503
@@ -506,7 +505,7 @@ checkBinders :: M.Map Ident Type -> Type -> Type -> [(Binder, Value)] -> Subst C
506checkBinders _ _ _ [] = return ()
505checkBinders _ _ _ [] = return ()
507checkBinders m nval ret ((binder, val):bs) = do
506checkBinders m nval ret ((binder, val):bs) = do
508 m1 <- inferGuardedBinder m nval binder
507 m1 <- inferGuardedBinder m nval binder
509− check (m `M.union` m1) val ret
508+ check (m1 `M.union` m) val ret
510 checkBinders m nval ret bs
509 checkBinders m nval ret bs
511
510
512assignVariable :: Ident -> M.Map Ident Type -> Subst Check ()
511assignVariable :: Ident -> M.Map Ident Type -> Subst Check ()