Open
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