Skip to content

[TM-379] Go into deep lambdas in dfsInstr

Ivan Gromakovskii requested to merge gromak/tm379-dfs-instr-lambdas into master

Description

Problem: dfsInstr has a flag that specifies whether it should be applied to instructions inside lambdas. When this flag is enabled, it applies recursion to PUSH lambda case. But it treats all other PUSHes as if they didn't contain any instructions. However, there can be values of a type different from lambda that contain instructions, e. g. pair a (lambda b c). Currently instructions in such values are ignored.

Solution: apply dfsValue when we encounter PUSH regardless of the type of the pushed value. This dfsValue's step recursively calls our dfsInstr. The test added in this commit confirms there was this problem.

Related issue(s)

https://issues.serokell.io/issue/TM-379

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Merge request reports