Skip to content

go/types, types2: writeType does not invoke Qualifier when printing an unsafe.Pointer #44515

Closed
@cixel

Description

@cixel

Because unsafe.Pointer is a *types.Basic, the type stringifier uses a special case to print the package name:

case *Basic:
	if t.kind == UnsafePointer {
		buf.WriteString("unsafe.")
	}

As written, this does not allow a given Qualifier function to run and control how the package name is printed, which means that anything which wants to print something other than "unsafe" must do so by also special casing unsafe.Pointer.

Is there any reason not to use the Qualifier function in writeType when printing unsafe.Pointer? This would be a very quick change, but I wanted to make sure the current functionality isn't deliberate before opening a CL.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions