Skip to content

[#922] Fix recursive deriveRPC for Address

Nikolay Yakimov requested to merge lierdakil/#922-fix-derive-rpc into master

NB: this is a rather annoying bug tbh.

TODO:

  • Add a regression test using Lorentz.Hash type; the setup is the same, but some details are different.

Description

Problem: there's a logic error in findWithoutInstance that fails to consider instances for saturated type aliases. Thus when it encounters Address or potentially other type aliases for saturated types, it only looks for AsRPC instances of unsaturated types, i.e. in the case of Address that would be AsRPC (Constrained a), which obviously doesn't exist.

Solution: Change the order of checks: first check whether there's an instance, regardless whether the type is an alias or not, and only recurse if there isn't.

Related issue(s)

Resolves #922 (closed)

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)

Edited by Nikolay Yakimov

Merge request reports

Loading