Commit ab4d1589 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot
Browse files

typecheck: Drop SPECIALISE pragmas when there is no unfolding

Previously the desugarer would instead fall over when it realized that
there was no unfolding for an imported function with a SPECIALISE
pragma. We now rather drop the SPECIALISE pragma and throw a warning.

Fixes #18118.
parent acf537f9
......@@ -826,9 +826,13 @@ tcImpPrags prags
tcImpSpec :: (Name, Sig GhcRn) -> TcM [TcSpecPrag]
tcImpSpec (name, prag)
= do { id <- tcLookupId name
; unless (isAnyInlinePragma (idInlinePragma id))
(addWarnTc NoReason (impSpecErr name))
; tcSpecPrag id prag }
; if isAnyInlinePragma (idInlinePragma id)
then tcSpecPrag id prag
else do { addWarnTc NoReason (impSpecErr name)
; return [] } }
-- If there is no INLINE/INLINABLE pragma there will be no unfolding. In
-- that case, just delete the SPECIALISE pragma altogether, lest the
-- desugarer fall over because it can't find the unfolding. See #18118.
impSpecErr :: Name -> SDoc
impSpecErr name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment