[project @ 2000-08-17 16:28:44 by simonmar]
authorsimonmar <unknown>
Thu, 17 Aug 2000 16:28:44 +0000 (16:28 +0000)
committersimonmar <unknown>
Thu, 17 Aug 2000 16:28:44 +0000 (16:28 +0000)
Replace a zipEqual with a zip in tcPat when checking a record pat.
The former version caused a panic with DEBUG on if a record pattern
was used with a non-record constructor.

ghc/compiler/typecheck/TcPat.lhs

index e0cb157..e5b8847 100644 (file)
@@ -213,9 +213,11 @@ tcPat tc_bndr pat@(RecPatIn name rpats) pat_ty
        -- Check the constructor itself
     tcConstructor pat name pat_ty      `thenTc` \ (data_con, ex_tvs, dicts, lie_avail1, arg_tys) ->
     let
-       field_tys = zipEqual "tcPat" 
-                            (map fieldLabelName (dataConFieldLabels data_con))
-                            arg_tys
+       -- not zipEqual: if the constructor isn't really a record, then
+       -- dataConFieldLabels will be empty (and each field in the pattern
+       -- will generate an error below).
+       field_tys = zip (map fieldLabelName (dataConFieldLabels data_con))
+                       arg_tys
     in
 
        -- Check the fields