-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Closed
Copy link
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)
Description
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
4Case 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 -1Metadata
Metadata
Assignees
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)