Skip to content

cmd/compile: improve error message for invalid use of interface with type constraints #50837

@virtuald

Description

@virtuald

What did you do?

https://gotipplay.golang.org/p/K_OPRyt5aJo

package main

type C interface {
	~int
	Fn()
}

func UseInterface(c C) {}

type Foo struct {
	I C
}

What did you expect to see?

./prog.go:8:21: interface with type constraints used as function parameter
./prog.go:11:4: interface with type constraints cannot be used as field

What did you see instead?

./prog.go:8:21: interface contains type constraints
./prog.go:11:4: interface contains type constraints

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions