Skip to content

Add type restrictions to crypto directory#15694

Merged
straight-shoota merged 8 commits intocrystal-lang:masterfrom
Vici37:add-type-restrictions-to-crypto
Aug 7, 2025
Merged

Add type restrictions to crypto directory#15694
straight-shoota merged 8 commits intocrystal-lang:masterfrom
Vici37:add-type-restrictions-to-crypto

Conversation

@Vici37
Copy link
Contributor

@Vici37 Vici37 commented Apr 21, 2025

This is the output of compiling cr-source-typer and running it with the below incantation:

CRYSTAL_PATH="./src" ./typer spec/std_spec.cr \
  --error-trace --exclude src/crystal/ \
  --stats --progress \
  --union-size-threshold 2 \
  --ignore-private-defs \
  src/crypto

This is related to #15682 .

straight-shoota added a commit that referenced this pull request Apr 30, 2025
The test setup for `constant_time_byte_eq` is broken because types the parameters as `Int32 | UInt8`, but the method should only accept `UInt8` (ref #15694 (comment)).

Removing the data hash makes the test clean and slick. It's easier to understand what's going on.

For `constant_time_compare` there's no technical reason, but it still improves code quality.
@straight-shoota straight-shoota added this to the 1.18.0 milestone Aug 5, 2025
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
@straight-shoota straight-shoota merged commit 939bc34 into crystal-lang:master Aug 7, 2025
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants