Ticket #672 (closed bug: fixed)

Opened 7 years ago

Last modified 5 years ago

INLINE pragmas for default methods don't work

Reported by: simonpj Owned by: simonpj
Priority: normal Milestone: 6.6
Component: Compiler Version: 6.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

This should work:

  class C a where
    f :: (a -> a) -> [a] -> [a]
    {-# INLINE f #-}
    f g xs = reverse (map g (reverse xs))

  instance C Int

Now calling 'f' at Int should inline the code in the default method. Currently it doesn't, because we get

   dmf a d g xs = ...
   rec { dCInt = dmf Int dCInt }

and since dmf is applied to only one arg, but has arity 3, it isn't inlined, which is a bit silly.

If the class has more than one method, everythign works fine. (But I did fix a bug in TcClassDecl which prevented it working find in 6.4.)

Change History

Changed 7 years ago by simonpj

  • milestone set to 6.6

Changed 7 years ago by simonpj

  • status changed from new to closed
  • resolution set to fixed

So far as I can see, this works fine in both 6.4.2 and the HEAD. So I'm closing the bug.

Simon

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.