{"action":"closed","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3806","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3806/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3806/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3806/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/3806","id":55518754,"number":3806,"title":"Cast parsing leads to bad code","user":{"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},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/milestones/1","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/milestones/1/labels","id":343008,"number":1,"title":"3.2","description":"","creator":{"login":"issuesbot","id":4543331,"avatar_url":"https://avatars.githubusercontent.com/u/4543331?v=3","gravatar_id":"","url":"https://api.github.com/users/issuesbot","html_url":"https://github.com/issuesbot","followers_url":"https://api.github.com/users/issuesbot/followers","following_url":"https://api.github.com/users/issuesbot/following{/other_user}","gists_url":"https://api.github.com/users/issuesbot/gists{/gist_id}","starred_url":"https://api.github.com/users/issuesbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/issuesbot/subscriptions","organizations_url":"https://api.github.com/users/issuesbot/orgs","repos_url":"https://api.github.com/users/issuesbot/repos","events_url":"https://api.github.com/users/issuesbot/events{/privacy}","received_events_url":"https://api.github.com/users/issuesbot/received_events","type":"User","site_admin":false},"open_issues":123,"closed_issues":352,"state":"open","created_at":"2013-05-28T03:42:24Z","updated_at":"2015-01-26T21:59:04Z","due_on":"2014-05-24T07:00:00Z","closed_at":null},"comments":1,"created_at":"2015-01-26T18:28:47Z","updated_at":"2015-01-26T21:59:04Z","closed_at":"2015-01-26T21:59:04Z","body":"```\r\nusing haxe.macro.Tools;\r\n\r\n@:coreType\r\nabstract Char from Int to Int { }\r\n\r\n@:coreType\r\nabstract Pointer<T> {\r\n\t@:op(A - B) public static function subP<T>(lhs:Pointer<T>, rhs:Pointer<T>):Pointer<T>;\r\n\r\n\tpublic inline function value() {\r\n\t\treturn this;\r\n\t}\r\n}\r\n\r\nclass Main {\r\n    static function main() {\r\n\t\tvar p:Pointer<Char> = null;\r\n\t\tvar p2:Pointer<Char> = null;\r\n\t\tinspect(cast (p - p2).value());\r\n    }\r\n\r\n\tmacro static function inspect(e:haxe.macro.Expr) {\r\n\t\ttrace(e.toString()); // (cast p - p2).value()\r\n\t\treturn e;\r\n\t}\r\n}\r\n```\r\n\r\nThis leads to bad code being generated down the line because the compiler starts type inferring an open anon structure from the monomorph introduced by the cast:\r\n\r\n```\r\n[Call:Unknown<9>]\r\n\t[Field:Void -> Unknown<9>]\r\n\t\t[Parenthesis:{ value : Void -> Unknown<9> }]\r\n\t\t\t[Cast:{ value : Void -> Unknown<9> }]\r\n\t\t\t\t[Cast:Pointer<Char>]\r\n\t\t\t\t\t[Binop:Pointer<Char>]\r\n\t\t\t\t\t\t[Local p(1044):Pointer<Char>]\r\n\t\t\t\t\t\t-\r\n\t\t\t\t\t\t[Local p2(1045):Pointer<Char>]\r\n\t\t[FAnon:Void -> Unknown<9>] value\r\n```\r\n\r\nSurely the `cast` should have a lower precedence here."}}