Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 22 for LookupFieldOrMethod (0.19 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. src/cmd/compile/internal/types2/call.go

    	// x.typ is incomplete.
    	if wantType {
    		check.errorf(e.Sel, NotAType, "%s is not a type", syntax.Expr(e))
    		goto Error
    	}
    
    	obj, index, indirect = lookupFieldOrMethod(x.typ, x.mode == variable, check.pkg, sel, false)
    	if obj == nil {
    		// Don't report another error if the underlying type was invalid (go.dev/issue/49541).
    		if !isValid(under(x.typ)) {
    			goto Error
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 31.5K bytes
    - Viewed (0)
  7. src/go/types/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: Thu May 23 01:00:11 UTC 2024
    - 94.2K bytes
    - Viewed (0)
  8. src/go/types/builtins.go

    			check.use(arg0)
    			return
    		}
    
    		check.expr(nil, x, selx.X)
    		if x.mode == invalid {
    			return
    		}
    
    		base := derefStructPtr(x.typ)
    		sel := selx.Sel.Name
    		obj, index, indirect := lookupFieldOrMethod(base, false, check.pkg, sel, false)
    		switch obj.(type) {
    		case nil:
    			check.errorf(x, MissingFieldOrMethod, invalidArg+"%s has no single field %s", base, sel)
    			return
    		case *Func:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 27.2K bytes
    - Viewed (0)
  9. src/go/types/unify.go

    		if xi != nil {
    			// All xi methods must exist in y and corresponding signatures must unify.
    			xmethods := xi.typeSet().methods
    			for _, xm := range xmethods {
    				obj, _, _ := LookupFieldOrMethod(y, false, xm.pkg, xm.name)
    				if ym, _ := obj.(*Func); ym == nil || !u.nify(xm.typ, ym.typ, exact, p) {
    					return false
    				}
    			}
    			return true
    		}
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 16:24:39 UTC 2024
    - 27.9K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/types2/builtins.go

    			check.use(arg0)
    			return
    		}
    
    		check.expr(nil, x, selx.X)
    		if x.mode == invalid {
    			return
    		}
    
    		base := derefStructPtr(x.typ)
    		sel := selx.Sel.Value
    		obj, index, indirect := lookupFieldOrMethod(base, false, check.pkg, sel, false)
    		switch obj.(type) {
    		case nil:
    			check.errorf(x, MissingFieldOrMethod, invalidArg+"%s has no single field %s", base, sel)
    			return
    		case *Func:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 27.1K bytes
    - Viewed (0)
Back to top