Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for LookupFieldOrMethod (0.19 sec)

  1. src/cmd/compile/internal/types2/object_test.go

    	// get original error.Error method
    	eface := Universe.Lookup("error")
    	orig, _, _ := LookupFieldOrMethod(eface.Type(), false, nil, "Error")
    	if orig == nil {
    		t.Fatalf("original error.Error not found")
    	}
    
    	// get embedded error.Error method
    	iface := pkg.Scope().Lookup("I")
    	embed, _, _ := LookupFieldOrMethod(iface.Type(), false, nil, "Error")
    	if embed == nil {
    		t.Fatalf("embedded error.Error not found")
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  2. src/go/types/object_test.go

    	// get original error.Error method
    	eface := Universe.Lookup("error")
    	orig, _, _ := LookupFieldOrMethod(eface.Type(), false, nil, "Error")
    	if orig == nil {
    		t.Fatalf("original error.Error not found")
    	}
    
    	// get embedded error.Error method
    	iface := pkg.Scope().Lookup("I")
    	embed, _, _ := LookupFieldOrMethod(iface.Type(), false, nil, "Error")
    	if embed == nil {
    		t.Fatalf("embedded error.Error not found")
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top