[cvs-nhc98] cvs commit: hat/src/hattrans AuxFile.hs TraceId.hs

olaf@glass.cse.ogi.edu olaf@glass.cse.ogi.edu
Thu, 24 Apr 2003 08:57:16 -0700


olaf        2003/04/24 08:57:16 PDT

  Modified files:
    src/hattrans         AuxFile.hs TraceId.hs 
  Log:
  Correct bug in expansion of type synonyms of hat-trans.
  
  Malcolm Wallace reported the following bug:
  
      ----Id.hs----
      module Id (Id) where
      type Id = Int
  
      ----Bug.hs----
      module Bug where
      import Id
      type Foo = ((Bool,Char) -> Id)
  
  Try "hmake -hat Bug", and you will see the compiler error message
  
      Type constructor Id___1 used at 13:16 is not defined.
  
  The hat-trans'd files look like this:
  
      ----Hat/Id.hs----
      ...
      type Id = Int
      ----Hat/Bug.hs----
      ...
      type Foo = T.Fun (T.Tuple2 Bool Char) Id
      type Foo___1 = T.Tuple2 Bool Char
      type Foo___2 = Id___1
  
  and clearly the module Hat.Id does not define Id___1.
  
  The problem was that the type synonyms that might need expansion because they occur right of the function arrow are always expanded, even if their definition does not contain any function arrows. Restricting the type synonym expansion was very easy (however, required two changes of a nearly duplicated function; because of the duplication problem for interface files and the actual transformation).
  
  Revision  Changes    Path
  1.25      +1 -1      hat/src/hattrans/AuxFile.hs
  1.20      +1 -1      hat/src/hattrans/TraceId.hs