[cvs-nhc98] patch applied (hat): Correct bugs in hx-file importing and renaming.

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Oct 10 07:25:00 EDT 2006


Mon Apr 28 02:59:01 PDT 2003  olaf
  * 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.

    M ./src/hattrans/AuxFile.hs -6 +34
    M ./src/hattrans/AuxLabelAST.hs -23 +28
    M ./src/hattrans/TraceTrans.hs -10 +32


More information about the Cvs-nhc98 mailing list