Skip to content

Commit

Permalink
Add explanation for GHC-97170.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmikus authored and BinderDavid committed Jun 17, 2024
1 parent c085855 commit 5bb2f29
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{-# LANGUAGE RoleAnnotations #-}
module DoubleRoleAnnotationOnData where

data Foo a = MkFoo a
type role Foo nominal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{-# LANGUAGE RoleAnnotations #-}
module DoubleRoleAnnotationOnData where

data Foo a = MkFoo a
type role Foo nominal
type role Foo representational
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Double role annotation on datatype
---

## Error Message

```
DoubleRoleAnnotationOnData.hs:6:1: error: [GHC-97170]
Duplicate role annotations for ‘Foo’:
type role Foo nominal
-- written at DoubleRoleAnnotationOnData.hs:5:1-21
type role Foo representational
-- written at DoubleRoleAnnotationOnData.hs:6:1-30
|
6 | type role Foo representational
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

11 changes: 11 additions & 0 deletions message-index/messages/GHC-97170/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Duplicate role annotations
summary: A type declaration has more than one accompanying role annotation
severity: error
introduced: 9.8.1
---

This error occurs if more than one role annotation occurs for a given datatype.
Note that the role annotations need not be conflicting for this error to arise.
Also note that the role annotations can occur in different locations from the
datatype.

0 comments on commit 5bb2f29

Please sign in to comment.