]> Cypherpunks repositories - gostls13.git/commit
cmd/vet: assume that no builtin funcs are pure
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 9 May 2018 04:11:49 +0000 (11:11 +0700)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 9 May 2018 05:13:03 +0000 (05:13 +0000)
commit2486ebfb6381146d3c50c8495000da2193c42785
treeb969f17a22b06423195fd8ade51f8c7d8ca65405
parent23e9dc79941be24d381d2e2c85600d4a3d0d6921
cmd/vet: assume that no builtin funcs are pure

That was the intention with the existing code, but it was buggy; builtin
functions aren't treated as values by types.TypeAndVal. Thus, we should
use the IsBuiltin method instead of IsValue.

Teaching vet what builtin funcs are pure is already being tracked as a
separate issue, #22851.

While at it, also add a test with methods, just to be sure that the
current logic doesn't break with that edge case either.

Fixes #25303.

Change-Id: Ic18402b22cceeabf76641c02f575b194b9a536cc
Reviewed-on: https://go-review.googlesource.com/112177
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/vet/bool.go
src/cmd/vet/testdata/bool.go