-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)macros@macros@macrostypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
julia> @noinline valid(@nospecialize x::Any) = Base.inferencebarrier(0)
valid (generic function with 1 method)
julia> @noinline invalid1(@nospecialize ::Any) = Base.inferencebarrier(0)
invalid1 (generic function with 1 method)
julia> @noinline invalid2(@nospecialize ::Any) = Base.inferencebarrier(0)
invalid2 (generic function with 1 method)
julia> code_typed((Any,)) do x
valid(x), invalid1(x), invalid2(x)
end
1-element Vector{Any}:
CodeInfo(
1 ─ %1 = invoke Main.valid(x::Any)::Any
│ %2 = Main.invalid1(x)::Any
│ %3 = Main.invalid2(x)::Any
│ %4 = Core.tuple(%1, %2, %3)::Tuple{Any, Any, Any}
└── return %4
) => Tuple{Any, Any, Any}Here calls to invalid1 and invalid2 should be resolved statically (i.e. resolved to :invoke expressions) since their ::Any-argument is explicitly declared as @nospecialize.
Metadata
Metadata
Assignees
Labels
compiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)macros@macros@macrostypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch