[cvs-nhc98] Fix for Mark Tehver's bug report.

Malcolm Wallace malcolm@sparud.net
Fri, 17 Aug 2001 16:04:16 +0200 (CEST)


malcolm: Fri Aug 17 16:04:15 CEST 2001

Update of /usr/src/master/nhc/src/compiler98
In directory hinken:/tmp/cvs-serv18367

Modified Files:
	Need.hs 
Log Message:
Fix for Mark Tehver's bug report.

    module Test2(Test(..)) where
    data Test {a0::Int, b0::Int}

    module Test1(fn) where
    import Test2
    fn (Test {a0=a}) = a0 t + a

gave "Unbound Identifier a0" error.  The error was only visible with
the combination of three circumstances:
  * field name is imported
  * field name is used in a lhs pattern
  * field name is also used as a selector on the rhs of the *same* equation.

The fault was that the need-analysis was binding the selector name
as if it were a pattern variable for the equation (as with puns), rather
than generating a need for the imported selector.