pkg/proc: fix type cast between slices (#4048)

Type casts between slice types with the same element type should be
allowed. In theory this should be allowed by the check on the real type
(which already gets rid of typedefs) but the compiler here actually
creates a distinct type for Message instead of having it as a typedef
for []uint8.

Fixes #4042
This commit is contained in:
Alessandro Arzilli
2025-07-08 18:59:40 +02:00
committed by GitHub
parent efbc259a67
commit b950bcf0a9
3 changed files with 10 additions and 1 deletions

View File

@ -1820,6 +1820,10 @@ func typeCastCompatibleTypes(typ1, typ2 godwarf.Type) bool {
}
return true
}
case *godwarf.SliceType:
if ttyp2, ok := typ2.(*godwarf.SliceType); ok {
return ttyp1.ElemType.String() == ttyp2.ElemType.String()
}
case *godwarf.ComplexType:
if _, ok := typ2.(*godwarf.ComplexType); ok {
// size and alignment already checked above