Skip to content
This repository was archived by the owner on Nov 1, 2018. It is now read-only.

Commit 1332129

Browse files
committed
fix for incorrect fix for forall/exists check
1 parent 3666eda commit 1332129

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

EHC/src/ehc/ConfigInternalVersions.chs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ internalVersionCombined =
3535

3636
%%[50 hs export(internalVersionTySys, internalVersionCodeGen, internalVersionHI, internalVersionCore, internalVersionCoreRun, internalVersionHS)
3737
-- | For variation in type inferencing
38-
internalVersionTySys = mkInternalVersion 1
38+
internalVersionTySys = mkInternalVersion 2
3939

4040
-- | For variation in code gen
4141
internalVersionCodeGen = mkInternalVersion 1

EHC/src/ehc/Ty.cag

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ tyQu_KiExists = TyQu_Exists metaLevTy
551551
%%% Properties of quantifier
552552
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
553553

554-
%%[(4 hmtyinfer || hmtyast) hs export(tyquIsExists, tyquIsForall)
554+
%%[(4 hmtyinfer || hmtyast) hs export(tyquEqModuloLev, tyquIsExists, tyquIsForall)
555555
tyquIsExists, tyquIsForall :: TyQu -> Bool
556556
%%]
557557

@@ -561,6 +561,10 @@ tyquIsForall _ = False
561561

562562
tyquIsExists (TyQu_Exists _) = True
563563
tyquIsExists _ = False
564+
565+
tyquEqModuloLev (TyQu_Forall {}) (TyQu_Forall {}) = True
566+
tyquEqModuloLev (TyQu_Exists {}) (TyQu_Exists {}) = True
567+
tyquEqModuloLev _ _ = False
564568
%%]
565569

566570
%%[(4 hmtyinfer || hmtyast) hs export(tyquMetaLev)

EHC/src/ehc/Ty/FitsIn.chs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,13 @@ fitsInFI fi ty1 ty2
461461
(uqt,rtvs,instto) = tyInst1Quants uq howToInst t
462462
back = if hide then \fo -> foSetVarMp (varmpDel rtvs (foVarMp fo)) $ foUpdTy t fo
463463
else id
464+
465+
-- removal of multiple quantifiers
466+
unquants fi t@(Ty_TBind {qu_Ty_TBind=q}) qu howToInst | qu `tyquEqModuloLev` q
467+
= unquants fi' t' qu howToInst
468+
where (fi', t', _, _) = unquant fi t False howToInst
469+
unquants fi t _ _
470+
= (fi, t)
464471
%%]
465472

466473
%%[(41 hmtyinfer).fitsIn.eqProofAssume
@@ -1191,12 +1198,12 @@ GADT: when encountering a product with eq-constraints on the outset, remove them
11911198
%%[(4 hmtyinfer).fitsIn.QLR
11921199
fBase fi updTy t1@(Ty_TBind {qu_Ty_TBind=q1}) t2@(Ty_TBind {qu_Ty_TBind=q2})
11931200
| fiom `elem` [FitSubLR,FitUnify]
1194-
= if q1 == q2
1201+
= if q1 `tyquEqModuloLev` q2
11951202
then fVar' fTySyn fi2 id uqt1 uqt2
11961203
else errClash fi t1 t2
11971204
where fiom = fioMode (fiFIOpts fi)
1198-
(fi1,uqt1,_,_) = unquant fi t1 False instCoConst
1199-
(fi2,uqt2,_,_) = unquant fi1 t2 False (if fiom == FitSubLR then instContra else instCoConst)
1205+
(fi1,uqt1) = unquants fi t1 q1 instCoConst
1206+
(fi2,uqt2) = unquants fi1 t2 q1 (if fiom == FitSubLR then instContra else instCoConst)
12001207
%%]
12011208

12021209
%%[(4 hmtyinfer).fitsIn.QR

0 commit comments

Comments
 (0)