mirror of
https://github.com/github/codeql.git
synced 2026-05-23 23:57:06 +02:00
Update labels for alias types
Use object like we do for named types.
This commit is contained in:
committed by
Michael B. Gale
parent
649bf5ac3b
commit
fe6d3648ae
@@ -1789,13 +1789,18 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
|
||||
}
|
||||
lbl = tw.Labeler.GlobalID(fmt.Sprintf("%s;typesetliteraltype", b.String()))
|
||||
case *types.Alias:
|
||||
var b strings.Builder
|
||||
b.WriteString(tp.Obj().Id())
|
||||
// Ensure that the definition of the alias gets extracted,
|
||||
// which may be an alias in itself.
|
||||
// Ensure that the definition of the aliased type gets extracted
|
||||
// (which may be an alias in itself).
|
||||
extractType(tw, tp.Rhs())
|
||||
// Construct the label for this type alias.
|
||||
lbl = tw.Labeler.GlobalID(fmt.Sprintf("%s;typealias", b.String()))
|
||||
|
||||
entitylbl, exists := tw.Labeler.LookupObjectID(tp.Obj(), lbl)
|
||||
if entitylbl == trap.InvalidLabel {
|
||||
panic(fmt.Sprintf("Cannot construct label for alias type %v (underlying object is %v).\n", tp, tp.Obj()))
|
||||
}
|
||||
if !exists {
|
||||
extractObject(tw, tp.Obj(), entitylbl)
|
||||
}
|
||||
lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s};aliastype", entitylbl))
|
||||
default:
|
||||
log.Fatalf("(getTypeLabel) unexpected type %T", tp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user