Skip to content

Can't detect forced type assertions followed by method calls #18

@favonia

Description

@favonia

Consider the following code:

type M struct{}

func (M) F() (bool, bool) { return true, true }
func Test(x any) bool {
	_, ok := x.(M).F()
	return ok
}

The x.(M) is a forced type assertion, but the subsequent .F() masks the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions