Skip to content

Commit af1c27d

Browse files
geo2aBinderDavid
andauthored
Document [GHC 59155] aka TcRnIllegalTupleSection (#510)
* Fill-in the template with stub data * Add examples from GHC's unit tests * Small changes --------- Co-authored-by: David Binder <[email protected]>
1 parent dac2f5b commit af1c27d

File tree

7 files changed

+75
-0
lines changed

7 files changed

+75
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{-# LANGUAGE Haskell2010 #-}
2+
{-# LANGUAGE TupleSections #-}
3+
4+
module IllegalTupleSection where
5+
6+
foo = (1,)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{-# LANGUAGE Haskell2010 #-}
2+
-- TupleSections not enabled
3+
4+
module IllegalTupleSection where
5+
6+
foo = (1,)
7+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Illegal tuple section
3+
---
4+
5+
## Error message
6+
7+
```
8+
IllegalTupleSection.hs:6:7: error: [GHC-59155]
9+
Illegal tuple section
10+
Suggested fix:
11+
Perhaps you intended to use the ‘TupleSections’ extension
12+
|
13+
6 | foo = (1,)
14+
| ^^^^
15+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE Haskell2010 #-}
2+
{-# LANGUAGE UnboxedTuples #-}
3+
{-# LANGUAGE TupleSections #-}
4+
5+
module IllegalUnboxedTupleSection where
6+
7+
foo = (# 1, #)
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE Haskell2010 #-}
2+
{-# LANGUAGE UnboxedTuples #-}
3+
-- TupleSections not enabled
4+
5+
module IllegalUnboxedTupleSection where
6+
7+
foo = (# 1, #)
8+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Illegal unboxed tuple section
3+
---
4+
5+
## Error message
6+
7+
```
8+
IllegalTupleSection.hs:7:7: error: [GHC-59155]
9+
Illegal tuple section
10+
Suggested fix:
11+
Perhaps you intended to use the ‘TupleSections’ extension
12+
|
13+
7 | foo = (# 1, #)
14+
| ^^^^^^^^
15+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: Illegal tuple section
3+
summary: A tuple section is used, but the TupleSections extension is not enabled
4+
severity: error
5+
introduced: 9.6.1
6+
---
7+
8+
One of the components in a tuple is missing, but the `TupleSections` GHC extension has not been enabled. Perhaps this is a typo? If not, and the use of the tuple section syntax is intentional, please enable the extension, for example by adding the following line:
9+
10+
```
11+
{-# LANGUAGE TupleSections #-}
12+
```
13+
14+
at the top of your file.
15+
16+
Please refer to the [`TupleSections` section](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/tuple_sections.html?highlight=tuplesection#extension-TupleSections) page of the GHC user guide to learn more about tuple sections.

0 commit comments

Comments
 (0)