- else mkImplicitUnfolding rhs)
- -- Experimental: NOINLINE, so that their rule matches
-
- -- We no longer use 'must-inline' on record selectors. They'll
- -- inline like crazy if they scrutinise a constructor
+ else mkImplicitUnfolding rhs)
+ -- In module where class op is defined, we must add
+ -- the unfolding, even though it'll never be inlined
+ -- becuase we use that to generate a top-level binding
+ -- for the ClassOp
+
+ info | new_tycon = base_info
+ -- For newtype dictionaries, just inline the class op
+ -- See Note [Single-method classes] in TcInstDcls
+ | otherwise = base_info
+ `setSpecInfo` mkSpecInfo [rule]
+ `setInlinePragInfo` neverInlinePragma
+ -- Otherwise add a magic BuiltinRule, and never inline it
+ -- so that the rule is always available to fire.
+ -- See Note [ClassOp/DFun selection] in TcInstDcls