Skip to content

proposal: spec: permit using var.(type) when instantiating a generic function #58608

Closed
@boobusy

Description

@boobusy
type Demo struct{}
func UseFunc[T any]() {}

var value = new(Demo)
UseFunc[value.(type)]()

build error: invalid AST: use of .(type) outside type switch.

Hope to support value.(type) in generics code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions