mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
fix: add missing TypeCheck call (#1308)
This commit is contained in:
committed by
GitHub
parent
7b2c7e74fc
commit
57ed899d0c
@@ -16,6 +16,8 @@ type UnexportedReturnRule struct{}
|
||||
func (*UnexportedReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
|
||||
var failures []lint.Failure
|
||||
|
||||
file.Pkg.TypeCheck()
|
||||
|
||||
for _, decl := range file.AST.Decls {
|
||||
fn, ok := decl.(*ast.FuncDecl)
|
||||
if !ok {
|
||||
@@ -70,7 +72,7 @@ func (*UnexportedReturnRule) Name() string {
|
||||
// It is imprecise, and will err on the side of returning true,
|
||||
// such as for composite types.
|
||||
func exportedType(typ types.Type) bool {
|
||||
switch t := typ.(type) {
|
||||
switch t := types.Unalias(typ).(type) {
|
||||
case *types.Named:
|
||||
obj := t.Obj()
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user