Search Options

Results per page
Sort
Preferred Languages
Advance

Results 111 - 120 of 3,055 for REFLECT (0.11 sec)

  1. utils/utils.go

    		}
    	}
    	return false
    }
    
    func AssertEqual(x, y interface{}) bool {
    	if reflect.DeepEqual(x, y) {
    		return true
    	}
    	if x == nil || y == nil {
    		return false
    	}
    
    	xval := reflect.ValueOf(x)
    	yval := reflect.ValueOf(y)
    	if xval.Kind() == reflect.Ptr && xval.IsNil() ||
    		yval.Kind() == reflect.Ptr && yval.IsNil() {
    		return false
    	}
    
    	if valuer, ok := x.(driver.Valuer); ok {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Apr 22 06:43:02 UTC 2024
    - 3.8K bytes
    - Viewed (0)
  2. test/fixedbugs/issue48357.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    import "reflect"
    
    type T [129]byte
    
    func main() {
    	m := map[string]T{}
    	v := reflect.ValueOf(m)
    	v.SetMapIndex(reflect.ValueOf("a"), reflect.ValueOf(T{}))
    	g = m["a"]
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 13 18:38:15 UTC 2021
    - 360 bytes
    - Viewed (0)
  3. src/cmd/go/internal/generate/generate_test.go

    	for _, test := range splitTests {
    		// First with newlines.
    		got := g.split("//go:generate " + test.in + "\n")
    		if !reflect.DeepEqual(got, test.out) {
    			t.Errorf("split(%q): got %q expected %q", test.in, got, test.out)
    		}
    		// Then with CRLFs, thank you Windows.
    		got = g.split("//go:generate " + test.in + "\r\n")
    		if !reflect.DeepEqual(got, test.out) {
    			t.Errorf("split(%q): got %q expected %q", test.in, got, test.out)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 20 14:09:12 UTC 2022
    - 7.4K bytes
    - Viewed (0)
  4. src/internal/unsafeheader/unsafeheader_test.go

    import (
    	"bytes"
    	"internal/unsafeheader"
    	"reflect"
    	"testing"
    	"unsafe"
    )
    
    // TestTypeMatchesReflectType ensures that the name and layout of the
    // unsafeheader types matches the corresponding Header types in the reflect
    // package.
    func TestTypeMatchesReflectType(t *testing.T) {
    	t.Run("Slice", func(t *testing.T) {
    		testHeaderMatchesReflect(t, unsafeheader.Slice{}, reflect.SliceHeader{})
    	})
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 2.9K bytes
    - Viewed (0)
  5. 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)
  6. test/recover.go

    	return nil
    }
    
    func test15() {
    	f := reflect.MakeFunc(reflect.TypeOf((func())(nil)), reflectFunc).Interface().(func())
    	defer f()
    	panic(15)
    }
    
    func reflectFunc2(args []reflect.Value) (results []reflect.Value) {
    	// This will call reflectFunc3
    	args[0].Interface().(func())()
    	return nil
    }
    
    func reflectFunc3(args []reflect.Value) (results []reflect.Value) {
    	if v := recover(); v != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 10.6K bytes
    - Viewed (0)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top