Getting the original name of structs

I want to write a function get_original_name(::DataType) that returns the original name used when declaring a struct. Is there any way to do this? Is the original name even distinguishable from names that were added later?

struct A end
B = A
@assert get_original_name(B) == :(Main.A)

The goal is to define a function get_original_name so that, the assert is met.

You may use

julia> nameof(B)

Although this strips the module

1 Like

If you want the module as well:

julia> parentmodule(B)