Opened 9 years ago

Closed 9 years ago

#4397 closed bug (fixed)

RULES for Class ops don't fire in HEAD

Reported by: Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.1
Keywords: RULES, classes Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


For the attached programme, compiled with 7.1.20101010, the rule truncate/Double->Int doesn't fire, resulting in

const 0    took   0.004000s
truncate   took   0.940059s
double2Int took   0.032002s

i.e. truncate is not rewritten to double2Int, although it is given an explicit type signature (same behaviour without a type signature).

-ddump-rule-firings lists

Rule fired: Class op truncate

among (if I haven't miscounted) 41 Class op xxx rules.

That behaviour keeps the fix for #2271 from working and is a severe regression for #1434 .

IMO it's a show-stopper.

Attachments (1)

rulesTest.hs (1.3 KB) - added by 9 years ago.
example for non-firing RULE for a class method

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by

Attachment: rulesTest.hs added

example for non-firing RULE for a class method

comment:1 Changed 9 years ago by

Same behaviour from ghc-

comment:2 Changed 9 years ago by simonpj

Ah yes I see. Thanks for identifying this flaw. It's all in Rules.isMoreSpecific, which looks wrong to me. I'll validate a fix.


comment:3 Changed 9 years ago by simonpj

Fixed by

Fri Oct 15 14:18:14 BST 2010
  * Give user-defined rules precedence over built-in rules
  This fixes Trac #4397.  See comments with 'isMoreSpecific'.

Try now.


comment:4 Changed 9 years ago by

Resolution: fixed
Status: newclosed

Yes, works now. Muchas Gracias.

Note: See TracTickets for help on using tickets.