@@ -79,7 +79,7 @@ typesOf moduleName vals = do
79 tys <- fmap tidyUp . liftUnifyWarnings replace $ do
79 tys <- fmap tidyUp . liftUnifyWarnings replace $ do
80 (untyped, typed, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName vals
80 (untyped, typed, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName vals
81 ds1 <- parU typed $ \e -> checkTypedBindingGroupElement moduleName e dict
81 ds1 <- parU typed $ \e -> checkTypedBindingGroupElement moduleName e dict
82− ds2 <- forM untyped $ \e -> typeForBindingGroupElement e dict untypedDict
82+ ds2 <- forM untyped $ \e -> typeForBindingGroupElement True e dict untypedDict
83 return $ ds1 ++ ds2
83 return $ ds1 ++ ds2
85 forM tys $ \(ident, (val, ty)) -> do
85 forM tys $ \(ident, (val, ty)) -> do
@@ -137,12 +137,12 @@ checkTypedBindingGroupElement mn (ident, (val', ty, checkType)) dict = do
137 else return (TypedValue False val' ty'')
137 else return (TypedValue False val' ty'')
138 return (ident, (val'', ty''))
138 return (ident, (val'', ty''))
140−typeForBindingGroupElement :: (Ident, Expr) -> TypeData -> UntypedData -> UnifyT Type Check (Ident, (Expr, Type))
140+typeForBindingGroupElement :: Bool -> (Ident, Expr) -> TypeData -> UntypedData -> UnifyT Type Check (Ident, (Expr, Type))
141−typeForBindingGroupElement (ident, val) dict untypedDict = do
141+typeForBindingGroupElement warn (ident, val) dict untypedDict = do
142 -- Infer the type with the new names in scope
142 -- Infer the type with the new names in scope
143 TypedValue _ val' ty <- bindNames dict $ infer val
143 TypedValue _ val' ty <- bindNames dict $ infer val
144 ty =?= fromMaybe (internalError "name not found in dictionary") (lookup ident untypedDict)
144 ty =?= fromMaybe (internalError "name not found in dictionary") (lookup ident untypedDict)
145− tell . errorMessage $ MissingTypeDeclaration ident ty
145+ when warn . tell . errorMessage $ MissingTypeDeclaration ident ty
146 return (ident, (TypedValue True val' ty, ty))
146 return (ident, (TypedValue True val' ty, ty))
@@ -311,7 +311,7 @@ inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do
311 Just moduleName <- checkCurrentModule <$> get
311 Just moduleName <- checkCurrentModule <$> get
312 (untyped, typed, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName (map (\(i, _, v) -> (i, v)) ds)
312 (untyped, typed, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName (map (\(i, _, v) -> (i, v)) ds)
313 ds1' <- parU typed $ \e -> checkTypedBindingGroupElement moduleName e dict
313 ds1' <- parU typed $ \e -> checkTypedBindingGroupElement moduleName e dict
314− ds2' <- forM untyped $ \e -> typeForBindingGroupElement e dict untypedDict
314+ ds2' <- forM untyped $ \e -> typeForBindingGroupElement False e dict untypedDict
315 let ds' = [(ident, Private, val') | (ident, (val', _)) <- ds1' ++ ds2']
315 let ds' = [(ident, Private, val') | (ident, (val', _)) <- ds1' ++ ds2']
316 bindNames dict $ do
316 bindNames dict $ do
317 makeBindingGroupVisible
317 makeBindingGroupVisible