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

inference: fix recursion limit heuristic #28517

Merged
merged 1 commit into from
Aug 8, 2018
Merged

inference: fix recursion limit heuristic #28517

merged 1 commit into from
Aug 8, 2018

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Aug 8, 2018

There's several related issues here:

  1. Covariant kinds provide no meaningful information for the type size
    limit heuristic. We should be just ignoring those and walking through to
    the actual structural information of any real substance.
    This seems to also make type_more_complex, _limit_type_size, and
    is_derived_type more similar, which is probably always preferable.

  2. Allowing type intersection to revise our type later can
    cause it to reintroduce complexity (constraints) according to our metric,
    while we want to only move up the type-hierarchy,
    which can allow us to accidentally escape from the limit.
    So if we've limited the type, we don't want to use a different type
    that was derived by type-intersection and may not have our limits
    applied anymore.

  3. Inside is_derived_type, the var field of a UnionAll
    should not increase the nesting depth, since T<:(Ref{S} where S<:Any),
    should observe the same depth as {S<:Any, T<:Ref{S}}.

fix #26665

There's several related issues here:

1. Covariant kinds provide no meaningful information for the type size
limit heuristic. We should be just ignoring those and walking through to
the actual structural information of any real substance.
This seems to also make type_more_complex, _limit_type_size, and
is_derived_type more similar, which is probably always preferable.

2. Allowing type intersection to revise our type later can
cause it to reintroduce complexity (constraints) according to our metric,
while we want to only move up the type-hierarchy,
which can allow us to accidentally escape from the limit.
So if we've limited the type, we don't want to use a different type
that was derived by type-intersection and may not have our limits
applied anymore.

3. Inside `is_derived_type`, the var field of a UnionAll
should not increase the nesting depth, since `T<:(Ref{S} where S<:Any)`,
should observe the same depth as `{S<:Any, T<:Ref{S}}`.

fix #26665
@vtjnash vtjnash added bugfix This change fixes an existing bug compiler:inference Type inference labels Aug 8, 2018
@thofma
Copy link
Contributor

thofma commented Aug 8, 2018

Thanks! Will there be another release candidate for 0.7? If so, could this be backported?

@ararslan
Copy link
Member

ararslan commented Aug 8, 2018

Will there be another release candidate for 0.7?

No, the final 0.7.0 has already been tagged.

@thofma
Copy link
Contributor

thofma commented Aug 8, 2018

Obvious next question: Will there be 1.0-rc2?

@Keno
Copy link
Member

Keno commented Aug 8, 2018

Obvious next question: Will there be 1.0-rc2?

No, but this will go into 1.0 final.

@Keno Keno requested a review from JeffBezanson August 8, 2018 09:56
@JeffBezanson
Copy link
Member

If you end up needing a version of 0.7 (to get deprecation warnings) that has this bug fix, we can release a 0.7.1 at some point.

@ararslan ararslan mentioned this pull request Aug 8, 2018
5 tasks
@thofma
Copy link
Contributor

thofma commented Aug 8, 2018

Indeed, I was thinking about the deprecation warnings. Thanks.

@JeffBezanson
Copy link
Member

Oh wow, this fixes issue #26665. I just checked but unfortunately @vtjnash did not also fix #2665. Hopefully he will be around to fix #266665.

@Keno
Copy link
Member

Keno commented Aug 8, 2018

PkgEval shows the same set of packages passing as on master. Merging.

@Keno Keno merged commit 239f903 into master Aug 8, 2018
Copy link
Member

@JeffBezanson JeffBezanson left a comment

Choose a reason for hiding this comment

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

approve

@martinholters martinholters deleted the jn/26665 branch August 8, 2018 13:11
@thofma
Copy link
Contributor

thofma commented Aug 8, 2018

Thanks again for fixing this Jameson.

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.

Internal error: StackOverflowError()
6 participants