Skip to content

cmd/compile: "invalid recursive type" should abort #21273

@bep

Description

@bep

https://play.golang.org/p/F3pxiyBuIL

package main

type (
	string string
	a      struct {
		m map[string]int
	}
)

The above fails with

./main.go:4: invalid recursive type string
./main.go:6: invalid map key type string

Which is easy to understand and fix. When I recently did a bad "search and replace" in a large code base I ended up with

 invalid map key type string
 invalid map key type string (lots of these)
...
... too many errors

Which is harder to debug without seeing the origin of the error. It will be easier for me to find the culprit the next time I experience something like this, but I had one hour of scratching my head feeling stupid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions