Skip to content

x/tools/go/types/objectpath: TestOrdering asserts that method order is source-independent; should be that go/types agrees with cmd/compile #78495

@adonovan

Description

@adonovan

TestOrdering has always contained a typo, now flagged by staticcheck in gopls, that causes its assertion to trivially pass. Fixing it reveals that the test was broken by yours truly in b9b97d9 (go.dev/cl/534139) when we removed Id-based sorting (because expensive). That means we are now using Pos-based sorting.

This seems like a bad outcome for gopls, among others:

  • Reordering method decls may change the object paths for them and their elements (params etc).
  • analysis fact caching may be broken.
  • the objectpaths obtained when parsing source or loading from export data may differ.

The task of this issue is to figure out how bad this is and either reintroduce sorting (perhaps optimized somehow) or some other fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions