{"action":"opened","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/10880","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/10880/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/10880/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/10880/events","html_url":"https://github.com/JuliaLang/julia/issues/10880","id":69321945,"number":10880,"title":"\"Regression\" in typeinf when concatenate two tuple types","user":{"login":"yuyichao","id":712232,"avatar_url":"https://avatars.githubusercontent.com/u/712232?v=3","gravatar_id":"","url":"https://api.github.com/users/yuyichao","html_url":"https://github.com/yuyichao","followers_url":"https://api.github.com/users/yuyichao/followers","following_url":"https://api.github.com/users/yuyichao/following{/other_user}","gists_url":"https://api.github.com/users/yuyichao/gists{/gist_id}","starred_url":"https://api.github.com/users/yuyichao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuyichao/subscriptions","organizations_url":"https://api.github.com/users/yuyichao/orgs","repos_url":"https://api.github.com/users/yuyichao/repos","events_url":"https://api.github.com/users/yuyichao/events{/privacy}","received_events_url":"https://api.github.com/users/yuyichao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-18T16:01:03Z","updated_at":"2015-04-18T16:01:03Z","closed_at":null,"body":"I was under the impression that #10380 can make type inference easier for functions that use tuple types. However, when I want to get the type of the concatenation of two tuples, I couldn't get good type inference anymore. (It is also very likely that I'm just being stupid and don't know the correct way to do it in the new version.)\r\n\r\nThe code I am using can be simplified to\r\n\r\n```julia\r\nif isa((Int,), Type)\r\n    function cat_tt(a, b)\r\n        tuple(a..., b...)\r\n    end\r\nelse\r\n    function cat_tt(a, b)\r\n        Tuple{a.parameters..., b.parameters...}\r\n    end\r\nend\r\n\r\nprintln(cat_tt(typeof((1, 2)), typeof((1, 2))))\r\nprintln(@code_typed cat_tt(typeof((1, 2)), typeof((1, 2))))\r\n```\r\n\r\nBefore the change of the tuple type, the output is\r\n```julia\r\n(Int64,Int64,Int64,Int64)\r\nAny[:($(Expr(:lambda, Any[:a,:b], Any[Any[],Any[Any[:a,Type{(Int64,Int64)},0],Any[:b,Type{(Int64,Int64)},0]],Any[],Any[]], :(begin  # /home/yuyichao/tmp/julia_cat_tt.jl, line 5:\r\n        return (Int64,Int64,Int64,Int64)\r\n    end::(Type{Int64},Type{Int64},Type{Int64},Type{Int64})))))]\r\n```\r\n\r\nAfter the change\r\n```\r\nTuple{Int64,Int64,Int64,Int64}\r\nAny[:($(Expr(:lambda, Any[:a,:b], Any[Any[],Any[Any[:a,Type{Tuple{Int64,Int64}},0],Any[:b,Type{Tuple{Int64,Int64}},0]],Any[],Any[]], :(begin  # /home/yuyichao/tmp/julia_cat_tt.jl, line 9:\r\n        return (top(_apply))(call,top(apply_type),(top(tuple))(Tuple)::Tuple{DataType},(top(getfield))(a::Type{Tuple{Int64,Int64}},:parameters)::SimpleVector,(top(getfield))(b::Type{Tuple{Int64,Int64}},:parameters)::SimpleVector)::ANY\r\n    end::ANY))))]\r\n```\r\n\r\nMaybe there's better ways to do this.\r\n"}}