quasilyte/go-consistent

Check untyped const type coercion during decl

quasilyte opened this issue · 2 comments

func explicitLiteralType() {
	var v1 int32 = 1
	var v2 = int32(1)
}

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

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).