Note [SPECIALISE pragmas for imported Ids]
An imported Id may or may not have an unfolding. If not, we obviously can't specialise it here; indeed the desugar falls over (#18118). We used to test whether it had a user-specified INLINABLE pragma but, because of Note [Worker/wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap, even an INLINABLE function may end up with a wrapper that has no pragma, just an unfolding (#19246). So now we just test whether the function has an unfolding. There's a risk that a pragma-free function may have an unfolding now (because it is fairly small), and then gets a bit bigger, and no longer has an unfolding in the future. But then you'll get a helpful error message suggesting an INLINABLE pragma, which you can follow. That seems enough for now.
References 1
- Worker/wrapper for INLINABLE functions GHC.Core.Opt.WorkWrap
Referenced by 1
- GHC.Tc.Gen.Sig call site