{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/d1588981e0248aaa0174906c99df180e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d1588981e0248aaa0174906c99df180e","url":"https://api.github.com/users/petdance","login":"petdance","id":41100},"assignee":null,"labels":[{"name":"bug","color":"AF3AC4","url":"https://api.github.com/repos/petdance/scratch/labels/bug"},{"name":"Pri-normal","color":"5B4E39","url":"https://api.github.com/repos/petdance/scratch/labels/Pri-normal"},{"name":"Sev-medium","color":"F9ECA1","url":"https://api.github.com/repos/petdance/scratch/labels/Sev-medium"}],"updated_at":"2011-11-01T05:39:15Z","closed_at":null,"comments":0,"url":"https://api.github.com/repos/petdance/scratch/issues/1120","body":"I've got the following test setup (using Kakapo libs):\n{{{\r\nmethod test_initializer() {\r\n\tmy $obj := Kakapo::Test::Aclass.new(:a('albatross'), :b('byzantine'), :c('chrysanthemum'));\r\n\r\n\tself.assert_that('test object.a', $obj.a, is(\"albatross\"));\r\n\tself.assert_that('test object.b', $obj.b, is(\"byzantine\"));\r\n}\r\n\r\nmodule Kakapo::Test::Aclass;\r\nuse(\t\t'P6object');\r\nextends(\t 'Kakapo::Object');\r\nhas(\t\t'b a');\r\n}}}\r\n\r\nThe upshot of this is that accessor methods called Kakapo::Test::Aclass::a() and ...b() are mechanically generated and compiled (using plain old NQP+PIR in 1.7).\r\n\r\nThe Kakapo::Object base class contains, among other things, this code:\r\n{{{\r\nmethod new(*@pos, *%named) {\r\nsay(\"New!\");\r\nDumper::DUMP_(self, @pos, %named);\r\n\tmy $class := Opcode::getattribute(self.HOW, 'parrotclass');\r\n\tmy $new_object := Opcode::new($class);\r\n\r\n\t# NB: I'm not flattening the params, because that forces\r\n\t# everybody to do call_method or in-line pir to pass\r\n\t# along flat args.\r\n\t$new_object.init_(@pos, %named);\r\n\treturn $new_object;\r\n}\r\n}}}\r\nAs far as I can tell, the standard P6object functionality is working. The class is set up by Kakapo as a child of Kakapo::Object, and the Kakapo::Object::new() method is being called. Here is the output:\r\n{{{\r\nNew class: Aclass parent: Kakapo::Object\r\nDone\r\nNew!\r\n\"$VAR\" => ResizablePMCArray (size:3) [\r\n    undef,\r\n    ResizablePMCArray (size:0) [\r\n    ],\r\n    Hash {\r\n        \"(0x0011)\" => \"albatross\",\r\n        \"Global\" => \"byzantine\",\r\n        \"new\" => \"chrysanthemum\"\r\n    }\r\n]\r\nNo accessor defined for attribute 'Global'.\r\ncurrent instr.: 'parrot;Opcode;die' pc 28248 (library/kakapo_test.pir:11177)\r\ncalled from Sub 'parrot;Kakapo;Object;_block307' pc 8792 (library/kakapo_test.pir:3423)\r\ncalled from Sub 'parrot;Kakapo;Object;_block285' pc 8745 (library/kakapo_test.pir:3403)\r\ncalled from Sub 'parrot;Kakapo;Object;init_' pc 8620 (library/kakapo_test.pir:3347)\r\ncalled from Sub 'parrot;Kakapo;Object;new' pc 9090 (library/kakapo_test.pir:3531)\r\ncalled from Sub 'parrot;Kakapo;Test;Class;Attributes;test_initializer' pc 462 (t/Classes/Attributes.pir:128)\r\n}}}\r\nUntil today, the failure was not \"No accessor defined\" but rather an assert failure on an invalid string.\r\n\r\nThis is the generated PIR for the `new` call:\r\n{{{\r\n    .lex \"self\", self\r\n    get_hll_global $P50, [\"Kakapo\";\"Test\"], \"Aclass\"\r\n    $P51 = $P50.\"new\"(\"albatross\" :named(\"a\"), \"byzantine\" :named(\"b\"), \"chrysanthemum\" :named(\"c\"))\r\n    .lex \"$obj\", $P51\r\n}}}\r\n\r\nI don't have a good steps-to-reproduce, because the Kakapo library is somewhat large, and a bit of a nest of snakes as far as isolating behaviors.\r\n\r\nWhat's more, the aberrant behavior appears to be related somehow to calling with named parameters. Since 1.8 is the pcc refactor release, I think I can predict the response of the dev team. But I wanted to document this now, just in case.\r\n\r\nOriginally http://trac.parrot.org/parrot/ticket/1306","html_url":"https://github.com/petdance/scratch/issues/1120","title":"Various failures on bogus string used as argname (1.7)","number":1120,"id":2106824,"created_at":"2011-11-01T05:39:15Z"},"action":"opened"}