ref: d52d68c288ece685d789c4ee91ae54be0fe9d14f
parent: 3eec9d59f513c7c1a1e99beeb9d72dfbbf50a54f
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Fri Feb 2 12:32:38 EST 2024
Complain when imported item is undefined.
--- a/TODO
+++ b/TODO
@@ -44,4 +44,3 @@
- do everything in Haskell
- make a low level primError that takes a utf8 string
- get rid of noMatch and noDefault primitives
-* Fix bug: undefined in import list not reported
--- a/lib/Prelude.hs
+++ b/lib/Prelude.hs
@@ -61,7 +61,7 @@
import Data.Real(Real(..))
import Data.RealFloat
import Data.Records
-import Data.Semigroup((<>))
+import Data.Semigroup(Semigroup(..))
import Data.Tuple(()(..), fst, snd)
import System.IO
import Text.Show
--- a/src/MicroHs/TypeCheck.hs
+++ b/src/MicroHs/TypeCheck.hs
@@ -168,9 +168,17 @@
ts' = map (\ (TypeExport i e xvs) -> TypeExport i e $ filter (\ (ValueExport ii _) -> not hide || keep ii ivs) xvs) $
map (\ te@(TypeExport i e _) -> if keep i cts then te else TypeExport i e []) $
filter (\ (TypeExport i _ _) -> keep i its) ts
+ msg = "not exported"
in
+ checkBad msg (ivs \\ map (\ (ValueExport i _) -> i) vs) $
+ checkBad msg (its \\ map (\ (TypeExport i _ _) -> i) ts) $
--trace (show (ts, vs)) $
(imp, TModule mn fx ts' ss cs ins vs' a)
+
+checkBad :: String -> [Ident] -> a -> a
+checkBad _ [] a = a
+checkBad msg (i:_) _ =
+ errorMessage (getSLoc i) $ msg ++ ": " ++ showIdent i
-- Type and value exports
getTVExps :: forall a . M.Map (TModule a) -> TypeTable -> ValueTable -> AssocTable -> ClassTable -> ExportItem ->
--
⑨