Search Options

Results per page
Sort
Preferred Languages
Advance

Results 81 - 90 of 1,740 for REFLECT (0.13 sec)

  1. test/reflectmethod5.go

    // license that can be found in the LICENSE file.
    
    // Issue 38515: failed to mark the method wrapper
    // reflect.Type.Method itself as REFLECTMETHOD.
    
    package main
    
    import "reflect"
    
    var called bool
    
    type foo struct{}
    
    func (foo) X() { called = true }
    
    var h = reflect.Type.Method
    
    func main() {
    	v := reflect.ValueOf(foo{})
    	m := h(v.Type(), 0)
    	f := m.Func.Interface().(func(foo))
    	f(foo{})
    	if !called {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Apr 19 03:12:32 UTC 2020
    - 544 bytes
    - Viewed (0)
  2. src/cmd/fix/cftype.go

    	// we use reflect to find all such references.
    	if len(badNils) > 0 {
    		exprType := reflect.TypeFor[ast.Expr]()
    		exprSliceType := reflect.TypeFor[[]ast.Expr]()
    		walk(f, func(n any) {
    			if n == nil {
    				return
    			}
    			v := reflect.ValueOf(n)
    			if v.Type().Kind() != reflect.Pointer {
    				return
    			}
    			if v.IsNil() {
    				return
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 07 00:25:49 UTC 2023
    - 3.5K bytes
    - Viewed (0)
  3. test/reflectmethod7.go

    // license that can be found in the LICENSE file.
    
    // See issue 44207.
    
    package main
    
    import "reflect"
    
    type S int
    
    func (s S) M() {}
    
    func main() {
    	t := reflect.TypeOf(S(0))
    	fn, ok := reflect.PointerTo(t).MethodByName("M")
    	if !ok {
    		panic("FAIL")
    	}
    	fn.Func.Call([]reflect.Value{reflect.New(t)})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 26 14:24:17 UTC 2021
    - 421 bytes
    - Viewed (0)
  4. test/fixedbugs/issue15439.go

    // license that can be found in the LICENSE file.
    
    package main
    
    import "reflect"
    
    func main() {
    	a := &struct{ x int }{}
    	b := &struct{ x int "" }{}
    
    	ta := reflect.TypeOf(a)
    	tb := reflect.TypeOf(b)
    
    	// Ensure cmd/compile treats absent and empty tags as equivalent.
    	a = b
    
    	// Ensure package reflect treats absent and empty tags as equivalent.
    	if !tb.AssignableTo(ta) {
    		panic("fail")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 25 21:28:45 UTC 2016
    - 514 bytes
    - Viewed (0)
  5. pkg/proxy/apis/config/register_test.go

    		GroupName:          GroupName,
    		SchemeGroupVersion: SchemeGroupVersion,
    		AddToScheme:        AddToScheme,
    		AllowedTags: map[reflect.Type]bool{
    			reflect.TypeOf(metav1.TypeMeta{}):              true,
    			reflect.TypeOf(metav1.Duration{}):              true,
    			reflect.TypeOf(logsapi.LoggingConfiguration{}): true,
    		},
    	}
    
    	if err := componentconfigtesting.VerifyInternalTypePackage(pkginfo); err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jul 13 06:33:33 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  6. src/runtime/time_test.go

    	// runtime.timeTimer (exported for testing as TimeTimer)
    	// must have time.Timer and time.Ticker as a prefix
    	// (meaning those two must have the same layout).
    	runtimeTimeTimer := reflect.TypeOf(runtime.TimeTimer{})
    
    	check := func(name string, typ reflect.Type) {
    		n1 := runtimeTimeTimer.NumField()
    		n2 := typ.NumField()
    		if n1 != n2+1 {
    			t.Errorf("runtime.TimeTimer has %d fields, want %d (%s has %d fields)", n1, n2+1, name, n2)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Mar 09 03:40:04 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  7. test/fixedbugs/issue19743.go

    package foo
    
    // Escape analysis needs to treat the uintptr-typed reflect.*Header fields as pointers.
    
    import (
    	"reflect"
    	"unsafe"
    )
    
    type immutableBytes []byte
    
    // Bug was failure to leak param b.
    func toString(b immutableBytes) string { // ERROR "leaking param: b$"
    	var s string
    	if len(b) == 0 {
    		return s
    	}
    
    	strHeader := (*reflect.StringHeader)(unsafe.Pointer(&s))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 16:34:03 UTC 2019
    - 669 bytes
    - Viewed (0)
  8. test/fixedbugs/issue35073b.go

    // Test that we can inline the receiver arguments for
    // reflect.Value.UnsafeAddr/Pointer, even in checkptr mode.
    
    package main
    
    import (
    	"reflect"
    	"unsafe"
    )
    
    func main() {
    	n := 10                      // ERROR "moved to heap: n"
    	m := make(map[string]string) // ERROR "moved to heap: m" "make\(map\[string\]string\) escapes to heap"
    
    	_ = unsafe.Pointer(reflect.ValueOf(&n).Elem().UnsafeAddr()) // ERROR "inlining call"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 20 15:12:49 UTC 2023
    - 706 bytes
    - Viewed (0)
  9. test/ken/cplx3.go

    		println(i, "!= -0.1384615")
    		panic(0)
    	}
    
    	c := *(*complex128)(unsafe.Pointer(&c0))
    	if c != c0 {
    		println(c, "!=", c)
    		panic(0)
    	}
    
    	var a interface{}
    	switch c := reflect.ValueOf(a); c.Kind() {
    	case reflect.Complex64, reflect.Complex128:
    		v := c.Complex()
    		_, _ = complex128(v), true
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 24 05:24:24 UTC 2012
    - 888 bytes
    - Viewed (0)
  10. src/encoding/asn1/common.go

    		return false, TagInteger, false, true
    	}
    	switch t.Kind() {
    	case reflect.Bool:
    		return false, TagBoolean, false, true
    	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
    		return false, TagInteger, false, true
    	case reflect.Struct:
    		return false, TagSequence, true, true
    	case reflect.Slice:
    		if t.Elem().Kind() == reflect.Uint8 {
    			return false, TagOctetString, false, true
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 06 15:53:04 UTC 2021
    - 5.5K bytes
    - Viewed (0)
Back to top