Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #31803, covariance handling in fieldtype_tfunc #31848

Merged
merged 1 commit into from
Apr 28, 2019
Merged

Conversation

JeffBezanson
Copy link
Sponsor Member

fixes #31803

@JeffBezanson JeffBezanson added bugfix This change fixes an existing bug compiler:inference Type inference backport 1.2 labels Apr 26, 2019
@@ -939,7 +939,7 @@ function _fieldtype_tfunc(@nospecialize(s), exact::Bool, @nospecialize(name))
ft = ftypes[fld]
end

exactft = exact || !has_free_typevars(ft)
exactft = exact || (!has_free_typevars(ft) && u.name !== Tuple.name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem specific to the typevar case?

julia> Core.Compiler.fieldtype_tfunc(Type{Tuple{Any}}, Const(1))
Const(Any, false)

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fieldtype(Tuple{Any}, 1) does return Any, so I think that result is ok.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right

@vtjnash
Copy link
Sponsor Member

vtjnash commented Apr 27, 2019

I suggest also applying the same fix on line 909:

    exactft1 = exact || (!has_free_typevars(ft1) && u.name !== Tuple.name)

@JeffBezanson JeffBezanson merged commit a78f895 into master Apr 28, 2019
@JeffBezanson JeffBezanson deleted the jb/fix31803 branch April 28, 2019 19:10
KristofferC pushed a commit that referenced this pull request May 9, 2019
@KristofferC KristofferC mentioned this pull request May 9, 2019
58 tasks
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.

Fatal error in type inference in StatsModels
4 participants