Unknown extension flags should be a warning rather than an error
At the moment, attempting to enable an unknown extension results in a fatal error, e.g.
{-# LANGUAGE ScopedWombatPuns #-}
$ ghc-9.8.1-alpha1 ScopedWombatPuns.hs
ScopedWombatPuns.hs:1:14: error: [GHC-46537]
Unsupported extension: ScopedWombatPuns
|
1 | {-# LANGUAGE ScopedWombatPuns #-}
| ^^^^^^^^^^^^^^^^
$ ghc-9.8.1-alpha1 -XScopedWombatPuns
ghc-9.8.0.20230727: unrecognised flag: -XScopedWombatPuns
However, for warning flags, an unknown flag results in a warning:
$ ghc-9.8.1-alpha1 -Wscoped-wombat-puns
on the commandline: warning: [GHC-93741] [-Wunrecognised-warning-flags]
unrecognised warning flag: -Wscoped-wombat-puns
I think it would make more sense if unknown extensions were also a warning. After all, the user might be setting an extension that will be available in a future GHC release, or that was available in a past GHC release.
One downside is that this might conceal a typo, leading to unrelated errors because an extension was not enabled when the user thought it was. So perhaps this warning should be an error by default (but with the option for users to relax it)?
This came up in a ghc-proposal discussion: https://github.com/ghc-proposals/ghc-proposals/pull/601#discussion_r1298594553