git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Let bindings should be able to see each other
commitc2f5c794a404e05281b6b7e6c0ea056d4aeee68e authorPhil Freeman <paf31@cantab.net> dateWed 16 Jul 2014, 17:38 (12 years ago) parentab7b8ab
1 file changed+3−3
src/Language/PureScript/TypeChecker/Types.hs+3−3
src/Language/PureScript/TypeChecker/Types.hs+3−3
@@ -679,21 +679,21 @@ inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing tv@(TypedValue
679679 let dict = M.singleton (moduleName, ident) (ty, nameKind, Undefined)
680680 ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
681681 TypedValue _ val' ty'' <- if checkType then bindNames dict (check val ty') else return tv
682− bindNames (M.singleton (moduleName, ident) (ty'', nameKind, Undefined)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing (TypedValue checkType val' ty'')]) rest ret j
682+ bindNames (M.singleton (moduleName, ident) (ty'', nameKind, Defined)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing (TypedValue checkType val' ty'')]) rest ret j
683683inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
684684 valTy <- fresh
685685 Just moduleName <- checkCurrentModule <$> get
686686 let dict = M.singleton (moduleName, ident) (valTy, nameKind, Undefined)
687687 TypedValue _ val' valTy' <- bindNames dict $ infer val
688688 valTy =?= valTy'
689− bindNames (M.singleton (moduleName, ident) (valTy', nameKind, Undefined)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing val']) rest ret j
689+ bindNames (M.singleton (moduleName, ident) (valTy', nameKind, Defined)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing val']) rest ret j
690690inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do
691691 Just moduleName <- checkCurrentModule <$> get
692692 (es, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName (map (\(i, _, v) -> (i, v)) ds)
693693 ds' <- forM es $ \e -> do
694694 (ident, (val', _)) <- typeForBindingGroupElement moduleName e dict untypedDict
695695 return $ (ident, LocalVariable, val')
696− bindNames dict $ inferLetBinding (seen ++ [BindingGroupDeclaration ds']) rest ret j
696+ makeBindingGroupVisible $ bindNames dict $ inferLetBinding (seen ++ [BindingGroupDeclaration ds']) rest ret j
697697inferLetBinding seen (PositionedDeclaration pos d : ds) ret j = rethrowWithPosition pos $ do
698698 ((d' : ds'), val') <- inferLetBinding seen (d : ds) ret j
699699 return (PositionedDeclaration pos d' : ds', val')