Re: Misleading error message for underscore patterns
Malcolm Wallace <[email protected]> Tue, 14 Jun 2005 11:21:50 +0100
| Newsgroups | gmane.comp.lang.haskell.nhc.bugs |
|---|---|
| Organization | Dept of Computer Science, University of York |
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --Multipart=_Tue__14_Jun_2005_11_21_50_+0100_1SDOB3bKf=GHrkW= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Tony Sloane <[email protected]> writes: > Not really a bug, but a confusion from a misleading error message. > The following code contains underscore identifier patterns which are > accepted by nhc98 when the -98 option is given: > > foo _2a = 1 > bar (T a _2b) = 1 > > (I don't have the H98 definition handy but I'm presuming that nhc is > correct in allowing these patterns in H98.) Yes, these patterns are legal H'98. It is wrong that nhc98 should complain about them when the -underscore flag is off (the default, except with -98). > However, when -98 is not present, errors are reported that are > misleading in that they refer to the "foo" and "bar" tokens, not the > bad patterns, and they don't complain about the patterns at all: > > 3:1-3:3 Found foo but expected a {-end-of-definition-or-EOF-} > 5:1-5:3 Found bar but expected a {-end-of-definition-or-EOF-} Yes, the lexical error is being transformed into a parse error, which is indeed confusing. This is easily fixed though. A patch is attached, and will appear in CVS shortly. Regards, Malcolm --Multipart=_Tue__14_Jun_2005_11_21_50_+0100_1SDOB3bKf=GHrkW= Content-Type: text/plain; name="patch.underscore" Content-Disposition: attachment; filename="patch.underscore" Content-Transfer-Encoding: base64 SW5kZXg6IHNyYy9jb21waWxlcjk4L0xleExvdy5ocw0KPT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KUkNTIGZpbGU6IC9o b21lL2N2cy9yb290L25oYzk4L3NyYy9jb21waWxlcjk4L0xleExvdy5ocyx2DQpyZXRyaWV2aW5n IHJldmlzaW9uIDEuOQ0KZGlmZiAtdSAtcjEuOSBMZXhMb3cuaHMNCi0tLSBzcmMvY29tcGlsZXI5 OC9MZXhMb3cuaHMJMzAgSnVuIDIwMDQgMTI6Mjk6MjggLTAwMDAJMS45DQorKysgc3JjL2NvbXBp bGVyOTgvTGV4TG93LmhzCTE0IEp1biAyMDA1IDEwOjIwOjQ1IC0wMDAwDQpAQCAtOTgsNyArOTgs OCBAQA0KICAgZWxzZSBpZiBpc0xvd2VyIHgNCiAgIHRoZW4gIGNhc2Ugc3BsaXRXaGlsZSBpc05o Y0lkIFtdIHhzIG9mDQogCSh2YXIseHMpIC0+IExFWF9WQVJJRCB2YXIgMCAobGVuZ3RoIHZhcikg eHMNCi0gIGVsc2UgTEVYX0VSUk9SIHggeHMNCistLWVsc2UgTEVYX0VSUk9SIHggeHMJLS0gbWF5 YmUgYmV0dGVyIHRvIGRyb3AgdGhyb3VnaCB0byBsb3dlcmNhc2U9VHJ1ZSA/DQorICBlbHNlIGxl eE9uZSBUcnVlIHhzDQogDQogbGV4T25lIFRydWUgeHNAKCdfJzpfKSA9DQogICBjYXNlIHNwbGl0 V2hpbGUgaXNOaGNJZCBbXSB4cyBvZg0K --Multipart=_Tue__14_Jun_2005_11_21_50_+0100_1SDOB3bKf=GHrkW= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nhc-bugs mailing list [email protected] http://www.haskell.org/mailman/listinfo/nhc-bugs --Multipart=_Tue__14_Jun_2005_11_21_50_+0100_1SDOB3bKf=GHrkW=--