• Daniel Martí's avatar
    cmd/vet: recognise func type conversions · 3fbfc83d
    Daniel Martí authored
    In hasSideEffects, vet has to be taught whether or not a CallExpr is an
    actual function call, or just a type conversion.
    
    The previous code knew how to differentiate fn(arg) from int(arg), but
    it incorrectly saw (func(T))(fn) as a func call. This edge case is
    slightly tricky, since the CallExpr.Fun has a func signature type, just
    like in func calls.
    
    However, the difference is that in this case the Fun is a type, not a
    value. This information is in types.TypeAndValue, so use it.
    
    Change-Id: I18bb8b23abbe7decc558b726ff2dc31fae2f13d6
    Reviewed-on: https://go-review.googlesource.com/111416
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    3fbfc83d
bool.go 4.82 KB