The bug occurs because the jl_static_show function in rtutils.c is not correctly handling the special case of Core.IntrinsicFunction types. The Symbol name in the MethodTable of jl_intrinsic_type is causing confusion, leading to incorrect representation when printed.
How to reproduce
Call which(Core.Compiler.is_pure_intrinsic_infer, (Core.IntrinsicFunction,)).sig and observe the correct output.
Pipe the result to Core.println and observe the incorrect representation.
Check the name and method table name of Core.IntrinsicFunction to see the inconsistency.
How to fix
Modify the jl_static_show function in rtutils.c to utilize the jl_intrinsic_name function for Core.IntrinsicFunction types. This will ensure that the correct identifier is printed.
Update the is_globname_binding function to take an additional argument indicating whether v is a value or type. This will allow branching based on this information instead of using the || operator, which currently leads to incorrect behavior.
Test the changes to ensure that the representation is now consistent and correct for Core.IntrinsicFunction types.
"""
Original issue: #9
Why the bug occurs
The bug occurs because the
jl_static_show
function inrtutils.c
is not correctly handling the special case ofCore.IntrinsicFunction
types. The Symbol name in the MethodTable ofjl_intrinsic_type
is causing confusion, leading to incorrect representation when printed.How to reproduce
which(Core.Compiler.is_pure_intrinsic_infer, (Core.IntrinsicFunction,)).sig
and observe the correct output.Core.println
and observe the incorrect representation.Core.IntrinsicFunction
to see the inconsistency.How to fix
jl_static_show
function inrtutils.c
to utilize thejl_intrinsic_name
function forCore.IntrinsicFunction
types. This will ensure that the correct identifier is printed.is_globname_binding
function to take an additional argument indicating whetherv
is a value or type. This will allow branching based on this information instead of using the||
operator, which currently leads to incorrect behavior.Core.IntrinsicFunction
types. """Test these changes locally