diff --git a/message-index/messages/GHC-76037/example4/after/NoFieldSelectorsExport.hs b/message-index/messages/GHC-76037/example4/after/NoFieldSelectorsExport.hs new file mode 100644 index 00000000..1e3c37f8 --- /dev/null +++ b/message-index/messages/GHC-76037/example4/after/NoFieldSelectorsExport.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE NoFieldSelectors #-} + +module NoFieldSelectorsExport (T (foo)) where + +data T = MkT { foo :: T } diff --git a/message-index/messages/GHC-76037/example4/before/NoFieldSelectorsExport.hs b/message-index/messages/GHC-76037/example4/before/NoFieldSelectorsExport.hs new file mode 100644 index 00000000..7f81964e --- /dev/null +++ b/message-index/messages/GHC-76037/example4/before/NoFieldSelectorsExport.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE NoFieldSelectors #-} + +module NoFieldSelectorsExport (T, foo) where + +data T = MkT { foo :: T } diff --git a/message-index/messages/GHC-76037/example4/index.md b/message-index/messages/GHC-76037/example4/index.md new file mode 100644 index 00000000..30853f0e --- /dev/null +++ b/message-index/messages/GHC-76037/example4/index.md @@ -0,0 +1,20 @@ +--- +title: Field selector exported with NoFieldSelectors +--- + +## Error Message + +``` +NoFieldSelectorsExport.hs:3:35: error: [GHC-76037] + Not in scope: ‘foo’ + Suggested fix: + Notice that ‘foo’ is a field selector belonging to the type ‘T’ + that has been suppressed by NoFieldSelectors. + | +3 | module NoFieldSelectorsExport (T, foo) where + | ^^^ +``` + +## Explanation + +The field selector `foo` has been disabled via `NoFieldSelectors`, therefore it cannot be a top-level export. The fix is to export it as part of its type `T` (consequently it can be imported for e.g. record creation or updates).