Skip to content

go/types, types2: handle embedding of type parameters correctly #47127

Closed
@griesemer

Description

@griesemer
package p

func _[E1 interface{ m() E1 }, E2 interface{ E1 } ](c1 chan E1, c2 chan E2) {
        x1 := (<-c1).m()
        x2 := (<-c2).m()
        _ = x1
        _ = x2
}

produces

(<-c2).m undefined (type bound for E2 has no method m)

This should either be permitted or embedding of E1 in the E2 constraint should be explicitly forbidden.

cc: @findleyr

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions