Skip to content

x/exp/apidiff: support type constraints #73619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pellared opened this issue May 7, 2025 · 2 comments
Open

x/exp/apidiff: support type constraints #73619

pellared opened this issue May 7, 2025 · 2 comments
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@pellared
Copy link
Contributor

pellared commented May 7, 2025

From #26420 (comment).

Adding a new type term to type element is not seen an API-level change.

For example when changing

type Number interface {
	~float32 | ~float64
}

to

type Number interface {
	~float32 | ~float64 | ~int
}

gorelease suggest to only bump the patch number.

I think it should bump minor number instead.

The reason is that apidiff does not know about type constraints.

@gopherbot gopherbot added this to the Unreleased milestone May 7, 2025
@gabyhelp gabyhelp added the FeatureRequest Issues asking for a new feature that does not need a proposal. label May 7, 2025
@mateusz834
Copy link
Member

mateusz834 commented May 7, 2025

I think it should bump minor number instead.

I wonder what that is correct in terms of backwards compatibility. Or to put it differently, in that case it is probably fine to only bump the minor version, but if you included a non-comparable type to that union, then (i believe) it is an incompatible change, since it could've been used in a map, for example:

type SomeConstraint interface {
	~float32 | ~float64 | ~[]byte // changed from ~float32 | ~float64
}

func test[T SomeConstraint]() {
	_ = map[T]struct{}{} // ERROR invalid map key type T (missing comparable constraint) [IncomparableMapKey]
}

There are for sure other cases like that.

@mateusz834 mateusz834 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 7, 2025
@pellared
Copy link
Contributor Author

pellared commented May 7, 2025

@mateusz834, I agree with you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest Issues asking for a new feature that does not need a proposal. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants