diff options
Diffstat (limited to 'testsuite/tests/overloadedrecflds/should_fail/DRFUnused.hs')
-rw-r--r-- | testsuite/tests/overloadedrecflds/should_fail/DRFUnused.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/DRFUnused.hs b/testsuite/tests/overloadedrecflds/should_fail/DRFUnused.hs new file mode 100644 index 0000000000..faaec9624c --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/DRFUnused.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE TypeApplications #-} +{-# OPTIONS_GHC -Werror=unused-top-binds #-} + +module DRFUnused (S(MkS), x, y) where + +import GHC.Records + +data S = MkS { foo :: Int } +data T = MkT { foo :: Int } +data U = MkU { foo :: Int } + +-- Should count as a use of the foo field belonging to T, but not the others. +x = getField @"foo" (MkT 42) + +-- Should count as a use of the foo field belonging to U, but not the others. +y = foo (MkU 42 :: U) |