1
0
mirror of https://github.com/mgechev/revive.git synced 2025-10-30 23:37:49 +02:00

fix (1217): getting parameter type names panics in presence of generic types (#1218)

This commit is contained in:
chavacava
2025-02-04 12:26:17 +01:00
committed by GitHub
parent a34327e65c
commit fd8d99d716
2 changed files with 5 additions and 0 deletions

View File

@@ -71,6 +71,8 @@ func getFieldTypeName(typ ast.Expr) string {
return f.Sel.Name + "." + getFieldTypeName(f.X)
case *ast.StarExpr:
return "*" + getFieldTypeName(f.X)
case *ast.IndexExpr:
return getFieldTypeName(f.X) + "[" + getFieldTypeName(f.Index) + "]"
default:
panic(fmt.Sprintf("not supported type %T", typ))
}

View File

@@ -41,3 +41,6 @@ func (vv Vv) Less(i int, j int) (result bool) { return w[i] < w[j] } // MATCH /e
type X []int
func (x X) Less(i *pkg.tip) (result bool) { return len(x) } // MATCH /exported method X.Less should have comment or be unexported/
// Test for issue #1217
func (s *synchronized[T]) Swap(other Synchronized[T]) {}