Pattern guards can break linearity
Summary
Patterns, in pattern-guards guards are not checked for linearity. Which let's us write incorrect program with respect to linearity. The linter rightfully rejects those.
Steps to reproduce
This typechecks but should not:
{-# LANGUAGE LinearTypes #-}
unsafeConsume :: a #-> ()
unsafeConsume x | _ <- x = ()
Environment
- GHC version used: master 3656dff8
Note
Originally reported by Roman Cheplyaka.