Skip to content

compile: Regression in generics #73624

Closed as duplicate of#60377
Closed as duplicate of#60377
@av86743

Description

@av86743

Go version

Works in 1.20.14, b0rken after 1.21.13

Output of go env in your module/workspace:

Whatever playground settings are.

What did you do?

Playground example is here.

package main

type Parser_T[a_T any] interface{}

func Base_many_6f5dd[_84T any]( /* enlhd */
	_11 Parser_T[_84T]) /* rv: */ Parser_T[_84T] {
	/* returning LazyT[Parser_T[ LazyT[ListT[ _84T ]] ]] */
	//{
	_ = Base_many_6f5dd(_11)
	panic("")
}

func main() {}

Don't bother to lecture me how "you" could "fix" this in "your" code. Those who will, better first verify how this works with reference implementation of generics.

What did you see happen?

Compilation dies with diagnostics:

./prog.go:9:21: in call to Base_many_6f5dd, cannot infer _84T (declared at ./prog.go:5:22)

Bisected using Docker golang:1.xx.yy-alpine images to fail since 1.21.13.

What did you expect to see?

Works as in original early version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions