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

parametric role generic type not resolving early enough? #4248

Open
p6rt opened this issue May 15, 2015 · 5 comments
Open

parametric role generic type not resolving early enough? #4248

p6rt opened this issue May 15, 2015 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 15, 2015

Migrated from rt.perl.org#125200 (status was 'open')

Searchable as RT125200$

@p6rt
Copy link
Author

p6rt commented May 15, 2015

From @jdv

Some examples that I expected would be equivalent​:

1. WHAT

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say Foo[Int].new.a.perl'
Array[Int].new()
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say Foo[Int].new.a.WHAT'
(Array[T])
[jdv@​wieldy ~]$

2. method call on type obj

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say Foo[Int].new.a.perl'
Array[Int].new()
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say Foo[Int].new.a.perl'
Method 'perl' not found for invocant of class 'T'
  in block <unit> at -e​:1

@p6rt
Copy link
Author

p6rt commented May 15, 2015

From @jdv

The first example there should have been​:

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say Foo[Int].new.a.WHAT'
(Array[Int])
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say Foo[Int].new.a.WHAT'
(Array[T])
[jdv@​wieldy ~]$

Oops.

On Fri May 15 11​:20​:36 2015, jdv79 wrote​:

Some examples that I expected would be equivalent​:

1. WHAT

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say
Foo[Int].new.a.perl'
Array[Int].new()
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say
Foo[Int].new.a.WHAT'
(Array[T])
[jdv@​wieldy ~]$

2. method call on type obj

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say
Foo[Int].new.a.perl'
Array[Int].new()
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say
Foo[Int].new.a.perl'
Method 'perl' not found for invocant of class 'T'
in block <unit> at -e​:1

@p6rt
Copy link
Author

p6rt commented Dec 3, 2017

From @AlexDaniel

Still reproducible (2017.11,HEAD(e5b660e))

On 2015-05-15 11​:25​:07, jdv79 wrote​:

The first example there should have been​:

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say
Foo[Int].new.a.WHAT'
(Array[Int])
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say
Foo[Int].new.a.WHAT'
(Array[T])
[jdv@​wieldy ~]$

Oops.

On Fri May 15 11​:20​:36 2015, jdv79 wrote​:

Some examples that I expected would be equivalent​:

1. WHAT

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say
Foo[Int].new.a.perl'
Array[Int].new()
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say
Foo[Int].new.a.WHAT'
(Array[T])
[jdv@​wieldy ~]$

2. method call on type obj

[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has Int @​.a }; say
Foo[Int].new.a.perl'
Array[Int].new()
[jdv@​wieldy ~]$ perl6 -e 'role Foo[​::T] { has T @​.a }; say
Foo[Int].new.a.perl'
Method 'perl' not found for invocant of class 'T'
in block <unit> at -e​:1

@p6rt
Copy link
Author

p6rt commented Dec 3, 2017

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

@p6rt p6rt added the Bug label Jan 5, 2020
@usev6
Copy link

usev6 commented Oct 8, 2023

The output is different now (no error anymore for the last evaluation). But there is still one inconsistency (the output of the second evaluation refers to T instead of Int):

$ ./rakudo-m -e 'role Foo[::T] { has Int @.a }; say Foo[Int].new.a.WHAT'
(Array[Int])
$ ./rakudo-m -e 'role Foo[::T] { has T @.a }; say Foo[Int].new.a.WHAT'
(Array[T])
$ ./rakudo-m -e 'role Foo[::T] { has Int @.a }; say Foo[Int].new.a.raku'
Array[Int].new()
$ ./rakudo-m -e 'role Foo[::T] { has T @.a }; say Foo[Int].new.a.raku'
Array[Int].new()

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

2 participants