Skip to content

cmd/compile: cannot parse certain constraint literals in generic functions #49174

@griesemer

Description

@griesemer
package p

func _[_ []int | int]() {}  // cannot parse: syntax error: unexpected |, expecting comma or ]
func _[_ int | []int]() {}  // ok

Both constraints are identical and both are valid. Should be able to parse both of them.

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.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions