Skip to content

Conversation

@jmid
Copy link
Collaborator

@jmid jmid commented May 17, 2023

I was too eager optimizing the list shrinker in #277 where the optimization of the 2-element case in the below code

  let rec list_spine l yield =
    let rec split l len acc = ... in
    match l with
    | [] -> ()
    | [_] -> yield []
    | [x;y] -> yield []; yield [x]; if x <> y then yield [y]
    | ...

may raise an exception if the list happens to contain function values:

# QCheck.Shrink.list_spine [pred;succ] ignore;;
Exception: Invalid_argument "compare: functional value".

This just bit me in qcheck-lin, so this PR

  • rolls back the list_spine optimization and
  • adds a regression test to the test suite.

Afterwards I plan to roll a 0.21.1 bugfix release.

@jmid jmid changed the title Regressiom: Revert shrinker fix Regression: Revert shrinker fix May 17, 2023
@jmid jmid merged commit 4a5b754 into c-cube:main May 19, 2023
@jmid jmid deleted the revert-shrinker-fix branch May 19, 2023 15:43
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.

1 participant