git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #1551
85c0737Phil Freeman
examples/passing/TypedBinders.purs+6−1
@@ -54,9 +54,14 @@ test3 n = case n of
54test4 :: Tuple Int Int -> Tuple Int Int
54test4 :: Tuple Int Int -> Tuple Int Int
55test4 = (\(Tuple a b :: Tuple Int Int) -> Tuple b a)
55test4 = (\(Tuple a b :: Tuple Int Int) -> Tuple b a)
56
56
57+type Int1 = Int
58+
59+test5 :: Int1 -> Int1
60+test5 = \(x :: Int1) -> x
61+
57main = do
62main = do
58 let t1 = test
63 let t1 = test
59 t2 = test2 id
64 t2 = test2 id
60 t3 = test3 1
65 t3 = test3 1
61 t4 = test4 (Tuple 1 0)
66 t4 = test4 (Tuple 1 0)
62− Control.Monad.Eff.Console.log "Done"
67+ Control.Monad.Eff.Console.log "Done"
src/Language/PureScript/TypeChecker/Types.hs+3−1
@@ -372,7 +372,9 @@ inferBinder val (PositionedBinder pos _ binder) =
372 warnAndRethrowWithPosition pos $ inferBinder val binder
372 warnAndRethrowWithPosition pos $ inferBinder val binder
373-- TODO: When adding support for polymorphic types, check subsumption here
373-- TODO: When adding support for polymorphic types, check subsumption here
374-- and change the definition of `binderRequiresMonotype`
374-- and change the definition of `binderRequiresMonotype`
375−inferBinder val (TypedBinder ty binder) = val =?= ty >> inferBinder val binder
375+inferBinder val (TypedBinder ty binder) = do
376+ ty' <- replaceAllTypeSynonyms ty
377+ val =?= ty' >> inferBinder val binder
376
378
377-- | Returns true if a binder requires its argument type to be a monotype.
379-- | Returns true if a binder requires its argument type to be a monotype.
378-- | If this is the case, we need to instantiate any polymorphic types before checking binders.
380-- | If this is the case, we need to instantiate any polymorphic types before checking binders.