git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix a typechecker bug which caused type class dictionaries to not be inserted in a particular case
e384610Phil Freeman
examples/passing/InferRecFunWithConstrainedArgument.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+
5+test 100 = 100
6+test n = test(1 + n)
7+
8+main = Trace.print $ test 0
src/Language/PureScript/TypeChecker/Types.hs+3−3
@@ -949,9 +949,9 @@ checkFunctionApplication' fn (ForAll ident ty _) arg = do
949 checkFunctionApplication fn replaced arg
949 checkFunctionApplication fn replaced arg
950checkFunctionApplication' fn u@(TUnknown _) arg = do
950checkFunctionApplication' fn u@(TUnknown _) arg = do
951 arg' <- do
951 arg' <- do
952− TypedValue _ v t <- infer arg
952+ TypedValue _ arg' t <- infer arg
953− (v', t') <- instantiatePolyTypeWithUnknowns arg t
953+ (arg'', t') <- instantiatePolyTypeWithUnknowns arg' t
954− return $ TypedValue True v' t'
954+ return $ TypedValue True arg'' t'
955 let ty = (\(TypedValue _ _ t) -> t) arg'
955 let ty = (\(TypedValue _ _ t) -> t) arg'
956 ret <- fresh
956 ret <- fresh
957 u =?= function ty ret
957 u =?= function ty ret