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

default constructor being called for constant declaration with .= in Rakudo #2866

Closed
p6rt opened this issue Aug 19, 2012 · 5 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 19, 2012

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

Searchable as RT114506$

@p6rt
Copy link
Author

p6rt commented Aug 19, 2012

From @masak

<pmichaud> p6​: my Rat constant $r .= new(3,5); say $r; # should work
<p6eval> ..rakudo 763b85​: OUTPUT«===SORRY!===␤Default constructor only
takes named arguments␤»
<pmichaud> why is it looking at the Default constructor, I wonder?
<jnthn> pmichaud​: Maybe an initialization fail
<jnthn> pmichaud​: I mean...it doesn't call on Rat for some reason.
<pmichaud> anyway, seeing that I agree​: BUG
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Aug 20, 2012

From @ronaldxs

Just to note some similar examples that also seem to have problems that
may be useful for tests etc.​:

$ class C {has $.a}; my C constant $c .= new(​:a<red>);
use of uninitialized value of type Mu in string context in any <anon>
at src/gen/BOOTSTRAP.pm​:104

use of uninitialized value of type Mu in string context in any <anon>
at src/gen/BOOTSTRAP.pm​:104

class Foo {
  has $.a;

  method new ($self​: Str $string) {
  $self.bless(*, a => $string);
  }
}
my Foo constant $c .= new("abc");
say $c.perl;
say $c.WHAT;

Above program reveals that $c is incorrectly set to type Str.

@p6rt
Copy link
Author

p6rt commented Aug 20, 2012

@ronaldxs - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Feb 11, 2015

From @Mouq

Fixed in Rakudo commit​:

commit 2f7046f18b18067d77a6717f2157ec458215754f
Author​: Mouq <alexmoquin@​gmail.com>
Date​: Wed Feb 11 12​:25​:28 2015 -0500

  Add type info to constant decls. Fixes #​114506

Tests added to S04-declarations/constant.t in Roast commit​:

commit e650e931f0e8b6d5fb38afda445169d345de50b1
Author​: Mouq <alexmoquin@​gmail.com>
Date​: Wed Feb 11 12​:35​:39 2015 -0500

  Add tests for #​114506

Closing this ticket as resolved :)

On Sun Aug 19 17​:08​:48 2012, ronaldxs wrote​:

Just to note some similar examples that also seem to have problems that
may be useful for tests etc.​:

$ class C {has $.a}; my C constant $c .= new(​:a<red>);
use of uninitialized value of type Mu in string context in any <anon>
at src/gen/BOOTSTRAP.pm​:104

use of uninitialized value of type Mu in string context in any <anon>
at src/gen/BOOTSTRAP.pm​:104

class Foo {
has $.a;

method new ($self​: Str $string) {
$self.bless(*, a => $string);
}
}
my Foo constant $c .= new("abc");
say $c.perl;
say $c.WHAT;

Above program reveals that $c is incorrectly set to type Str.

@p6rt
Copy link
Author

p6rt commented Feb 11, 2015

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

@p6rt p6rt closed this as completed Feb 11, 2015
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant