forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better type inference for several functions taking
NTuple
args (Jul…
…iaLang#55124) Improves the abstract return type inference for these functions, for homogeneous tuple arguments: * `tail` * `front` * `reverse` * `circshift` Example: ```julia f(g, t::Type{<:Tuple}) = println(Core.Compiler.return_type(g, t)) f(Base.tail, Tuple{NTuple}) f(Base.front, Tuple{NTuple}) f(reverse, Tuple{NTuple}) f(circshift, Tuple{NTuple,Int}) ``` Results before: ```julia Tuple Tuple Tuple Tuple ``` Results after: ```julia NTuple{N, T} where {N, T} NTuple{N, T} where {N, T} NTuple{N, T} where {N, T} NTuple{N, T} where {N, T} ``` Updates JuliaLang#54495
- Loading branch information
Showing
4 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,5 +95,5 @@ end | |
function reverse(t::NTuple{N}) where N | ||
ntuple(Val{N}()) do i | ||
t[end+1-i] | ||
end | ||
end::NTuple | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters