{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4417","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4417/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4417/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4417/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/4417","id":95578126,"number":4417,"title":"Array of structs in macro","user":{"login":"MSGhero","id":5033927,"avatar_url":"https://avatars.githubusercontent.com/u/5033927?v=3","gravatar_id":"","url":"https://api.github.com/users/MSGhero","html_url":"https://github.com/MSGhero","followers_url":"https://api.github.com/users/MSGhero/followers","following_url":"https://api.github.com/users/MSGhero/following{/other_user}","gists_url":"https://api.github.com/users/MSGhero/gists{/gist_id}","starred_url":"https://api.github.com/users/MSGhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSGhero/subscriptions","organizations_url":"https://api.github.com/users/MSGhero/orgs","repos_url":"https://api.github.com/users/MSGhero/repos","events_url":"https://api.github.com/users/MSGhero/events{/privacy}","received_events_url":"https://api.github.com/users/MSGhero/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"Simn","id":634365,"avatar_url":"https://avatars.githubusercontent.com/u/634365?v=3","gravatar_id":"","url":"https://api.github.com/users/Simn","html_url":"https://github.com/Simn","followers_url":"https://api.github.com/users/Simn/followers","following_url":"https://api.github.com/users/Simn/following{/other_user}","gists_url":"https://api.github.com/users/Simn/gists{/gist_id}","starred_url":"https://api.github.com/users/Simn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Simn/subscriptions","organizations_url":"https://api.github.com/users/Simn/orgs","repos_url":"https://api.github.com/users/Simn/repos","events_url":"https://api.github.com/users/Simn/events{/privacy}","received_events_url":"https://api.github.com/users/Simn/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2015-07-17T03:40:13Z","updated_at":"2015-11-27T02:51:04Z","closed_at":"2015-11-22T20:13:39Z","body":"Related to #4196 @Simn. This time, it's an array of imbalanced structs (in a macro) instead of a map literal of structs. Tested on git haxe.\r\n\r\nThe json string\r\n```\r\n{\r\n  \"foo\": [\r\n\t{\r\n\t  \"a\": 6,\r\n\t  \"b\": 1,\r\n\t},\r\n\t{\r\n\t  \"a\": 9,\r\n\t}\r\n  ]\r\n}\r\n```\r\n\r\ninside of a build macro with `Context.parseInlineString(string)` throws an error\r\n```\r\ntest:7: lines 7-9 : Arrays of mixed types are only allowed if the type is forced to Array<Dynamic>\r\ntest:7: lines 7-9 : { a : Int } should be { b : Int, a : Int }\r\ntest:7: lines 7-9 : { a : Int } has no field b\r\n```\r\n\r\nBuild macro, unimportant stuff removed:\r\n```haxe\r\n{\r\n\r\nvar string = ( see above );\r\n\t\r\nvar o = Context.parseInlineString(string), Context.makePosition({ min : 0, max : 0, file : \"test\"}));\r\n\r\nvar a = [ { expr : EBinop(OpArrow, macro $v{\"test\"}, o), pos : Context.currentPos() } ];\r\n\t\t\r\nvar nf:Field = {\r\n\tkind : FVar(macro : haxe.ds.StringMap<Dynamic>, { expr : EArrayDecl(a), pos : Context.currentPos() } )\r\n    // etc\r\n};\r\n\r\nfields.push(nf);\r\nreturn fields;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/comments/160031817","html_url":"https://github.com/HaxeFoundation/haxe/issues/4417#issuecomment-160031817","issue_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4417","id":160031817,"user":{"login":"MSGhero","id":5033927,"avatar_url":"https://avatars.githubusercontent.com/u/5033927?v=3","gravatar_id":"","url":"https://api.github.com/users/MSGhero","html_url":"https://github.com/MSGhero","followers_url":"https://api.github.com/users/MSGhero/followers","following_url":"https://api.github.com/users/MSGhero/following{/other_user}","gists_url":"https://api.github.com/users/MSGhero/gists{/gist_id}","starred_url":"https://api.github.com/users/MSGhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSGhero/subscriptions","organizations_url":"https://api.github.com/users/MSGhero/orgs","repos_url":"https://api.github.com/users/MSGhero/repos","events_url":"https://api.github.com/users/MSGhero/events{/privacy}","received_events_url":"https://api.github.com/users/MSGhero/received_events","type":"User","site_admin":false},"created_at":"2015-11-27T02:51:04Z","updated_at":"2015-11-27T02:51:04Z","body":"If anyone comes across this, there's an EUntyped exprdef that solves the problem of not being able to type the arrays directly. Good to know.\r\nhttp://stackoverflow.com/questions/33907716/array-typing-issue-in-build-macro"}}