Skip Menu |

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 121478
Status: resolved
Priority: 0/
Queue: Type-Tiny

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc: SHLOMIF [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 1.001_006
  • 1.001_002
  • 1.001_003
  • 1.001_004
  • 1.001_005
Fixed in: (no value)



CC: SHLOMIF [...] cpan.org
Subject: 1.001_006 breaks SHLOMIF/AI-Pathfinding-OptimizeMultiple-0.0.13.tar.gz
If Type::Tiny 1.001_006 is installed, then the test suite of AI-Pathfinding-OptimizeMultiple-0.0.13 breaks: ... Reference bless( do{\(my $o = 39170512)}, 'PDL' ) did not pass type constraint "Int" (in $args->{"num_solved"}) at /tmpfs/.cpan-build-cpansand/2017050100/AI-Pathfinding-OptimizeMultiple-0.0.13-0/blib/lib/AI/Pathfinding/OptimizeMultiple.pm line 264 "Int" is a subtype of "Num" "Num" is a subtype of "LaxNum" "LaxNum" is a subtype of "Str" "Str" is a subtype of "Value" Reference bless( do{\(my $o = 39170512)}, 'PDL' ) did not pass type constraint "Value" (in $args->{"num_solved"}) "Value" is defined as: (defined($_) and not ref($_)) # Looks like your test exited with 255 before it could output anything. t/optimize-multiple-full-test.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 4/4 subtests ... This does not happen with older Type::Tiny versions.
RT-Send-CC: SHLOMIF [...] cpan.org
On 2017-05-01 03:52:49, SREZIC wrote: Show quoted text
> If Type::Tiny 1.001_006 is installed, then the test suite of AI- > Pathfinding-OptimizeMultiple-0.0.13 breaks: > > ... > Reference bless( do{\(my $o = 39170512)}, 'PDL' ) did not pass type > constraint "Int" (in $args->{"num_solved"}) at /tmpfs/.cpan-build- > cpansand/2017050100/AI-Pathfinding-OptimizeMultiple-0.0.13- > 0/blib/lib/AI/Pathfinding/OptimizeMultiple.pm line 264 > "Int" is a subtype of "Num" > "Num" is a subtype of "LaxNum" > "LaxNum" is a subtype of "Str" > "Str" is a subtype of "Value" > Reference bless( do{\(my $o = 39170512)}, 'PDL' ) did not pass > type constraint "Value" (in $args->{"num_solved"}) > "Value" is defined as: (defined($_) and not ref($_)) > # Looks like your test exited with 255 before it could output > anything. > t/optimize-multiple-full-test.t .. > Dubious, test returned 255 (wstat 65280, 0xff00) > Failed 4/4 subtests > ... > > This does not happen with older Type::Tiny versions.
Type-Tiny-1.001_001 is the last version which coexists fine with AI-Pathfinding-OptimizeMultiple' test suite. Failures start with Type-Tiny-1.001_002.
RT-Send-CC: SHLOMIF [...] cpan.org
Show quoted text
> Reference bless( do{\(my $o = 39170512)}, 'PDL' ) did not pass type > constraint "Int" (in $args->{"num_solved"})
This is because of this change noted in the changelog: - Inlined version of Types::Standard::Int should check that the value is not a reference. That is under certain circumstances, Type::Tiny forgot to check that a value claiming to be an Int wasn't a reference. An object which overloaded stringification (NOT numification!) to return a string that matched /\A-?[0-9]+\z/ would SOMETIMES pass the constraint. This was a bug — it should have never passed. If AI::PathFinding::OptimizeMultiple needs to allow overloaded objects, the simplest way would be to replace: isa => 'Int' with: isa => 'Int | Overload[+0]' It's not perfect, because it doesn't actually *call* the object's numeric overloading to check the returned value is an integer. (But even before, that wasn't happening because it was calling the string overloading!) If you go that route, remember to also fix things like ArrayRef[Int].
CC: SREZIC [...] cpan.org, SHLOMIF [...] cpan.org
Subject: Re: [rt.cpan.org #121478] 1.001_006 breaks SHLOMIF/AI-Pathfinding-OptimizeMultiple-0.0.13.tar.gz
Date: Mon, 1 May 2017 14:17:58 +0300
To: "Toby Inkster via RT" <bug-Type-Tiny [...] rt.cpan.org>
From: Shlomi Fish <shlomif [...] shlomifish.org>
Hi all, On Mon, 1 May 2017 05:10:30 -0400 "Toby Inkster via RT" <bug-Type-Tiny@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=121478 > >
> > Reference bless( do{\(my $o = 39170512)}, 'PDL' ) did not pass type > > constraint "Int" (in $args->{"num_solved"})
> > This is because of this change noted in the changelog: > > - Inlined version of Types::Standard::Int should check that the value is > not a reference. > > That is under certain circumstances, Type::Tiny forgot to check that a value > claiming to be an Int wasn't a reference. An object which overloaded > stringification (NOT numification!) to return a string that > matched /\A-?[0-9]+\z/ would SOMETIMES pass the constraint. >
I fixed it in version 0.0.14 of AI-P-OM which was uploaded to CPAN. You can close this report. Regards, Shlomi