Skip to content

Commit 57ed899

Browse files
authored
fix: add missing TypeCheck call (#1308)
1 parent 7b2c7e7 commit 57ed899

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rule/unexported_return.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ type UnexportedReturnRule struct{}
1616
func (*UnexportedReturnRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
1717
var failures []lint.Failure
1818

19+
file.Pkg.TypeCheck()
20+
1921
for _, decl := range file.AST.Decls {
2022
fn, ok := decl.(*ast.FuncDecl)
2123
if !ok {
@@ -70,7 +72,7 @@ func (*UnexportedReturnRule) Name() string {
7072
// It is imprecise, and will err on the side of returning true,
7173
// such as for composite types.
7274
func exportedType(typ types.Type) bool {
73-
switch t := typ.(type) {
75+
switch t := types.Unalias(typ).(type) {
7476
case *types.Named:
7577
obj := t.Obj()
7678
switch {

0 commit comments

Comments
 (0)