Skip to content

Non-deterministic results from noThunksInValues #15

Closed
@sjakobi

Description

@sjakobi

I'm getting non-deterministic results for a regression test in unordered-containers.

You can find the code at https://github.com/sjakobi/unordered-containers/tree/nothunks-issue. Run the test with

$ cabal run tests -- -p issue383

With GHC 9.2.2 I'm getting failures and successes in roughly equal proportion.

If I remove the source of randomness in the test with

--- a/tests/Regressions.hs
+++ b/tests/Regressions.hs
@@ -198,7 +198,7 @@ instance Functor MyIdentity where
 
 issue383 :: Assertion
 issue383 = do
-  i :: Int <- randomIO
+  let i :: Int = 42
   let f Nothing = MyIdentity (Just (show i))
       f Just{}  = MyIdentity (error "Nah")
   let (MyIdentity m) = HMS.alterF f () mempty

… I get consistent successes with GHC 9.2.2 and consistent failures with GHC 9.0.2.

The expected test result is a success, independent of the value of i.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions