- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 28 for LookupFieldOrMethod (0.41 sec)
-
src/go/types/methodset_test.go
} // look up T.m and (*T).m T := pkg.Scope().Lookup("T").Type() name := "m" for _, recv := range []Type{T, NewPointer(T)} { // LookupFieldOrMethod and NewMethodSet must match: // either both find m or neither finds it. obj1, _, _ := LookupFieldOrMethod(recv, false, pkg, name) mset := NewMethodSet(recv) if (obj1 != nil) != (mset.Len() == 1) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jun 08 15:27:57 UTC 2023 - 6.7K bytes - Viewed (0) -
src/internal/types/testdata/check/decls2/decls2a.go
} func (T1b) int /* ERROR "field and method" */ () {} type T1c struct { time.Time } func (T1c) Time /* ERROR "field and method with the same name Time" */ () int { return 0 } // Disabled for now: LookupFieldOrMethod will find Pointer even though // it's double-declared (it would cost extra in the common case to verify // this). But the MethodSet computation will not find it due to the name
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 3.3K bytes - Viewed (0) -
src/go/types/call.go
/// may be other situations. disabled := true if !disabled && debug { // Verify that LookupFieldOrMethod and MethodSet.Lookup agree. // TODO(gri) This only works because we call LookupFieldOrMethod // _before_ calling NewMethodSet: LookupFieldOrMethod completes // any incomplete interfaces so they are available to NewMethodSet
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 33.5K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/types.go
// would just panic anyway. return false } if types.ConvertibleTo(typ, errorType) { return true // via .Error() } // Does it implement fmt.Stringer? if obj, _, _ := types.LookupFieldOrMethod(typ, false, nil, "String"); obj != nil { if fn, ok := obj.(*types.Func); ok { sig := fn.Type().(*types.Signature) if sig.Params().Len() == 0 && sig.Results().Len() == 1 &&
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 02:20:05 UTC 2024 - 8.6K bytes - Viewed (0) -
src/go/internal/gcimporter/gcimporter_test.go
typ, ok := obj.Type().(*types.Named) if !ok { t.Fatalf("go/types.Object type is %v; wanted named type", typ) } // lookup go/types.Object.Pkg method m, index, indirect := types.LookupFieldOrMethod(typ, false, nil, "Pkg") if m == nil { t.Fatalf("go/types.Object.Pkg not found (index = %v, indirect = %v)", index, indirect) } // the method must belong to go/types if m.Pkg().Path() != "go/types" {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 17 16:22:59 UTC 2024 - 21.9K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
if isFormatter(typ) { return "", false } // Does e allow e.String() or e.Error()? strObj, _, _ := types.LookupFieldOrMethod(typ, false, pass.Pkg, "String") strMethod, strOk := strObj.(*types.Func) errObj, _, _ := types.LookupFieldOrMethod(typ, false, pass.Pkg, "Error") errMethod, errOk := errObj.(*types.Func) if !strOk && !errOk { return "", false }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 02:20:05 UTC 2024 - 32.5K bytes - Viewed (0) -
src/go/types/issues_test.go
} // verify that lookup finds the same method in both interfaces (redundant check) obj, _, _ := LookupFieldOrMethod(et, false, nil, "Error") if obj != want { t.Fatalf("%s.Lookup: got %q (%p); want %q (%p)", et, obj, obj, want, want) } obj, _, _ = LookupFieldOrMethod(it, false, nil, "Error") if obj != want { t.Fatalf("%s.Lookup: got %q (%p); want %q (%p)", it, obj, obj, want, want) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 28.1K bytes - Viewed (0) -
src/cmd/compile/internal/types2/issues_test.go
} // verify that lookup finds the same method in both interfaces (redundant check) obj, _, _ := LookupFieldOrMethod(et, false, nil, "Error") if obj != want { t.Fatalf("%s.Lookup: got %q (%p); want %q (%p)", et, obj, obj, want, want) } obj, _, _ = LookupFieldOrMethod(it, false, nil, "Error") if obj != want { t.Fatalf("%s.Lookup: got %q (%p); want %q (%p)", it, obj, obj, want, want) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 28.1K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/tests/tests.go
// Check ExampleFoo_Method and ExampleFoo_BadMethod. found := false // Check if Foo.Method exists in this package or its imports. for _, obj := range objs { if obj, _, _ := types.LookupFieldOrMethod(obj.Type(), true, obj.Pkg(), mmbr); obj != nil { found = true break } } if !found { pass.Reportf(fn.Pos(), "%s refers to unknown field or method: %s.%s", fnName, ident, mmbr) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 03 02:38:00 UTC 2024 - 14.4K bytes - Viewed (0) -
src/cmd/compile/internal/types2/api_test.go
} func TestLookupFieldOrMethodOnNil(t *testing.T) { // LookupFieldOrMethod on a nil type is expected to produce a run-time panic. defer func() { const want = "LookupFieldOrMethod on nil type" p := recover() if s, ok := p.(string); !ok || s != want { t.Fatalf("got %v, want %s", p, want) } }() LookupFieldOrMethod(nil, false, nil, "") } func TestLookupFieldOrMethod(t *testing.T) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 07 20:08:23 UTC 2024 - 93.3K bytes - Viewed (0)