Skip to content

?LET macro interferes with resize combinator in recursive generators #323

@lbueso

Description

@lbueso

I found that the ?LET macro interferes with the resize combinator in recursive generators.

This is an example

my_list(Gen) ->
    ?SIZED(Size, if Size == 0 -> [];
                    true -> [Gen | resize(Size - 1, my_list(Gen))]
                 end).

my_list1(Gen) ->
    ?SIZED(Size, if Size == 0 -> [];
                    true -> [Gen | resize(Size - 1, ?LET(Xs, my_list1(Gen), Xs))]
                 end).

The function my_list is able to generate lists but my_list1 halts.

It looks like the size used by the generator inside ?LET corresponds to the outer size and not to the size computed by resize.

Expected Behaviour:

I would expect these generators to be equivalent.

Environment

  • PropEr version: 1.5.0
  • Erlang/OTP version: 28.0

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