ref: 51f905138babfc67f3291a40c8b5ddd7ec85b73d
parent: 44632872bf36b7de350ed6dfbd411b350b91cfa0
parent: 7ae7d07f0b97bce384239c1f7c1ae4d407e7524c
author: Lennart Augustsson <lennart@augustsson.net>
date: Mon Jan 6 07:05:27 EST 2025
Merge branch 'master' into mrnf
--- a/src/MicroHs/TypeCheck.hs
+++ b/src/MicroHs/TypeCheck.hs
@@ -1060,7 +1060,7 @@
let val i =
case stLookup "" i vt of
Right e -> ValueExport i e
- _ -> impossible
+ _ -> impossibleShow i
addAssocTable (qualIdent mn ti) (map val is)
assocData (Constr _ _ c (Left _)) = [c]
@@ -1067,7 +1067,8 @@
assocData (Constr _ _ c (Right its)) = c : map fst its
case adef of
- Data (i, _) cs _ -> addAssoc i (nub $ concatMap assocData cs)
+ Data (i, _) cs _ | not (isMatchDataTypeName i)
+ -> addAssoc i (nub $ concatMap assocData cs)
Newtype (i, _) c _ -> addAssoc i (assocData c)
Class _ (i, _) _ ms -> addAssoc i [ x | BSign ns _ <- ms, m <- ns, x <- [m, mkDefaultMethodId m] ]
_ -> return ()
@@ -2697,6 +2698,9 @@
mkMatchDataTypeName :: Ident -> Ident
mkMatchDataTypeName i = addIdentSuffix i "T"
+
+isMatchDataTypeName :: Ident -> Bool
+isMatchDataTypeName = isSuffixOf "%T" . unIdent
-- A pattern synonym always has a type of the form
-- forall vs1 . ctx1 => forall vs2 . ctx2 => ty