{"action":"opened","issue":{"url":"https://api.github.com/repos/graalvm/truffle/issues/205","repository_url":"https://api.github.com/repos/graalvm/truffle","labels_url":"https://api.github.com/repos/graalvm/truffle/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/graalvm/truffle/issues/205/comments","events_url":"https://api.github.com/repos/graalvm/truffle/issues/205/events","html_url":"https://github.com/graalvm/truffle/issues/205","id":176052835,"number":205,"title":"DSL creates incorrect createNode(...) if constructor has `Object` arguments","user":{"login":"smarr","id":40815,"avatar_url":"https://avatars.githubusercontent.com/u/40815?v=3","gravatar_id":"","url":"https://api.github.com/users/smarr","html_url":"https://github.com/smarr","followers_url":"https://api.github.com/users/smarr/followers","following_url":"https://api.github.com/users/smarr/following{/other_user}","gists_url":"https://api.github.com/users/smarr/gists{/gist_id}","starred_url":"https://api.github.com/users/smarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarr/subscriptions","organizations_url":"https://api.github.com/users/smarr/orgs","repos_url":"https://api.github.com/users/smarr/repos","events_url":"https://api.github.com/users/smarr/events{/privacy}","received_events_url":"https://api.github.com/users/smarr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/graalvm/truffle/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"chumer","id":4346215,"avatar_url":"https://avatars.githubusercontent.com/u/4346215?v=3","gravatar_id":"","url":"https://api.github.com/users/chumer","html_url":"https://github.com/chumer","followers_url":"https://api.github.com/users/chumer/followers","following_url":"https://api.github.com/users/chumer/following{/other_user}","gists_url":"https://api.github.com/users/chumer/gists{/gist_id}","starred_url":"https://api.github.com/users/chumer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chumer/subscriptions","organizations_url":"https://api.github.com/users/chumer/orgs","repos_url":"https://api.github.com/users/chumer/repos","events_url":"https://api.github.com/users/chumer/events{/privacy}","received_events_url":"https://api.github.com/users/chumer/received_events","type":"User","site_admin":false},"assignees":[{"login":"chumer","id":4346215,"avatar_url":"https://avatars.githubusercontent.com/u/4346215?v=3","gravatar_id":"","url":"https://api.github.com/users/chumer","html_url":"https://github.com/chumer","followers_url":"https://api.github.com/users/chumer/followers","following_url":"https://api.github.com/users/chumer/following{/other_user}","gists_url":"https://api.github.com/users/chumer/gists{/gist_id}","starred_url":"https://api.github.com/users/chumer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chumer/subscriptions","organizations_url":"https://api.github.com/users/chumer/orgs","repos_url":"https://api.github.com/users/chumer/repos","events_url":"https://api.github.com/users/chumer/events{/privacy}","received_events_url":"https://api.github.com/users/chumer/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2016-09-09T16:34:23Z","updated_at":"2016-09-09T16:34:23Z","closed_at":null,"body":"The following example leads to a wrong `createNode(..)` method:\r\n\r\n```java\r\n@GenerateNodeFactory\r\n@NodeChildren({\r\n  @NodeChild(value = \"foo\",  type = FooBarNode.class),\r\n  @NodeChild(value = \"bar\",  type = FooBarNode.class)})\r\npublic abstract class FooBarNode extends Node {\r\n  public FooBarNode(final SourceSection source, final Object a, final Object b) { }\r\n\r\n  public abstract Object executeGeneric(final VirtualFrame frame);\r\n\r\n  @Specialization\r\n  public Object doSomething(final VirtualFrame frame, final Object foo, final Object bar) {\r\n    return null;\r\n  }\r\n}\r\n```\r\n\r\nThe result looks like this:\r\n```java\r\npublic FooBarNode createNode(Object... arguments) {\r\n        if (arguments.length == 5 && (arguments[0] == null || arguments[0] instanceof SourceSection) && (arguments[1] == null || arguments[1] instanceof FooBarNode) && (arguments[2] == null || arguments[2] instanceof FooBarNode)) {\r\n            return create((SourceSection) arguments[0], arguments[1], arguments[2], (FooBarNode) arguments[3], (FooBarNode) arguments[4]);\r\n        } else {\r\n            throw new IllegalArgumentException(\"Invalid create signature.\");\r\n        }\r\n    }\r\n```\r\n\r\nThe important bit is that the type checks miss the `Object` arguments, and thus, the indexes used to check for the two `FooBarNode` are off by the number of `Object` arguments in the `FooBarNode` constructor."}}
{"actor":{"display_login":"smarr"}}