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 getglobal_nothrow #44855

Merged
merged 1 commit into from
Apr 5, 2022
Merged

fix getglobal_nothrow #44855

merged 1 commit into from
Apr 5, 2022

Conversation

simeonschaub
Copy link
Member

No description provided.

@simeonschaub simeonschaub added embarrassing-bugfix Whoops! merge me PR is reviewed. Merge when all tests are passing labels Apr 4, 2022
@simeonschaub simeonschaub merged commit 7a61fc0 into master Apr 5, 2022
@simeonschaub simeonschaub deleted the sds/fix_tfunc branch April 5, 2022 02:21
@aviatesk
Copy link
Member

aviatesk commented Apr 5, 2022

Maybe we want to have this kind of extensive tests for these getglobal/setglobal primitives also?

import Core.Compiler: setfield!_tfunc, setfield!_nothrow, Const
mutable struct XY{X,Y}
x::X
y::Y
end
mutable struct ABCDconst
const a
const b::Int
c
const d::Union{Int,Nothing}
end
@test setfield!_tfunc(Base.RefValue{Int}, Const(:x), Int) === Int
@test setfield!_tfunc(Base.RefValue{Int}, Const(:x), Int, Symbol) === Int
@test setfield!_tfunc(Base.RefValue{Int}, Const(1), Int) === Int
@test setfield!_tfunc(Base.RefValue{Int}, Const(1), Int, Symbol) === Int
@test setfield!_tfunc(Base.RefValue{Int}, Int, Int) === Int
@test setfield!_tfunc(Base.RefValue{Any}, Const(:x), Int) === Int
@test setfield!_tfunc(Base.RefValue{Any}, Const(:x), Int, Symbol) === Int
@test setfield!_tfunc(Base.RefValue{Any}, Const(1), Int) === Int
@test setfield!_tfunc(Base.RefValue{Any}, Const(1), Int, Symbol) === Int
@test setfield!_tfunc(Base.RefValue{Any}, Int, Int) === Int
@test setfield!_tfunc(XY{Any,Any}, Const(1), Int) === Int
@test setfield!_tfunc(XY{Any,Any}, Const(2), Float64) === Float64
@test setfield!_tfunc(XY{Int,Float64}, Const(1), Int) === Int
@test setfield!_tfunc(XY{Int,Float64}, Const(2), Float64) === Float64
@test setfield!_tfunc(ABCDconst, Const(:c), Any) === Any
@test setfield!_tfunc(ABCDconst, Const(3), Any) === Any
@test setfield!_tfunc(ABCDconst, Symbol, Any) === Any
@test setfield!_tfunc(ABCDconst, Int, Any) === Any
@test setfield!_tfunc(Union{Base.RefValue{Any},Some{Any}}, Const(:x), Int) === Int
@test setfield!_tfunc(Union{Base.RefValue,Some{Any}}, Const(:x), Int) === Int
@test setfield!_tfunc(Union{Base.RefValue{Any},Some{Any}}, Const(1), Int) === Int
@test setfield!_tfunc(Union{Base.RefValue,Some{Any}}, Const(1), Int) === Int
@test setfield!_tfunc(Union{Base.RefValue{Any},Some{Any}}, Symbol, Int) === Int
@test setfield!_tfunc(Union{Base.RefValue,Some{Any}}, Symbol, Int) === Int
@test setfield!_tfunc(Union{Base.RefValue{Any},Some{Any}}, Int, Int) === Int
@test setfield!_tfunc(Union{Base.RefValue,Some{Any}}, Int, Int) === Int
@test setfield!_tfunc(Any, Symbol, Int) === Int
@test setfield!_tfunc(Any, Int, Int) === Int
@test setfield!_tfunc(Any, Any, Int) === Int
@test setfield!_tfunc(Base.RefValue{Int}, Const(:x), Float64) === Union{}
@test setfield!_tfunc(Base.RefValue{Int}, Const(:x), Float64, Symbol) === Union{}
@test setfield!_tfunc(Base.RefValue{Int}, Const(1), Float64) === Union{}
@test setfield!_tfunc(Base.RefValue{Int}, Const(1), Float64, Symbol) === Union{}
@test setfield!_tfunc(Base.RefValue{Int}, Int, Float64) === Union{}
@test setfield!_tfunc(Base.RefValue{Any}, Const(:y), Int) === Union{}
@test setfield!_tfunc(Base.RefValue{Any}, Const(:y), Int, Bool) === Union{}
@test setfield!_tfunc(Base.RefValue{Any}, Const(2), Int) === Union{}
@test setfield!_tfunc(Base.RefValue{Any}, Const(2), Int, Bool) === Union{}
@test setfield!_tfunc(Base.RefValue{Any}, String, Int) === Union{}
@test setfield!_tfunc(Some{Any}, Const(:value), Int) === Union{}
@test setfield!_tfunc(Some, Const(:value), Int) === Union{}
@test setfield!_tfunc(Some{Any}, Const(1), Int) === Union{}
@test setfield!_tfunc(Some, Const(1), Int) === Union{}
@test setfield!_tfunc(Some{Any}, Symbol, Int) === Union{}
@test setfield!_tfunc(Some, Symbol, Int) === Union{}
@test setfield!_tfunc(Some{Any}, Int, Int) === Union{}
@test setfield!_tfunc(Some, Int, Int) === Union{}
@test setfield!_tfunc(Const(@__MODULE__), Const(:v), Int) === Union{}
@test setfield!_tfunc(Const(@__MODULE__), Int, Int) === Union{}
@test setfield!_tfunc(Module, Const(:v), Int) === Union{}
@test setfield!_tfunc(Union{Module,Base.RefValue{Any}}, Const(:v), Int) === Union{}
@test setfield!_tfunc(ABCDconst, Const(:a), Any) === Union{}
@test setfield!_tfunc(ABCDconst, Const(:b), Any) === Union{}
@test setfield!_tfunc(ABCDconst, Const(:d), Any) === Union{}
@test setfield!_tfunc(ABCDconst, Const(1), Any) === Union{}
@test setfield!_tfunc(ABCDconst, Const(2), Any) === Union{}
@test setfield!_tfunc(ABCDconst, Const(4), Any) === Union{}
@test setfield!_nothrow(Base.RefValue{Int}, Const(:x), Int)
@test setfield!_nothrow(Base.RefValue{Int}, Const(1), Int)
@test setfield!_nothrow(Base.RefValue{Any}, Const(:x), Int)
@test setfield!_nothrow(Base.RefValue{Any}, Const(1), Int)
@test setfield!_nothrow(XY{Any,Any}, Const(:x), Int)
@test setfield!_nothrow(XY{Any,Any}, Const(:x), Any)
@test setfield!_nothrow(XY{Int,Float64}, Const(:x), Int)
@test setfield!_nothrow(ABCDconst, Const(:c), Any)
@test setfield!_nothrow(ABCDconst, Const(3), Any)
@test !setfield!_nothrow(XY{Int,Float64}, Symbol, Any)
@test !setfield!_nothrow(XY{Int,Float64}, Int, Any)
@test !setfield!_nothrow(Base.RefValue{Int}, Const(:x), Any)
@test !setfield!_nothrow(Base.RefValue{Int}, Const(1), Any)
@test !setfield!_nothrow(Any[Base.RefValue{Any}, Const(:x), Int, Symbol])
@test !setfield!_nothrow(Base.RefValue{Any}, Symbol, Int)
@test !setfield!_nothrow(Base.RefValue{Any}, Int, Int)
@test !setfield!_nothrow(XY{Int,Float64}, Const(:y), Int)
@test !setfield!_nothrow(XY{Int,Float64}, Symbol, Int)
@test !setfield!_nothrow(XY{Int,Float64}, Int, Int)
@test !setfield!_nothrow(ABCDconst, Const(:a), Any)
@test !setfield!_nothrow(ABCDconst, Const(:b), Any)
@test !setfield!_nothrow(ABCDconst, Const(:d), Any)
@test !setfield!_nothrow(ABCDconst, Symbol, Any)
@test !setfield!_nothrow(ABCDconst, Const(1), Any)
@test !setfield!_nothrow(ABCDconst, Const(2), Any)
@test !setfield!_nothrow(ABCDconst, Const(4), Any)
@test !setfield!_nothrow(ABCDconst, Int, Any)
@test !setfield!_nothrow(Union{Base.RefValue{Any},Some{Any}}, Const(:x), Int)
@test !setfield!_nothrow(Union{Base.RefValue,Some{Any}}, Const(:x), Int)
@test !setfield!_nothrow(Union{Base.RefValue{Any},Some{Any}}, Const(1), Int)
@test !setfield!_nothrow(Union{Base.RefValue,Some{Any}}, Const(1), Int)
@test !setfield!_nothrow(Union{Base.RefValue{Any},Some{Any}}, Symbol, Int)
@test !setfield!_nothrow(Union{Base.RefValue,Some{Any}}, Symbol, Int)
@test !setfield!_nothrow(Union{Base.RefValue{Any},Some{Any}}, Int, Int)
@test !setfield!_nothrow(Union{Base.RefValue,Some{Any}}, Int, Int)
@test !setfield!_nothrow(Any, Symbol, Int)
@test !setfield!_nothrow(Any, Int, Int)
@test !setfield!_nothrow(Any, Any, Int)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants