Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LTA ERROR] Date/DateTime lie about constructors taking only named args #5006

Closed
p6rt opened this issue Jan 6, 2016 · 5 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Jan 6, 2016

Migrated from rt.perl.org#127186 (status was 'resolved')

Searchable as RT127186$

@p6rt
Copy link
Author

p6rt commented Jan 6, 2016

From @zoffixznet

As can be seen in the examples below. Both Date and DateTime types' .new methods *do* in fact take positional arguments, but when the positional arguments are not of the acceptable type, the error message actually says NO type of positional arguments could be valid and only named arguments can be used.

<ZoffixW> m​: say DateTime.new​: $/
<camelia> rakudo-moar 505dc4​: OUTPUT«Default constructor for 'DateTime' only takes named arguments␤ in block <unit> at /tmp/UtZ8VCWpQi line 1␤␤»
<ZoffixW> m​: say DateTime.new​: 42
<camelia> rakudo-moar 505dc4​: OUTPUT«1970-01-01T00​:00​:42Z␤»
<ZoffixW> m​: say Date.new​: 42
<camelia> rakudo-moar 505dc4​: OUTPUT«Default constructor for 'Date' only takes named arguments␤ in block <unit> at /tmp/wfQ5W1HwfH line 1␤␤»
<ZoffixW> m​: say Date.new​: '2015-11-11'
<camelia> rakudo-moar 505dc4​: OUTPUT«2015-11-11␤»

@p6rt
Copy link
Author

p6rt commented Jan 6, 2016

From @moritz

On Wed Jan 06 05​:31​:43 2016, cpan@​zoffix.com wrote​:

As can be seen in the examples below. Both Date and DateTime types'
.new methods *do* in fact take positional arguments, but when the
positional arguments are not of the acceptable type, the error message
actually says NO type of positional arguments could be valid and only
named arguments can be used.

<ZoffixW> m​: say DateTime.new​: $/
<camelia> rakudo-moar 505dc4​: OUTPUT«Default constructor for
'DateTime' only takes named arguments␤ in block <unit> at
/tmp/UtZ8VCWpQi line 1␤␤»
<ZoffixW> m​: say DateTime.new​: 42
<camelia> rakudo-moar 505dc4​: OUTPUT«1970-01-01T00​:00​:42Z␤»
<ZoffixW> m​: say Date.new​: 42
<camelia> rakudo-moar 505dc4​: OUTPUT«Default constructor for 'Date'
only takes named arguments␤ in block <unit> at /tmp/wfQ5W1HwfH line
1␤␤»
<ZoffixW> m​: say Date.new​: '2015-11-11'
<camelia> rakudo-moar 505dc4​: OUTPUT«2015-11-11␤»

Fixed with
rakudo/rakudo@c19142cf26:
moritz@​hack​:~/p6/rakudo$ ./perl6-m -e 'say Date.new(Any)'
Cannot call new(Date​: Any); none of these signatures match​:
  (Date $​: $year, $month, $day, :&formatter, *%_)
  (Date $​: :$year!, :$month = { ... }, :$day = { ... }, :&formatter, *%_)
  (Date $​: Str $date, :&formatter, *%_)
  (Date $​: Dateish $d, :&formatter, *%_)
  (Date $​: Instant $i, :&formatter, *%_)
  (Dateish $​: *%_)
  in block <unit> at -e line 1

Tests needed.

@p6rt
Copy link
Author

p6rt commented Jan 6, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Mar 12, 2016

From @moritz

On Wed Jan 06 05​:31​:43 2016, cpan@​zoffix.com wrote​:

As can be seen in the examples below. Both Date and DateTime types'
.new methods *do* in fact take positional arguments, but when the
positional arguments are not of the acceptable type, the error message
actually says NO type of positional arguments could be valid and only
named arguments can be used.

<ZoffixW> m​: say DateTime.new​: $/
<camelia> rakudo-moar 505dc4​: OUTPUT«Default constructor for
'DateTime' only takes named arguments␤ in block <unit> at
/tmp/UtZ8VCWpQi line 1␤␤»
<ZoffixW> m​: say DateTime.new​: 42
<camelia> rakudo-moar 505dc4​: OUTPUT«1970-01-01T00​:00​:42Z␤»
<ZoffixW> m​: say Date.new​: 42
<camelia> rakudo-moar 505dc4​: OUTPUT«Default constructor for 'Date'
only takes named arguments␤ in block <unit> at /tmp/wfQ5W1HwfH line
1␤␤»
<ZoffixW> m​: say Date.new​: '2015-11-11'
<camelia> rakudo-moar 505dc4​: OUTPUT«2015-11-11␤»

The current error message is​:

Cannot call new(Date​: Any); none of these signatures match​:
  (Date $​: $year, $month, $day, :&formatter, *%_)
  (Date $​: :$year!, :$month = 1, :$day = 1, :&formatter, *%_)
  (Date $​: Str $date, :&formatter, *%_)
  (Date $​: Dateish $d, :&formatter, *%_)
  (Date $​: Instant $i, :&formatter, *%_)
  (Dateish $​: *%_)
  in block <unit> at -e line 1

Closing it without tests, since regressions seem rather unlikely.

@p6rt
Copy link
Author

p6rt commented Mar 16, 2016

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Mar 16, 2016
@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant