{"action":"created","issue":{"url":"https://api.github.com/repos/dylan-lang/opendylan/issues/1017","labels_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/1017/labels{/name}","comments_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/1017/comments","events_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/1017/events","html_url":"https://github.com/dylan-lang/opendylan/issues/1017","id":125249779,"number":1017,"title":"No Applicable Method from LLVM back-end","user":{"login":"waywardmonkeys","id":178582,"avatar_url":"https://avatars.githubusercontent.com/u/178582?v=3","gravatar_id":"","url":"https://api.github.com/users/waywardmonkeys","html_url":"https://github.com/waywardmonkeys","followers_url":"https://api.github.com/users/waywardmonkeys/followers","following_url":"https://api.github.com/users/waywardmonkeys/following{/other_user}","gists_url":"https://api.github.com/users/waywardmonkeys/gists{/gist_id}","starred_url":"https://api.github.com/users/waywardmonkeys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waywardmonkeys/subscriptions","organizations_url":"https://api.github.com/users/waywardmonkeys/orgs","repos_url":"https://api.github.com/users/waywardmonkeys/repos","events_url":"https://api.github.com/users/waywardmonkeys/events{/privacy}","received_events_url":"https://api.github.com/users/waywardmonkeys/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-06T19:53:49Z","updated_at":"2016-01-07T05:23:33Z","closed_at":null,"body":"When building the ``objective-c`` test suite (https://github.com/dylan-foundry/objc-dylan/) with the LLVM back-end, this ends up happening:\r\n\r\n```\r\nGenerating code for library objc-test-suite\r\ncomputation return t30: Error:\r\n  No applicable method, applying\r\n  {generic function do-emit-return (<object>, <object>, <object>, <object>) => (#rest)} to\r\n  #[{<llvm-x86-darwin-back-end> #x019361A0}, {<llvm-module> #x019BB2D8}, t30,\r\n    {<llvm-call-instruction> #x01CF0E40}].\r\n\r\nemit c_callable_adder_c_wrapper_: Error:\r\n  No applicable method, applying\r\n  {generic function do-emit-return (<object>, <object>, <object>, <object>) => (#rest)} to\r\n  #[{<llvm-x86-darwin-back-end> #x019361A0}, {<llvm-module> #x019BB2D8}, t30,\r\n    {<llvm-call-instruction> #x01CF0E40}].\r\n```\r\n\r\nThis is probably related to this code:\r\n\r\n```dylan\r\ndefine objc-selector @adder\r\n  parameter target :: <NSObject>;\r\n  parameter a :: <C-int>;\r\n  result r :: <C-int>;\r\n  selector: \"adder:\";\r\n  type-encoding: \"i@:i\";\r\nend;\r\n\r\ndefine objc-method adder\r\n    (target, selector, a :: <integer>)\r\n => (r :: <integer>)\r\n  c-signature: (target :: <objc/instance>,\r\n                selector :: <objc/selector>,\r\n                a :: <C-int>) => (r :: <C-int>);\r\n  assert-true(instance?(target, <test-class>));\r\n  a + 1\r\nend;\r\n\r\ndefine objc-class <test-class> (<NSObject>) => DylanTestClass\r\n  bind @adder => adder;\r\nend;\r\n\r\ndefine test objc-add-method-test ()\r\n  let i = send($DylanTestClass, @alloc);\r\n  assert-equal(3, send(i, @adder, 2));\r\nend;\r\n```\r\n\r\nThat ``objc-method`` definition is expanded with:\r\n\r\n```dylan\r\ndefine macro objc-method-definer\r\n  { define objc-method ?:name (?args:*) => (?result:variable)\r\n      c-signature: (?cffi-parameters:*) => (?cffi-result:variable);\r\n      ?:body\r\n    end }\r\n    => {\r\n         define function ?name (?args) => (?result)\r\n           ?body\r\n         end;\r\n         define c-callable-wrapper ?name ## \"-c-wrapper\" of ?name\r\n           ?cffi-parameters ;\r\n           result ?cffi-result\r\n         end;\r\n  }\r\n\r\n  { define objc-method ?:name (?args:*) => ()\r\n      c-signature: (?cffi-parameters:*) => ();\r\n      ?:body\r\n    end }\r\n    => {\r\n         define function ?name (?args) => ()\r\n           ?body\r\n         end;\r\n         define c-callable-wrapper ?name ## \"-c-wrapper\" of ?name\r\n           ?cffi-parameters\r\n         end;\r\n  }\r\n\r\n  args:\r\n    { } => { }\r\n    { ?arg:variable, ... } => { ?arg, ... }\r\n\r\n  cffi-parameters:\r\n    { } => { }\r\n    { ?cffi-parameter:variable, ... } => { parameter ?cffi-parameter; ... }\r\nend;\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/dylan-lang/opendylan/issues/comments/169554048","html_url":"https://github.com/dylan-lang/opendylan/issues/1017#issuecomment-169554048","issue_url":"https://api.github.com/repos/dylan-lang/opendylan/issues/1017","id":169554048,"user":{"login":"waywardmonkeys","id":178582,"avatar_url":"https://avatars.githubusercontent.com/u/178582?v=3","gravatar_id":"","url":"https://api.github.com/users/waywardmonkeys","html_url":"https://github.com/waywardmonkeys","followers_url":"https://api.github.com/users/waywardmonkeys/followers","following_url":"https://api.github.com/users/waywardmonkeys/following{/other_user}","gists_url":"https://api.github.com/users/waywardmonkeys/gists{/gist_id}","starred_url":"https://api.github.com/users/waywardmonkeys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waywardmonkeys/subscriptions","organizations_url":"https://api.github.com/users/waywardmonkeys/orgs","repos_url":"https://api.github.com/users/waywardmonkeys/repos","events_url":"https://api.github.com/users/waywardmonkeys/events{/privacy}","received_events_url":"https://api.github.com/users/waywardmonkeys/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T05:23:33Z","updated_at":"2016-01-07T05:23:33Z","body":"@housel asked for DFM ...\r\n\r\nThe compiler message said it involved ``t36``, but I'm not sure exactly which of these blocks of code it is:\r\n\r\n```dylan\r\nMETHOD adder-c-wrapper-initializer () => ()\r\n  LOCAL METHOD (target :: <raw-c-pointer>, selector :: <raw-c-pointer>, a :: <raw-c-signed-int>) => (raw :: <raw-c-signed-int>)\r\n          t1 := [PRIMOP cast-pointer-as-raw({{ target }})]\r\n          t2 := [PRIMOP wrap-machine-word(t1)]\r\n          Vt18 := [STACK-VECTOR (^#\"address\", t2)]\r\n          t18 := [CONGRUENT-CALLg ^{<&generic> make}(^{<&class> <objc/instance>}, Vt18)]\r\n          t5 := [CONGRUENT-CALLi ^{<&method> import-function-for-<objc/instance> (#P{ low-level-type-for(<objc/instance>) })}(t18)]\r\n          t6 := [PRIMOP cast-pointer-as-raw({{ selector }})]\r\n          t7 := [PRIMOP wrap-machine-word(t6)]\r\n          Vt18 := [STACK-VECTOR (^#\"address\", t7)]\r\n          t18 := [CONGRUENT-CALLg ^{<&generic> make}(^{<&class> <objc/selector>}, Vt18)]\r\n          t29 := [PRIMOP wrap-abstract-integer({{ a }})]\r\n          *t30(1) := [VALUES t29]\r\n          *t19(1) := multiple-value-check-type *t30(1) :: ^{model-object :: <union>}\r\n          t31 := *t19(1) [0]\r\n          t13 := [CALLx ^{<&method> adder (<object>, <object>, <integer>)}(t5, t18, t31)]\r\n          t36 := [PRIMOP unwrap-abstract-integer(t13)] // tail call\r\n          return t36\r\n        END\r\n  t3 := [PRIMOP cast-pointer-as-raw(^(iep of)[C-CALLABLE-FUNCTION $s])]\r\n  t4 := [PRIMOP wrap-machine-word(t3)]\r\n  Vt7 := [STACK-VECTOR (^#\"address\", t4)]\r\n  t7 := [CONGRUENT-CALLg ^{<&generic> make}(^{<&class> <c-function-pointer-instantiation>}, Vt7)]\r\n  define {adder-c-wrapper in objc-test-suite} = t7\r\n  *t8(0) := [VALUES]\r\n  return *t8(0)\r\nEND\r\n```\r\n\r\n```dylan\r\nMETHOD (target :: <raw-c-pointer>, selector :: <raw-c-pointer>, a :: <raw-c-signed-int>) => (raw :: <raw-c-signed-int>)\r\n  t1 := [PRIMOP cast-pointer-as-raw({{ target }})]\r\n  t2 := [PRIMOP wrap-machine-word(t1)]\r\n  Vt18 := [STACK-VECTOR (^#\"address\", t2)]\r\n  t18 := [CONGRUENT-CALLg ^{<&generic> make}(^{<&class> <objc/instance>}, Vt18)]\r\n  t5 := [CONGRUENT-CALLi ^{<&method> import-function-for-<objc/instance> (#P{ low-level-type-for(<objc/instance>) })}(t18)]\r\n  t6 := [PRIMOP cast-pointer-as-raw({{ selector }})]\r\n  t7 := [PRIMOP wrap-machine-word(t6)]\r\n  Vt18 := [STACK-VECTOR (^#\"address\", t7)]\r\n  t18 := [CONGRUENT-CALLg ^{<&generic> make}(^{<&class> <objc/selector>}, Vt18)]\r\n  t29 := [PRIMOP wrap-abstract-integer({{ a }})]\r\n  *t30(1) := [VALUES t29]\r\n  *t19(1) := multiple-value-check-type *t30(1) :: ^{model-object :: <union>}\r\n  t31 := *t19(1) [0]\r\n  t13 := [CALLx ^{<&method> adder (<object>, <object>, <integer>)}(t5, t18, t31)]\r\n  t36 := [PRIMOP unwrap-abstract-integer(t13)] // tail call\r\n  return t36\r\nEND\r\n```"}}