Skip to content
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

compares: problem with types juggling #135

Open
ccoVeille opened this issue Jun 20, 2024 · 0 comments
Open

compares: problem with types juggling #135

ccoVeille opened this issue Jun 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ccoVeille
Copy link
Contributor

Here is a valid piece of code I have in my code base

There is a function that returns an int32, the tests checks if the value is under the max of int16

Here is the minimum to reproduce the issue

	val := int32(42)
	require.True(t, val <= math.MaxInt16)

The code is autofixed to this

	val := int32(42)
	require.LessOrEqual(t, val, math.MaxInt16)

Which is valid, BUT then require.LessOrEqual will report that val(int32) is not from the same type as math.MaxInt16) (an untyped int)

                Error:          Elements should be the same type

Yes, the code could have been written in a another way, but testifylint provided something that cannot work.

@Antonboom Antonboom added the bug Something isn't working label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants