WIP: Improve nothrow modeling for :static_parameter#46820
Merged
Conversation
vtjnash
reviewed
Sep 18, 2022
| end | ||
|
|
||
| """ | ||
| has_non_dt_typevar(typ, v) -> Bool |
Member
There was a problem hiding this comment.
I think we have an existing version of this in Test which is much less conservative (it does methods lookups too)? Should we try to unify them?
Member
Author
There was a problem hiding this comment.
You're talking about Test.constrains_param?
737267b to
b7059b7
Compare
Member
|
Seems good to me --- are the test failures related to deletion that now occurs due to increased effects accuracy? |
ianatol
approved these changes
Sep 23, 2022
Member
|
@Keno what's the status of this? Do we want it? |
423b939 to
dd6aab0
Compare
609f039 to
6181f20
Compare
dd6aab0 to
860f7c7
Compare
eb08722 to
5fbbd34
Compare
5fbbd34 to
468b612
Compare
aviatesk
pushed a commit
that referenced
this pull request
Feb 7, 2023
staticfloat
pushed a commit
that referenced
this pull request
Feb 8, 2023
aviatesk
pushed a commit
that referenced
this pull request
Feb 8, 2023
Keno
added a commit
that referenced
this pull request
Feb 8, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)
With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```
This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```
* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)
* Fix test with free type params
* Test: Ignore ::Type{T} in detect_unbounded
These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.
---------
Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
KristofferC
pushed a commit
that referenced
this pull request
Feb 20, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)
With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```
This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```
* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)
* Fix test with free type params
* Test: Ignore ::Type{T} in detect_unbounded
These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.
---------
Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
(cherry picked from commit b5d17ea)
KristofferC
pushed a commit
that referenced
this pull request
Feb 20, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)
With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```
This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```
* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)
* Fix test with free type params
* Test: Ignore ::Type{T} in detect_unbounded
These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.
---------
Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
(cherry picked from commit b5d17ea)
KristofferC
pushed a commit
that referenced
this pull request
Feb 20, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)
With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```
This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```
* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)
* Fix test with free type params
* Test: Ignore ::Type{T} in detect_unbounded
These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.
---------
Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
(cherry picked from commit b5d17ea)
KristofferC
pushed a commit
that referenced
this pull request
Feb 21, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)
With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```
This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```
* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)
* Fix test with free type params
* Test: Ignore ::Type{T} in detect_unbounded
These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.
---------
Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
(cherry picked from commit b5d17ea)
KristofferC
pushed a commit
that referenced
this pull request
Feb 21, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)
With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```
This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```
* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)
* Fix test with free type params
* Test: Ignore ::Type{T} in detect_unbounded
These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.
---------
Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
(cherry picked from commit b5d17ea)
KristofferC
pushed a commit
that referenced
this pull request
Feb 21, 2023
* effects: taint `:nothrow` effect on unknown `:static_parameter` (conservatively)
With this commit, we taint `:nothrow` effect property correctly on
access to unknown `:static_parameter`, e.g.:
```julia
unknown_sparam_throw(::Union{Nothing, Type{T}}) where T = (T; nothing)
@test Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Type{Int},))))
@test !Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_throw, ((Nothing,))))
```
This commit implements a very conservative analysis, and thus there is a
room for improvement still, e.g.:
```julia
unknown_sparam_nothrow(x::Ref{T}) where {T} = (T; nothing)
@test_broken Core.Compiler.is_nothrow(Base.infer_effects(unknown_sparam_nothrow, (Ref,)))
```
* inference: improve `:nothrow` modeling for `:static_parameter` (#46820)
* Fix test with free type params
* Test: Ignore ::Type{T} in detect_unbounded
These are only technically unbounded because of the existence of
ill-formed types. However, this function is supposed to be an API
sanity check and ordinary users should never have ill-formed types,
so for the purpose we want here, allow unboundedness in Type{T}.
---------
Co-authored-by: Keno Fischer <keno@juliacomputing.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
(cherry picked from commit b5d17ea)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@aviatesk This was my attempt at #46791 while retaining some precision. Untested, but maybe it helps.