Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document GHC-42044 #446

Merged
merged 3 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_HUGS #-}
module UnrecognisedPragmas where

x :: Int
x = 42
{-# INLINE x #-}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{-# LANGUGE BangPatterns #-}
-- ^ missing A
{-# OPTION_HUGS #-}
-- ^ missing S
module UnrecognisedPragmas where

x :: Int
x = 42
{-# INLNE x #-}
-- ^ missing I

29 changes: 29 additions & 0 deletions message-index/messages/GHC-42044/example1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: <insert a title for this example here>
jhrcek marked this conversation as resolved.
Show resolved Hide resolved
---

Typos in pragma names leads to warnings being emitted. Fixing the typos makes the warnings go away.

## Error Message
```
UnrecognisedPragmas.hs:1:1: warning: [GHC-42044] [-Wunrecognised-pragmas]
Unrecognised pragma: LANGUGE
Suggested fix: Perhaps you meant ‘LANGUAGE’
|
1 | {-# LANGUGE BangPatterns #-}
| ^^^^^^^^^^^

UnrecognisedPragmas.hs:3:1: warning: [GHC-42044] [-Wunrecognised-pragmas]
Unrecognised pragma: OPTION_HUGS
Suggested fix: Perhaps you meant ‘OPTIONS_HUGS’
|
3 | {-# OPTION_HUGS #-}
| ^^^^^^^^^^^^^^^

UnrecognisedPragmas.hs:9:1: warning: [GHC-42044] [-Wunrecognised-pragmas]
Unrecognised pragma: INLNE
Suggested fix: Perhaps you meant ‘INLINE’
|
9 | {-# INLNE x #-}
| ^^^^^^^^^
```
11 changes: 11 additions & 0 deletions message-index/messages/GHC-42044/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Unrecognised pragma
summary: GHC didn't recognize pragma and will thus ignore it
severity: warning
flag: -Wunrecognised-pragmas
introduced: 9.6.1
---

GHC emits a warning whenever it encounters a pragma which it doesn't recognize. In these cases it just ignores the pragma, which might not be what you want.

This can indicate a typo in pragma name, in which case fixing a typo should make the warning go away. See GHC User Guide for list of [supported pragmas](https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/pragmas.html).
jhrcek marked this conversation as resolved.
Show resolved Hide resolved