*: switch to int64 for goroutine IDs (#3110)

Go 1.20 switched to uint64 to represent goroutine IDs, we can't
actually follow suit because we have allowed clients to use -1 to refer
to the currently selected goroutine, however we should at least switch
to int64 and also update the rtype check to accept the 1.20 type.
This commit is contained in:
Alessandro Arzilli
2022-08-16 18:31:11 +02:00
committed by GitHub
parent 0c09fc9bdd
commit 5b9f65dac2
19 changed files with 122 additions and 99 deletions

View File

@ -50,8 +50,12 @@
// it must have type T).
//
//
// Anywhere a type is required anytype can be used to specify that we don't
// care about its type.
// Anywhere a type is required the following expressions can be used:
//
// - any builtin type
// - a type defined in the runtime package, without the 'runtime.' prefix
// - anytype to match all possible types
// - an expression of the form T1|T2 where both T1 and T2 can be arbitrary type expressions
package main
@ -379,7 +383,7 @@ func processProcVariableUses(decl ast.Node, tinfo *types.Info, procVarIdent *ast
}
var methodName string
if isParseG {
if xident, _ := fncall.Fun.(*ast.Ident); xident != nil && xident.Name == "loadInt64Maybe" {
if xident, _ := fncall.Fun.(*ast.Ident); xident != nil && (xident.Name == "loadInt64Maybe" || xident.Name == "loadUint64Maybe") {
methodName = "loadInt64Maybe"
}
}
@ -630,6 +634,14 @@ func matchType(typ types.Type, T string) bool {
if T == "anytype" {
return true
}
if strings.Index(T, "|") > 0 {
for _, t1 := range strings.Split(T, "|") {
if typeStr(typ) == t1 {
return true
}
}
return false
}
return typeStr(typ) == T
}