xslate / p5-Mouse

Lightweight class builder for Perl, as a subset of Moose
https://metacpan.org/release/Mouse
Other
46 stars 32 forks source link

Fix an edge case of non-Int being wrongly validated as Int #103

Open gugod opened 5 years ago

gugod commented 5 years ago

This PR is basically a port of the issue #8 in Type::Tiny::XS repo as well as PR #9 to Mouse::XS.

The newly added test file includes the fail test cases provided by @Ovid and @haarg. I expend it to include some other scenarios too.

gugod commented 5 years ago

https://metacpan.org/changes/distribution/Type-Tiny-XS#L9

Latest release of Type::Tiny::XS already include the same changes.

skaji commented 5 years ago

@gugod Can you take a look at CI failures?

gugod commented 5 years ago

@skaji I committed an extra edge case 6d9d77901a0453764ce0ee792c7a9ed3ff5d3bc8 that failed with Mouse::XS, but passed with Mouse::PurePerl. More described at #104

But now I realize that this becomes a release blocker... I will revert that commit so the rest of this PR can be reviewed and released.

gugod commented 5 years ago

https://travis-ci.org/gugod/p5-Mouse/builds/582260726

I tweaked travis config to run this branch with all stable versions.

It looks like this PR cannot be directly applied for perl5 versions older than perl-5.18. I'll see what I can do keep them supported.

gugod commented 5 years ago

@skaji The latest commit fix the regressions. There were all related to magic SVs and evidently magic SVs effect SV flags differently in new perl versions. At the end, SvIOKp() is still used, but only on magic SVs, as I cloudn't find other slots that also provides states the "Integer-ness" of an SV.

passed for all perl versions: https://travis-ci.org/gugod/p5-Mouse/builds/582310868