Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix issues with Int.new
- Fix wrong error (default constructor blah blah) with wrong args
- Fix subclassed Ints returning an Int instead of subclass

Fixes RT#132128: https://rt.perl.org/Ticket/Display.html?id=132128
  • Loading branch information
zoffixznet committed Sep 19, 2017
1 parent de56c05 commit 0834036
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/core/Int.pm
Expand Up @@ -22,11 +22,15 @@ my class Int does Real { # declared in BOOTSTRAP
ObjAt
)
}
multi method new($value) {
# clone to ensure we return a new object for any cached
# numeric constants
$value.Int.clone;

proto method new(|) {*}
multi method new( \value) { self.new: value.Int }
multi method new(int \value) { nqp::box_i(value,self.WHAT) }
multi method new(Int:D \value = 0) {
nqp::p6bindattrinvres(self.bless, Int,'$!value',
nqp::getattr(nqp::decont(value),Int,'$!value'))
}

multi method perl(Int:D:) {
self.Str;
}
Expand Down

0 comments on commit 0834036

Please sign in to comment.