Skip to content

Commit ab3a59e

Browse files
authored
Merge pull request #329 from goplus/main
v1.13.2
2 parents 719ee16 + a6c41ff commit ab3a59e

File tree

11 files changed

+117
-253
lines changed

11 files changed

+117
-253
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55

66
version: 2
77
updates:
8+
- package-ecosystem: github-actions
9+
directory: /
10+
labels:
11+
- dependabot
12+
- actions
13+
schedule:
14+
interval: daily
15+
816
- package-ecosystem: "gomod" # See documentation for possible values
917
directory: "/" # Location of package manifests
1018
schedule:

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
os: [ubuntu-latest, windows-latest, macos-11]
1515
runs-on: ${{ matrix.os }}
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v3
20+
uses: actions/setup-go@v5
2121
with:
2222
go-version: ${{ matrix.go-version }}
2323

ast.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ retry:
619619
if ret.CVal == nil && isUntyped(pkg, ret.Type) {
620620
ret.CVal = builtinCall(fn, args)
621621
}
622+
if pkg.cb.rec != nil {
623+
pkg.cb.rec.Call(fn.Src, o)
624+
}
622625
return
623626
}
624627
restoreArgs(args, backup)
@@ -636,6 +639,9 @@ retry:
636639
}
637640
if ret, err = matchFuncCall(pkg, &mfn, args, flags); err == nil {
638641
fn.Val, fn.Type = mfn.Val, mfn.Type
642+
if pkg.cb.rec != nil {
643+
pkg.cb.rec.Call(fn.Src, o)
644+
}
639645
return
640646
}
641647
restoreArgs(args, backup)
@@ -658,6 +664,9 @@ retry:
658664
targs[j+1] = arg
659665
}
660666
if ret, err = matchFuncCall(pkg, tfn, targs, flags); err == nil {
667+
if pkg.cb.rec != nil {
668+
pkg.cb.rec.Call(fn.Src, ft.Func)
669+
}
661670
return
662671
}
663672
if isPointer(targ0.Type) {

builtin_test.go

Lines changed: 3 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ func typString(pkg *Package, t types.Type) string {
501501
func TestMethodAutoProperty(t *testing.T) {
502502
typs := []types.Type{
503503
tyInt,
504-
sigFuncEx(nil, &TyOverloadFunc{}),
505-
sigFuncEx(nil, &TyTemplateRecvMethod{types.NewParam(0, nil, "", tyInt)}),
504+
sigFuncEx(nil, nil, &TyOverloadFunc{}),
505+
sigFuncEx(nil, nil, &TyTemplateRecvMethod{types.NewParam(0, nil, "", tyInt)}),
506506
}
507507
for _, typ := range typs {
508508
if methodHasAutoProperty(typ, 0) {
@@ -512,7 +512,7 @@ func TestMethodAutoProperty(t *testing.T) {
512512
}
513513

514514
func TestIsType(t *testing.T) {
515-
if isType(sigFuncEx(nil, &TyOverloadFunc{})) {
515+
if isType(sigFuncEx(nil, nil, &TyOverloadFunc{})) {
516516
t.Fatal("TestIsType: isType(TyOverloadFunc)")
517517
}
518518
}
@@ -876,114 +876,6 @@ func TestIsUnbound(t *testing.T) {
876876
}
877877
}
878878

879-
func TestCheckSignature(t *testing.T) {
880-
denoteRecv(&ast.SelectorExpr{Sel: ident("x")})
881-
if CheckSignature(nil, 0, 0) != nil {
882-
t.Fatal("TestCheckSignature failed: CheckSignature(nil) != nil")
883-
}
884-
sig := types.NewSignatureType(nil, nil, nil, nil, nil, false)
885-
if CheckSignature(sig, 0, 0) != sig {
886-
t.Fatal("TestCheckSignature failed: CheckSignature(sig) != sig")
887-
}
888-
pkg := types.NewPackage("", "foo")
889-
arg := types.NewParam(token.NoPos, pkg, "", sig)
890-
sig2 := types.NewSignatureType(nil, nil, nil, types.NewTuple(arg, arg), nil, false)
891-
o := types.NewFunc(token.NoPos, pkg, "bar", sig2)
892-
if CheckSignature(sigFuncEx(pkg, &TyTemplateRecvMethod{Func: o}), 0, 0) == nil {
893-
t.Fatal("TestCheckSignature failed: TemplateRecvMethod CheckSignature == nil")
894-
}
895-
896-
of := NewOverloadFunc(token.NoPos, pkg, "bar", o)
897-
if CheckSignature(of.Type(), 0, 0) == nil {
898-
t.Fatal("TestCheckSignature failed: OverloadFunc CheckSignature == nil")
899-
}
900-
if HasAutoProperty(of.Type()) {
901-
t.Fatal("func bar has autoprop?")
902-
}
903-
904-
if CheckSignature(sigFuncEx(pkg, &TyTemplateRecvMethod{Func: of}), 0, 0) == nil {
905-
t.Fatal("TestCheckSignature failed: TemplateRecvMethod OverloadFunc CheckSignature == nil")
906-
}
907-
908-
o2 := types.NewFunc(token.NoPos, pkg, "bar2", sig)
909-
of2 := NewOverloadFunc(token.NoPos, pkg, "bar3", o2)
910-
if !HasAutoProperty(of2.Type()) {
911-
t.Fatal("func bar3 has autoprop?")
912-
}
913-
914-
typ := types.NewNamed(types.NewTypeName(token.NoPos, pkg, "t", nil), types.Typ[types.Int], nil)
915-
om := NewOverloadMethod(typ, token.NoPos, pkg, "bar", o)
916-
if CheckSignature(om.Type(), 0, 1) != nil {
917-
t.Fatal("TestCheckSignature failed: OverloadMethod CheckSignature != nil")
918-
}
919-
}
920-
921-
func TestCheckSignatures(t *testing.T) {
922-
denoteRecv(&ast.SelectorExpr{Sel: ident("x")})
923-
if CheckSignatures(nil, 0, 0) != nil {
924-
t.Fatal("TestCheckSignatures failed: CheckSignatures(nil) != nil")
925-
}
926-
sig := types.NewSignatureType(nil, nil, nil, nil, nil, false)
927-
if v := CheckSignatures(sig, 0, 0); len(v) != 1 || v[0] != sig {
928-
t.Fatal("TestCheckSignatures failed: CheckSignatures(sig)[0] != sig")
929-
}
930-
pkg := types.NewPackage("", "foo")
931-
arg := types.NewParam(token.NoPos, pkg, "", sig)
932-
sig2 := types.NewSignatureType(nil, nil, nil, types.NewTuple(arg, arg), nil, false)
933-
o := types.NewFunc(token.NoPos, pkg, "bar", sig2)
934-
if CheckSignatures(sigFuncEx(pkg, &TyTemplateRecvMethod{Func: o}), 0, 0) == nil {
935-
t.Fatal("TestCheckSignatures failed: TemplateRecvMethod CheckSignatures == nil")
936-
}
937-
sig3 := types.NewSignatureType(nil, nil, nil, types.NewTuple(arg, arg, arg), nil, false)
938-
o2 := types.NewFunc(token.NoPos, pkg, "bar", sig3)
939-
of := NewOverloadFunc(token.NoPos, pkg, "bar", o, o2)
940-
if v := CheckSignatures(of.Type(), 0, 0); len(v) != 2 {
941-
t.Fatal("TestCheckSignatures failed: OverloadFunc CheckSignatures ==", len(v))
942-
}
943-
944-
if HasAutoProperty(of.Type()) {
945-
t.Fatal("func bar has autoprop?")
946-
}
947-
948-
if CheckSignatures(sigFuncEx(pkg, &TyTemplateRecvMethod{Func: of}), 0, 0) == nil {
949-
t.Fatal("TestCheckSignatures failed: TemplateRecvMethod OverloadFunc CheckSignatures == nil")
950-
}
951-
952-
o3 := types.NewFunc(token.NoPos, pkg, "bar2", sig)
953-
of2 := NewOverloadFunc(token.NoPos, pkg, "bar3", o3)
954-
if !HasAutoProperty(of2.Type()) {
955-
t.Fatal("func bar3 has autoprop?")
956-
}
957-
958-
typ := types.NewNamed(types.NewTypeName(token.NoPos, pkg, "t", nil), types.Typ[types.Int], nil)
959-
om := NewOverloadMethod(typ, token.NoPos, pkg, "bar", o, o2)
960-
if CheckSignatures(om.Type(), 0, 1) != nil {
961-
t.Fatal("TestCheckSignatures failed: OverloadMethod CheckSignatures != nil")
962-
}
963-
}
964-
965-
func TestCheckSigParam(t *testing.T) {
966-
if checkSigParam(types.NewPointer(types.Typ[types.Int]), -1) {
967-
t.Fatal("TestCheckSigParam failed: checkSigParam *int should return false")
968-
}
969-
pkg := types.NewPackage("", "foo")
970-
typ := types.NewNamed(types.NewTypeName(token.NoPos, pkg, "t", nil), types.Typ[types.Int], nil)
971-
if !checkSigParam(typ, -1) {
972-
t.Fatal("TestCheckSigParam failed: checkSigParam *t should return true")
973-
}
974-
typ2 := types.NewStruct(nil, nil)
975-
if !checkSigParam(typ2, -1) {
976-
t.Fatal("TestCheckSigParam failed: checkSigParam *t should return true")
977-
}
978-
typ3 := types.NewSlice(types.Typ[types.Int])
979-
if !checkSigParam(typ3, -2) {
980-
t.Fatal("TestCheckSigParam failed: checkSigParam []int should return true")
981-
}
982-
if checkSigParam(types.Typ[types.Int], -2) {
983-
t.Fatal("TestCheckSigParam failed: checkSigParam int should return false")
984-
}
985-
}
986-
987879
func TestErrWriteFile(t *testing.T) {
988880
pkg := NewPackage("", "foo", gblConf)
989881
pkg.Types = nil

0 commit comments

Comments
 (0)