test(demo): add regression demos for issue #1370 cases
- case1: go/types.Object with Scope.Insert() calling private setParent() - case2: go/ast.Expr interface conversion with private exprNode() Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
This commit is contained in:
18
_demo/go/issue1370_case1/main.go
Normal file
18
_demo/go/issue1370_case1/main.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"go/types"
|
||||
)
|
||||
|
||||
func main() {
|
||||
scope := types.NewScope(nil, 0, 0, "test")
|
||||
obj := types.NewVar(0, nil, "x", types.Typ[types.Int])
|
||||
|
||||
scope.Insert(obj)
|
||||
|
||||
if scope.Lookup("x") == obj {
|
||||
println("SUCCESS: Scope.Insert and Lookup work correctly")
|
||||
} else {
|
||||
println("FAIL: Lookup returned wrong object")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user