Skip to content

fix: improve type specs for downstream type checkers#127

Merged
tsloughter merged 1 commit intoerleans:mainfrom
Taure:fix/improve-type-specs
Mar 26, 2026
Merged

fix: improve type specs for downstream type checkers#127
tsloughter merged 1 commit intoerleans:mainfrom
Taure:fix/improve-type-specs

Conversation

@Taure
Copy link
Copy Markdown
Contributor

@Taure Taure commented Mar 26, 2026

Summary

Improves type specifications in pgo.erl for better compatibility with gradual type checkers (eqWAlizer, Dialyzer):

  • Export additional types: pool/0, row/0, options/0, decode_option/0 — these are referenced in downstream code but weren't exported
  • Fix result() type: rows field typed as [row()] instead of bare list(), num_rows typed as non_neg_integer() instead of integer()
  • Fix checkout/checkin specs: Use pgo_pool:ref() instead of pgo_pool:pool_ref/0 which doesn't exist (the exported type is ref/0)

Motivation

When using pgo with eqWAlizer (WhatsApp's gradual type checker for Erlang), the untyped rows := list() and missing type exports cause cascading type errors in every downstream project. These changes are backwards-compatible and make the types more precise.

Test plan

  • rebar3 compile — passes
  • rebar3 eunit — 2 tests pass
  • rebar3 dialyzer — passes

- Export additional types: pool/0, row/0, options/0, decode_option/0
- Fix result() type: rows field uses [row()] instead of list()
- Fix result() type: num_rows uses non_neg_integer() instead of integer()
- Fix checkout/checkin specs: use pgo_pool:ref() (was pool_ref/0 which
  doesn't exist)
@tsloughter tsloughter merged commit 36efee8 into erleans:main Mar 26, 2026
4 checks passed
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.

2 participants