summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorOleg Grenrus <oleg.grenrus@iki.fi>2023-01-03 23:40:48 +0200
committerOleg Grenrus <oleg.grenrus@iki.fi>2023-05-16 07:59:21 +0300
commitbdb93cd28f4a40e9a9f28b0976ca8fa4f250cad2 (patch)
tree4b61e2541b49be36f20a07b05a9625d791e2177e /docs
parenta8f0435fc5516ad978064eeabcc24776b6b86351 (diff)
downloadhaskell-bdb93cd28f4a40e9a9f28b0976ca8fa4f250cad2.tar.gz
Add -Wmissing-role-annotations
Implements #22702
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/using-warnings.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 577bce0a74..922a9638c0 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -2393,6 +2393,28 @@ of ``-W(no-)*``.
When :ghc-flag:`-Wterm-variable-capture` is enabled, GHC warns against implicit quantification
that would stop working under ``RequiredTypeArguments``.
+.. ghc-flag:: -Wmissing-role-annotations
+ :shortdesc: warn when type declarations don't have role annotations
+ :type: dynamic
+ :reverse: -Wno-role-annotations-signatures
+ :category:
+
+ :since: 9.8
+ :default: off
+
+ .. index::
+ single: roles, missing
+
+ If you would like GHC to check that every data type definition
+ has a :ref:`role annotation <role-annotations>`, use the
+ :ghc-flag:`-Wmissing-role-annotations` option.
+ You can specify the role via :extension:`RoleAnnotations`.
+
+ GHC will not warn about type class definitions with missing role annotations,
+ as their default roles are the strictest: all nominal.
+ In other words the type-class role cannot be accidentally left
+ representational or phantom, which could affected the code correctness.
+
If you're feeling really paranoid, the :ghc-flag:`-dcore-lint` option is a good choice.
It turns on heavyweight intra-pass sanity-checking within GHC. (It checks GHC's