-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
collectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setscompiler:inferenceType inferenceType inferencefeatureIndicates new feature / enhancement requestsIndicates new feature / enhancement requeststypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
julia> f(t::Tuple, n::Bool) = t[10 + n]
f (generic function with 1 method)
julia> Core.Compiler.return_type(f, Tuple{Tuple{Bool,String,Vararg{Int}},Bool})
Union{Bool, Int64, String}
julia> versioninfo()
Julia Version 1.12.0-DEV.unknown
Commit 0fdd655 (2024-07-17 15:39 UTC)Ideally, the inferred return type would be Int. Proof: the index 10 + n is always either 10 or 11, thus the index is always greater than two.
Context, hypothesized solution approach using refinement types: https://discourse.julialang.org/t/would-it-make-sense-for-julia-to-adopt-refinement-types/113586/10
Metadata
Metadata
Assignees
Labels
collectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setscompiler:inferenceType inferenceType inferencefeatureIndicates new feature / enhancement requestsIndicates new feature / enhancement requeststypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch