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
x/tools/cmd/stringer: does not recognize X = T(iota) #11581
Comments
I encountered this too. Should be easy enough to teach it to recognise type conversions; will give it a go. |
Change https://golang.org/cl/85015 mentions this issue: |
Instead, just write
Stringer doesn't need to support the full language. |
I initially thought it would be better for stringer to be more lax in what it accepts, since in a user's code both However, I do see that this can lead to a certain slippery slope. And I struggle to think of a reason why rewriting to the simpler (AST-wise) |
I'm convinced now that we shouldn't do this. If anyone feels like there is a compelling reason to support this form, feel free to reopen this discussion at a later time. |
I think this can be addressed for simple cases (e.g. a plain type conversion) with less code than https://golang.org/cl/85015 was proposing. I'm going to send an alternate change. |
Note that while |
https://go-review.googlesource.com/c/146577 has been merged and I think this issue can be closed. (the referenced issue in the Fixes line is |
Good point, closing. |
Given
stringer fails:
The text was updated successfully, but these errors were encountered: