git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Expand type synonyms in type decls in let bindings
90bf9abPhil Freeman
purescript.cabal+1−1
@@ -1,5 +1,5 @@
1name: purescript
1name: purescript
2−version: 0.4.19
2+version: 0.4.19.1
3cabal-version: >=1.8
3cabal-version: >=1.8
4build-type: Custom
4build-type: Custom
5license: MIT
5license: MIT
src/Language/PureScript/TypeChecker/Types.hs+4−3
@@ -680,7 +680,7 @@ infer' (TypedValue checkType val ty) = do
680 Just moduleName <- checkCurrentModule <$> get
680 Just moduleName <- checkCurrentModule <$> get
681 kind <- liftCheck $ kindOf moduleName ty
681 kind <- liftCheck $ kindOf moduleName ty
682 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
682 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
683− ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
683+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
684 val' <- if checkType then check val ty' else return val
684 val' <- if checkType then check val ty' else return val
685 return $ TypedValue True val' ty'
685 return $ TypedValue True val' ty'
686infer' (PositionedValue pos val) = rethrowWithPosition pos $ infer' val
686infer' (PositionedValue pos val) = rethrowWithPosition pos $ infer' val
@@ -693,8 +693,9 @@ inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing tv@(TypedValue
693 kind <- liftCheck $ kindOf moduleName ty
693 kind <- liftCheck $ kindOf moduleName ty
694 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
694 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
695 let dict = if isFunction val then M.singleton (moduleName, ident) (ty, nameKind) else M.empty
695 let dict = if isFunction val then M.singleton (moduleName, ident) (ty, nameKind) else M.empty
696+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
696− TypedValue _ val' ty' <- if checkType then bindNames dict (check val ty) else return tv
697+ TypedValue _ val' ty'' <- if checkType then bindNames dict (check val ty') else return tv
697− bindNames (M.singleton (moduleName, ident) (ty', nameKind)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing (TypedValue checkType val' ty')]) rest ret j
698+ bindNames (M.singleton (moduleName, ident) (ty'', nameKind)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing (TypedValue checkType val' ty'')]) rest ret j
698inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
699inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
699 valTy <- fresh
700 valTy <- fresh
700 Just moduleName <- checkCurrentModule <$> get
701 Just moduleName <- checkCurrentModule <$> get