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 message when type in signature in role wasn't declared in Rakudo #3063

Closed
p6rt opened this issue Mar 4, 2013 · 7 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Mar 4, 2013

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

Searchable as RT117041$

@p6rt
Copy link
Author

p6rt commented Mar 4, 2013

From @masak

<tadzik> r​: role A​::B { method run(A​::C $) { !!! } } # LTA error message
<p6eval> rakudo 87ad7c​: OUTPUT«===SORRY!===␤Cannot type check against
type variable $?CLASS␤»
<FROGGS> r​: role A​::B { method run(A​::C $a) { } }
<p6eval> rakudo 87ad7c​: OUTPUT«===SORRY!===␤Cannot type check against
type variable $?CLASS␤»
<FROGGS> std​: role A​::B { method run(A​::C $a) { } }
<p6eval> std 52fe6d2​: OUTPUT«===SORRY!===␤In parameter declaration,
typename 'A​::C' must be predeclared [...] FAILED 00​:00 43m␤»
* masak submits rakudobug
<masak> r​: role A​::B { method x(A $) {} }
<p6eval> rakudo 87ad7c​: OUTPUT«===SORRY!===␤Type A cannot be used as a
nominal type on a parameter [...]
<masak> r​: role A​::B { method x(A​::C $) {} }
<p6eval> rakudo 87ad7c​: OUTPUT«===SORRY!===␤Cannot type check against
type variable $?CLASS␤»

@p6rt
Copy link
Author

p6rt commented Feb 9, 2015

From @usev6

The following fails with X​::Parameter​::InvalidType, which looks good to me. I added a test to S14-roles/basic.t with commit Raku/roast@cf760b1f69

$ perl6 -e 'role A​::B { method foo(A​::C $a) { } }'
===SORRY!=== Error while compiling -e
Invalid typename 'A​::C' in parameter declaration.
at -e​:1
------> role A​::B { method foo(A​::C⏏ $a) { } }

If there is just type A in the signature the error differs, though​:

$ perl6-m -e 'role A​::B { method foo(A $a) { } }' # fails with X​::AdHoc
===SORRY!=== Error while compiling -e
A cannot be used as a nominal type on a parameter
at -e​:1
------> role A​::B { method foo(A ⏏$a) { } }

std has the same error message for both commands​:

<bartolin> std​: role A​::B { method foo(A​::C $a) { } }
<+camelia> std f9b7f55​: OUTPUT«===SORRY!===␤In parameter declaration, typename 'A​::C' must be predeclared (or marked as declarative with :​: prefix) at
  /tmp/pKMilacEPI line 1​:␤------> role A​::B { method foo(A​::C⏏ $a) { } }␤Parse failed␤FAILED 00​:00…»
<bartolin> std​: role A​::B { method foo(A $a) { } }
<+camelia> std f9b7f55​: OUTPUT«===SORRY!===␤In parameter declaration, typename 'A' must be predeclared (or marked as declarative with :​: prefix) at
  /tmp/MD0GLvANd_ line 1​:␤------> role A​::B { method foo(A⏏ $a) { } }␤Parse failed␤FAILED 00​:00 138m␤»

1 similar comment
@p6rt
Copy link
Author

p6rt commented Feb 9, 2015

From @usev6

The following fails with X​::Parameter​::InvalidType, which looks good to me. I added a test to S14-roles/basic.t with commit Raku/roast@cf760b1f69

$ perl6 -e 'role A​::B { method foo(A​::C $a) { } }'
===SORRY!=== Error while compiling -e
Invalid typename 'A​::C' in parameter declaration.
at -e​:1
------> role A​::B { method foo(A​::C⏏ $a) { } }

If there is just type A in the signature the error differs, though​:

$ perl6-m -e 'role A​::B { method foo(A $a) { } }' # fails with X​::AdHoc
===SORRY!=== Error while compiling -e
A cannot be used as a nominal type on a parameter
at -e​:1
------> role A​::B { method foo(A ⏏$a) { } }

std has the same error message for both commands​:

<bartolin> std​: role A​::B { method foo(A​::C $a) { } }
<+camelia> std f9b7f55​: OUTPUT«===SORRY!===␤In parameter declaration, typename 'A​::C' must be predeclared (or marked as declarative with :​: prefix) at
  /tmp/pKMilacEPI line 1​:␤------> role A​::B { method foo(A​::C⏏ $a) { } }␤Parse failed␤FAILED 00​:00…»
<bartolin> std​: role A​::B { method foo(A $a) { } }
<+camelia> std f9b7f55​: OUTPUT«===SORRY!===␤In parameter declaration, typename 'A' must be predeclared (or marked as declarative with :​: prefix) at
  /tmp/MD0GLvANd_ line 1​:␤------> role A​::B { method foo(A⏏ $a) { } }␤Parse failed␤FAILED 00​:00 138m␤»

@p6rt
Copy link
Author

p6rt commented Feb 9, 2015

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

@p6rt
Copy link
Author

p6rt commented Feb 9, 2015

From @usev6

Just found ticket https://rt-archive.perl.org/perl6/Ticket/Display.html?id=123396 which reasons about 'role A​::B {}; sub foo(A $a) {}' and the like.

I'll add the bit about 'role A​::B { method foo(A $a) { } }' to that ticket, since it seems to be a separate problem.

If noone objects, I'm going to close this ticket.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Feb 9, 2015

From @usev6

Just found ticket https://rt-archive.perl.org/perl6/Ticket/Display.html?id=123396 which reasons about 'role A​::B {}; sub foo(A $a) {}' and the like.

I'll add the bit about 'role A​::B { method foo(A $a) { } }' to that ticket, since it seems to be a separate problem.

If noone objects, I'm going to close this ticket.

@p6rt
Copy link
Author

p6rt commented Feb 11, 2015

@usev6 - 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