Skip to content

Commit

Permalink
Make sure Date.new-from-daycount takes right candidate
Browse files Browse the repository at this point in the history
For some reason, this candidate was also selected fopr Date:D objects.
Make the use for Date type objects explicit.

Appears to fix problem mentioned in:

    https://stackoverflow.com/questions/57270373/date-object-forgets-formatter
  • Loading branch information
lizmat committed Jul 30, 2019
1 parent 1d52683 commit ac11774
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Date.pm6
Expand Up @@ -91,7 +91,7 @@ my class Date does Dateish {
self.new(DateTime.new($i),:&formatter,|%_)
}
proto method new-from-daycount($) {*}
multi method new-from-daycount($daycount,:&formatter --> Date:D) {
multi method new-from-daycount(Date:U: $daycount,:&formatter --> Date:D) {
self!ymd-from-daycount($daycount, my $year, my $month, my $day);
nqp::eqaddr(self.WHAT,Date)
?? nqp::create(self)!SET-SELF($year,$month,$day,&formatter,$daycount)
Expand Down

1 comment on commit ac11774

@lizmat
Copy link
Contributor Author

@lizmat lizmat commented on ac11774 Aug 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed with 971d4bf . Would really appreciate a PR for tests :-)

Please sign in to comment.