Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

Complex parametric role composition fails badly when no candidate found #4513

Open p6rt opened 9 years ago

p6rt commented 9 years ago

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

Searchable as RT125996$

p6rt commented 9 years ago

From @dakkar

This code​::

  role R[$a,$b] {}   role R2[$x] does R[1] {}   class C does R2[1] {}

  C.new;

Produces the error message​::

  ===SORRY!===   Cannot find method 'collisions'

The error happens in ``RoleToClassApplier​::apply``​: something goes wrong with the nested role specialisation, and the compiler tries to apply a ``NQPMu``.

--   Dakkar - \   GPG public key fingerprint = A071 E618 DD2C 5901 9574   6FE2 40EA 9883 7519 3F88   key id = 0x75193F88

Giving up on assembly language was the apple in our Garden of Eden​: Languages whose use squanders machine cycles are sinful. The LISP machine now permits LISP programmers to abandon bra and fig-leaf.   -- Epigrams in Programming, ACM SIGPLAN Sept. 1982

p6rt commented 9 years ago

From @lizmat

One would expect an error message such as​:

$ 6 'role R[$a,$b] {}; class C does R[1] {}' ===SORRY!=== No appropriate parametric role variant available for ‘R'

but even that message is rather LTA, as it doesn’t mention which parameters were tried and which candidates are available.

Liz

On 05 Sep 2015, at 12​:38, dakkar (via RT) \perl6\-bugs\-followup@​perl\.org wrote​:

# New Ticket Created by dakkar # Please include the string​: [perl #​125996] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=125996 >

This code​::

role R[$a,$b] {} role R2[$x] does R[1] {} class C does R2[1] {}

C.new;

Produces the error message​::

===SORRY!=== Cannot find method 'collisions'

The error happens in ``RoleToClassApplier​::apply``​: something goes wrong with the nested role specialisation, and the compiler tries to apply a ``NQPMu``.

-- Dakkar - \ GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88

Giving up on assembly language was the apple in our Garden of Eden​: Languages whose use squanders machine cycles are sinful. The LISP machine now permits LISP programmers to abandon bra and fig-leaf. -- Epigrams in Programming, ACM SIGPLAN Sept. 1982

p6rt commented 9 years ago

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

p6rt commented 7 years ago

From @AlexDaniel

Last message still reproducible (2017.11,HEAD(e5b660e))

On 2015-09-05 03​:44​:49, elizabeth wrote​:

One would expect an error message such as​:

$ 6 'role R[$a,$b] {}; class C does R[1] {}' ===SORRY!=== No appropriate parametric role variant available for ‘R'

but even that message is rather LTA, as it doesn’t mention which parameters were tried and which candidates are available.

Liz

On 05 Sep 2015, at 12​:38, dakkar (via RT) \<perl6-bugs- followup@​perl.org> wrote​:

# New Ticket Created by dakkar # Please include the string​: [perl #​125996] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=125996 >

This code​::

role R[$a,$b] {} role R2[$x] does R[1] {} class C does R2[1] {}

C.new;

Produces the error message​::

===SORRY!=== Cannot find method 'collisions'

The error happens in ``RoleToClassApplier​::apply``​: something goes wrong with the nested role specialisation, and the compiler tries to apply a ``NQPMu``.

-- Dakkar - \ GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88

Giving up on assembly language was the apple in our Garden of Eden​: Languages whose use squanders machine cycles are sinful. The LISP machine now permits LISP programmers to abandon bra and fig-leaf. -- Epigrams in Programming, ACM SIGPLAN Sept. 1982

usev6 commented 3 years ago

The current error message looks good to me:

$ cat >gh_old_4513.raku
role R[$a,$b] {};     
role R2[$x] does R[1] {};
class C does R2[1] {};
C.new;
^D
$ ./rakudo-m gh_old_4513.raku 
===SORRY!=== Error while compiling /path/to/gh_old_4513.raku
No appropriate parametric role variant available for 'R':
    Cannot resolve caller (R[Int]:U, Int:D); none of these signatures match:
        (::$?CLASS ::::?CLASS Mu, Mu $a, Mu $b)
at /path/to/gh_old_4513.raku:2

Should probably got a test in Rakudo's test suite.