Skip to content

cmd/compile: allow some calls to generic functions in pre-go1.18 code #61689

@rogpeppe

Description

@rogpeppe

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

$ go version
go version devel go1.21-af8f94e3c5 Tue Jul 11 21:30:51 2023 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

N/A

What did you do?

https://go.dev/play/p/a0oi0qhsoM1?v=gotip

What did you expect to see?

Running code.

What did you see instead?

foo/x.go:4:2: implicit function instantiation requires go1.18 or later (-lang was set to go1.14; check go.mod)

Even though the function signature has been changed in a (mostly) backwardly compatible manner, the version-agnostic code fails to call the new version of the function, even though no code change is required to make it do so.

Perhaps we should allow calls to generic functions where they don't involve explicit generic type parameter syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.genericsIssue is related to generics

    Type

    No type

    Projects

    Status

    In Progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions