Skip to content

cmd/compile, go/types: recursive type matching regression #48695

Closed
@reusee

Description

@reusee

What version of Go are you using (go version)?

$ go version
go version devel go1.18-66562692880 Thu Sep 30 01:32:54 2021 +0000 windows/amd64

Does this issue reproduce with the latest release?

No

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\reus\AppData\Local\go-build
set GOENV=C:\Users\reus\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\reus\go\pkg\mod
set GONOPROXY=github.com/reusee/*
set GONOSUMDB=github.com/reusee/*
set GOOS=windows
set GOPATH=C:\Users\reus\go
set GOPRIVATE=github.com/reusee/*
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Users\reus\sdk\gotip
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Users\reus\sdk\gotip\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.18-66562692880 Thu Sep 30 01:32:54 2021 +0000
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\reus\AppData\Local\Temp\go-build2696702073=/tmp/go-build -gno-record-gcc-switches
GOROOT/bin/go version: go version devel go1.18-66562692880 Thu Sep 30 01:32:54 2021 +0000 windows/amd64
GOROOT/bin/go tool compile -V: compile version devel go1.18-66562692880 Thu Sep 30 01:32:54 2021 +0000
gdb --version: GNU gdb (GDB for MinGW-W64 x86_64, built by Brecht Sanders) 10.2

What did you do?

package main

func Foo[
        T any,
        P interface {
                ~func(T) P
        },
](P) {
}

func main() {
        type P func(int) P
        Foo(P(nil))
}

What did you expect to see?

compile OK

What did you see instead?

.\a.go:5:2: type P = P does not match func(T) P

@griesemer The program used to be accepted by the compiler before 435718e

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions