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

Constprop & specialization annotations are inconsistently applied to kw methods #45050

Closed
timholy opened this issue Apr 21, 2022 · 2 comments
Closed
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@timholy
Copy link
Member

timholy commented Apr 21, 2022

Case 1: missing constprop annotation on kw method

julia> Base.@constprop :none f(@nospecialize(A); x::Int=1) = 2x
f (generic function with 1 method)

julia> m = only(methods(f))
f(A; x) in Main at REPL[1]:1

julia> m.constprop
0x02

julia> m.nospecialize
1

julia> fkw = Core.kwfunc(f)
f##kw (generic function with 1 method)

julia> mkw = only(methods(fkw))
(::var"#f##kw")(::Any, ::typeof(f), A) in Main at REPL[1]:1

julia> mkw.constprop
0x00                                               # should be 0x02

julia> mkw.nospecialize
4

Case 2: arg-wide @nospecialize does not propagate to kw method

julia> Base.@constprop :none f(A; x::Int=1) = (@nospecialize; 2x)
f (generic function with 1 method)

julia> m = only(methods(f))
f(A; x) in Main at REPL[1]:1

julia> m.constprop
0x02

julia> m.nospecialize
-1

julia> fkw = Core.kwfunc(f)
f##kw (generic function with 1 method)

julia> mkw = only(methods(fkw))
(::var"#f##kw")(::Any, ::typeof(f), A) in Main at REPL[1]:1

julia> mkw.constprop
0x00                                         # should be 0x02

julia> mkw.nospecialize
0                                               # should be -1
@timholy timholy added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Apr 21, 2022
@aviatesk
Copy link
Member

Related PR: #45041

@vtjnash
Copy link
Member

vtjnash commented Oct 15, 2022

reported fixed by #45041 (review)

@vtjnash vtjnash closed this as completed Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

No branches or pull requests

3 participants