mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Move comment and clarify
This commit is contained in:
@@ -477,9 +477,13 @@ func extractObjects(tw *trap.Writer, scope *types.Scope, scopeLabel trap.Label)
|
||||
}
|
||||
// Populate type parameter parents for named types.
|
||||
if typeNameObj, ok := obj.(*types.TypeName); ok {
|
||||
// `types.TypeName` represents a type with a name: a defined
|
||||
// type, an alias type, a type parameter, or a predeclared
|
||||
// type such as `int` or `error`. We can distinguish these
|
||||
// using `typeNameObj.Type()`, except that we need to be
|
||||
// careful with alias types because before Go 1.24 they would
|
||||
// return the underlying type.
|
||||
if tp, ok := typeNameObj.Type().(*types.Named); ok && !typeNameObj.IsAlias() {
|
||||
// `typeNameObj` can only be an alias in versions of Go
|
||||
// before 1.24.
|
||||
populateTypeParamParents(tp.TypeParams(), obj)
|
||||
} else if tp, ok := typeNameObj.Type().(*types.Alias); ok {
|
||||
populateTypeParamParents(tp.TypeParams(), obj)
|
||||
|
||||
Reference in New Issue
Block a user