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

Check untyped const type coercion during decl #4

Closed
quasilyte opened this issue Aug 26, 2018 · 2 comments
Closed

Check untyped const type coercion during decl #4

quasilyte opened this issue Aug 26, 2018 · 2 comments

Comments

@quasilyte
Copy link
Owner

quasilyte commented Aug 26, 2018

func explicitLiteralType() {
	var v1 int32 = 1
	var v2 = int32(1)
}
@quasilyte
Copy link
Owner Author

I wonder if making this work for all var decls is too invasive.
These 2 are always interchangeable:

var x = T(v)
var x T = v

@quasilyte
Copy link
Owner Author

quasilyte commented Aug 26, 2018

It's probably the best option to limit all checks to some kind of "safe" set and include -pedantic option that turns them into more complete versions that may be too much for some users (therefore it's going to be false by default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant