Skip to content

Conversation

@martinholters
Copy link
Member

On master:

julia> T = Union{Tuple{Val}, Tuple{Tuple}}
Union{Tuple{Val}, Tuple{Tuple}}

julia> fieldtype(T, 1)
Union{Tuple, Val}

julia> Core.Compiler.fieldtype_tfunc(Core.Const(T), Core.Const(1))
Union{Type{Val}, Type{Tuple}} # should be Type{Union{Tuple, Val}}

I tried to be conservative here in the sense that in cases where this PR changes the result, it is actually for the better, but there may be cases left where fieldtype_tfunc remains unsound for Type{Union{...}} input.

Fixes #40177.

@martinholters martinholters added bugfix This change fixes an existing bug compiler:inference Type inference labels Jul 21, 2021
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Jul 21, 2021
@martinholters
Copy link
Member Author

I think the CI failure on FreeBSD is unrelated/also seen elsewhere? Then this should be good to go.

@martinholters martinholters merged commit 2c02de8 into master Jul 22, 2021
@martinholters martinholters deleted the mh/fix-fieldtype-tfunc branch July 22, 2021 05:41
@martinholters martinholters removed the merge me PR is reviewed. Merge when all tests are passing label Jul 22, 2021
KristofferC pushed a commit that referenced this pull request Jul 26, 2021
Co-authored-by: Jameson Nash <[email protected]>
(cherry picked from commit 2c02de8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug compiler:inference Type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A "fatal error in type inference (type bound)" in Julia 1.6.0-rc3 and 1.7.0-DEV.749

5 participants