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

Disable x-partial warnings in tests (uses of head and tail) #570

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

Lysxia
Copy link
Contributor

@Lysxia Lysxia commented Mar 13, 2024

Those new warnings added in GHC 9.8. The uses in the test suite are either safe or explicitly intended to test the error case (via =^= in tests/Tests/Utils.hs).

Here are the relevant build logs that this PR hides:


tests/Tests/ShareEmpty.hs:110:60: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘head’
    (imported from Data.List, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
110 |   , testCase "inits _ = [empty, ...]" $ assertPtrEqEmpty $ L.head $ T.inits "123"
    |                                                            ^^^^^^

tests/Tests/Properties/Basics.hs:62:21: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
62 | s_head            = head   `eqP` S.head
   |                     ^^^^

tests/Tests/Properties/Basics.hs:63:28: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
63 | sf_head (applyFun -> p) = (head . L.filter p) `eqP` (S.head . S.filter p)
   |                            ^^^^

tests/Tests/Properties/Basics.hs:64:21: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
64 | t_head            = head   `eqP` T.head
   |                     ^^^^

tests/Tests/Properties/Basics.hs:65:21: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
65 | tl_head           = head   `eqP` TL.head
   |                     ^^^^

tests/Tests/Properties/Basics.hs:70:21: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
70 | s_tail            = tail   `eqP` (unpackS . S.tail)
   |                     ^^^^

tests/Tests/Properties/Basics.hs:71:21: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
71 | s_tail_s          = tail   `eqP` (unpackS . S.unstream . S.tail)
   |                     ^^^^

tests/Tests/Properties/Basics.hs:72:28: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
72 | sf_tail (applyFun -> p) = (tail . L.filter p) `eqP` (unpackS . S.tail . S.filter p)
   |                            ^^^^

tests/Tests/Properties/Basics.hs:73:21: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
73 | t_tail            = tail   `eqP` (unpackS . T.tail)
   |                     ^^^^

tests/Tests/Properties/Basics.hs:74:21: warning: [GHC-63394] [-Wx-partial]
Warning:     In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
74 | tl_tail           = tail   `eqP` (unpackS . TL.tail)
   |                     ^^^^

@Bodigrim Bodigrim merged commit f0a7d04 into master Mar 13, 2024
47 of 51 checks passed
@Bodigrim Bodigrim deleted the no-x-partial branch March 13, 2024 19:46
@Bodigrim
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants