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

in-place mutator C< .= new > does not work for lexical class + wrong line number #2053

Closed
p6rt opened this issue Aug 13, 2010 · 6 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Aug 13, 2010

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

Searchable as RT77200$

@p6rt
Copy link
Author

p6rt commented Aug 13, 2010

From sohtil@gmail.com

Hi!

I tried using C<new> as an in-place mutator as mentioned in S12,
but it does not seem to work.

Also the error message says "in main program body at line 1",
which does not make sense.

The line with $good in the test program below works.

The line with $bad in the test program below causes the error

  too few positional arguments​: 1 passed, 2 (or more) expected
  in main program body at line 1

If the line with $bad is commented out, the line with $bad2 causes

  too few positional arguments​: 2 passed, 3 (or more) expected
  in main program body at line 1

Lithos

This is Rakudo Perl 6, version 2010.07-113-gc41bcd7 built on parrot 2.6.0 r48341

$ cat test.pl
use v6;

my class Dog {
}

my Dog $good = Dog.new;

my Dog $bad .= new;

my Dog $bad2 .= new(1);
$ ./perl6 test.pl
too few positional arguments​: 1 passed, 2 (or more) expected
  in main program body at line 1
$

@p6rt
Copy link
Author

p6rt commented Aug 13, 2010

From sohtil@gmail.com

The error depends on the class being declared lexically. With "our class
Dog" or just "class Dog", it works.

@p6rt
Copy link
Author

p6rt commented Aug 13, 2010

sohtil@gmail.com - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 13, 2010

From sohtil@gmail.com

This looks similar to

#​74850​: [BUG] Strange error when doing '.= new' on an attribute in Rakudo

@p6rt
Copy link
Author

p6rt commented Feb 2, 2015

From @Mouq

I believe this issue has been fixed for a long time, but in any case, a test was added in Roast commit​:

commit 85b17077299280768abe6e8071a8dbeb894faef0
Author​: Mouq <alexmoquin@​gmail.com>
Date​: Mon Feb 2 03​:59​:57 2015 -0500

  Add a test for RT #​77200

Marking as resolved :)

On Fri Aug 13 12​:34​:53 2010, lithos wrote​:

This looks similar to

#​74850​: [BUG] Strange error when doing '.= new' on an attribute in Rakudo

@p6rt
Copy link
Author

p6rt commented Feb 2, 2015

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

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