git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Let bindings should be able to see each other
c2f5c79Phil Freeman
src/Language/PureScript/TypeChecker/Types.hs+3−3
@@ -679,21 +679,21 @@ inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing tv@(TypedValue
679 let dict = M.singleton (moduleName, ident) (ty, nameKind, Undefined)
679 let dict = M.singleton (moduleName, ident) (ty, nameKind, Undefined)
680 ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
680 ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
681 TypedValue _ val' ty'' <- if checkType then bindNames dict (check val ty') else return tv
681 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
683inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
683inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
684 valTy <- fresh
684 valTy <- fresh
685 Just moduleName <- checkCurrentModule <$> get
685 Just moduleName <- checkCurrentModule <$> get
686 let dict = M.singleton (moduleName, ident) (valTy, nameKind, Undefined)
686 let dict = M.singleton (moduleName, ident) (valTy, nameKind, Undefined)
687 TypedValue _ val' valTy' <- bindNames dict $ infer val
687 TypedValue _ val' valTy' <- bindNames dict $ infer val
688 valTy =?= valTy'
688 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
690inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do
690inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do
691 Just moduleName <- checkCurrentModule <$> get
691 Just moduleName <- checkCurrentModule <$> get
692 (es, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName (map (\(i, _, v) -> (i, v)) ds)
692 (es, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName (map (\(i, _, v) -> (i, v)) ds)
693 ds' <- forM es $ \e -> do
693 ds' <- forM es $ \e -> do
694 (ident, (val', _)) <- typeForBindingGroupElement moduleName e dict untypedDict
694 (ident, (val', _)) <- typeForBindingGroupElement moduleName e dict untypedDict
695 return $ (ident, LocalVariable, val')
695 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
697inferLetBinding seen (PositionedDeclaration pos d : ds) ret j = rethrowWithPosition pos $ do
697inferLetBinding seen (PositionedDeclaration pos d : ds) ret j = rethrowWithPosition pos $ do
698 ((d' : ds'), val') <- inferLetBinding seen (d : ds) ret j
698 ((d' : ds'), val') <- inferLetBinding seen (d : ds) ret j
699 return (PositionedDeclaration pos d' : ds', val')
699 return (PositionedDeclaration pos d' : ds', val')