[cvs-nhc98] cvs commit: hat/src/hattrans AuxFile.hs AuxLabelAST.hs TraceTrans.hs
olaf@glass.cse.ogi.edu
olaf@glass.cse.ogi.edu
Mon, 28 Apr 2003 02:59:02 -0700
olaf 2003/04/28 02:59:02 PDT
Modified files:
src/hattrans AuxFile.hs AuxLabelAST.hs TraceTrans.hs
Log:
Correct bugs in hx-file importing and renaming.
All the fixes are however rather "hacky" and still leave loopholes. However, knowbody in their right mind should write Haskell programs that fall through the loopholes.
Stephen Pitts reported the following problem with the Edison library.
Transforming ListSeq and compiling it yields:
Hat/ListSeq.hs:493:
Ambiguous occurrence `anull'
It could refer to either `Hat.ListSeq.anull', defined at Hat/ListSeq.hs:1261 or `Hat.PreludeBasic.anull', imported from Hat.Prelude at Hat/ListSeq.hs:23
...
and
Hat/ListSeq.hs:996: Variable not in scope: `ssingle'
...
The last errors are cause by code like
instance Hat.S.Sequence (T.List)
where
gempty pempty p = T.constUse pempty p sempty
sempty = T.constDef T.mkRoot a254v4empty (\ p -> gempty p254v12 p)
The problem is that the class Sequence is only imported qualified, and hence even inside the instance declaration "sempty" is not in scope, only the qualified id "Hat.S.sempty".
Now hat-trans qualfies such uses of shared variables with the same module id used in the qualification of the class id. In principal a method could be imported with a different qualifier than the class id...
The first sort of error messages is caused by attaching the wrong hx-file information to identifiers in import (especially hiding) lists. First of all attaching of info is now done only with information from imported files, not with information of locally defined identifiers that may hide the imported ones (they do not hide them in the import declarations). Second, information for identifiers in "hiding"-lists should not be imported for attaching information in the program body, but is needed for attaching information to the identifiers in the hiding-list! So hidden identifiers are now imported separately. This is rather inefficient and probably scopes of imported identifiers are still not handled completely correctly.
Revision Changes Path
1.26 +34 -6 hat/src/hattrans/AuxFile.hs
1.27 +29 -24 hat/src/hattrans/AuxLabelAST.hs
1.60 +32 -10 hat/src/hattrans/TraceTrans.hs