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

Constraining an attribute to a defined version of a type passed to a parameterized role fails. #6261

Open
p6rt opened this issue May 22, 2017 · 1 comment
Labels

Comments

@p6rt
Copy link

p6rt commented May 22, 2017

Migrated from rt.perl.org#131343 (status was 'new')

Searchable as RT131343$

@p6rt
Copy link
Author

p6rt commented May 22, 2017

From enheh@protonmail.com

# Rakudo version 2017.04.3 built on MoarVM version 2017.04-53-g66c6dda implementing Perl 6.c.

# Not constraining to a defined type works​:
role R[​::T] {
has T $.x = T.new(0);
method new() {return self.bless(​:x(42e0));}
};
class C does R[Num] {};
C.new();

# Constraining to a defined type works if the type constraint is not parameterized.
role R {
has Num​:D $.x = Num.new(0);
method new() {return self.bless(​:x(42e0));}
};
class C does R {};
C.new();

# Both parameterizing and constraining to a defined type fails.
role R[​::T] {
has T​:D $.x = T.new(0);
method new() {return self.bless(​:x(42e0));}
};
class C does R[Num] {};
C.new();
# OUTPUT​: X​::TypeCheck​::Assignment exception produced no message

# The failure seems to occur during the bless.

@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