Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 1,740 for REFLECT (0.11 sec)

  1. test/fixedbugs/issue28748.go

    			panic("wanted a reflect error, got this instead:\n" + text)
    		}
    	}()
    	r := reflect.MakeFunc(reflect.TypeOf(func() error { return nil }),
    		func(args []reflect.Value) []reflect.Value {
    			var x [1]reflect.Value
    			return x[:]
    		}).Interface().(func() error)
    	r()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 06 21:23:29 UTC 2019
    - 712 bytes
    - Viewed (0)
  2. src/reflect/nih_test.go

    		t.Fatalf("got %d, want 7", got)
    	}
    
    	v = ValueOf((*nih)(unsafe.Pointer(new(int))))
    	shouldPanic("reflect: reflect.Value.Elem on an invalid notinheap pointer", func() { v.Elem() })
    	shouldPanic("reflect: reflect.Value.Pointer on an invalid notinheap pointer", func() { v.Pointer() })
    	shouldPanic("reflect: reflect.Value.UnsafePointer on an invalid notinheap pointer", func() { v.UnsafePointer() })
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 31 01:16:54 UTC 2022
    - 1004 bytes
    - Viewed (0)
  3. pkg/controlplane/import_known_versions_test.go

    var typesAllowedTags = map[reflect.Type]bool{
    	reflect.TypeOf(intstr.IntOrString{}):          true,
    	reflect.TypeOf(metav1.Time{}):                 true,
    	reflect.TypeOf(metav1.MicroTime{}):            true,
    	reflect.TypeOf(metav1.Duration{}):             true,
    	reflect.TypeOf(metav1.TypeMeta{}):             true,
    	reflect.TypeOf(metav1.ListMeta{}):             true,
    	reflect.TypeOf(metav1.ObjectMeta{}):           true,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jan 22 18:47:31 UTC 2021
    - 3.1K bytes
    - Viewed (0)
  4. src/reflect/example_test.go

    package reflect_test
    
    import (
    	"bytes"
    	"encoding/json"
    	"fmt"
    	"io"
    	"os"
    	"reflect"
    )
    
    func ExampleKind() {
    	for _, v := range []any{"hi", 42, func() {}} {
    		switch v := reflect.ValueOf(v); v.Kind() {
    		case reflect.String:
    			fmt.Println(v.String())
    		case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
    			fmt.Println(v.Int())
    		default:
    			fmt.Printf("unhandled kind %s", v.Kind())
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 19 20:04:36 UTC 2022
    - 4.5K bytes
    - Viewed (0)
  5. src/internal/fmtsort/sort.go

    func compare(aVal, bVal reflect.Value) int {
    	aType, bType := aVal.Type(), bVal.Type()
    	if aType != bType {
    		return -1 // No good answer possible, but don't return 0: they're not equal.
    	}
    	switch aVal.Kind() {
    	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
    		return cmp.Compare(aVal.Int(), bVal.Int())
    	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 19:31:45 UTC 2024
    - 4.9K bytes
    - Viewed (0)
  6. src/cmd/link/internal/ld/testdata/deadcode/structof_funcof.go

    			Type: reflect.TypeOf(int(0)),
    		},
    	})
    	println(t.Name())
    }
    
    func useFuncOf() {
    	t := reflect.FuncOf(
    		[]reflect.Type{reflect.TypeOf(int(0))},
    		[]reflect.Type{reflect.TypeOf(int(0))},
    		false,
    	)
    	println(t.Name())
    }
    
    func main() {
    	useStructOf()
    	useFuncOf()
    
    	var t T
    	meth, _ := reflect.TypeOf(t).MethodByName("F")
    	ft := meth.Type
    	at := ft.In(1)
    	v := reflect.New(at).Elem()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 01 15:07:26 UTC 2023
    - 994 bytes
    - Viewed (0)
  7. test/fixedbugs/issue52788.go

    package main
    
    import (
    	"fmt"
    	"reflect"
    )
    
    func f(next func() bool) {
    	for b := next(); b; b = next() {
    		fmt.Printf("next() returned %v\n", b)
    	}
    }
    
    func main() {
    	next := reflect.MakeFunc(reflect.TypeOf((func() bool)(nil)), func(_ []reflect.Value) []reflect.Value {
    		return []reflect.Value{reflect.ValueOf(false)}
    	})
    	reflect.ValueOf(f).Call([]reflect.Value{next})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 09 16:02:28 UTC 2022
    - 605 bytes
    - Viewed (0)
  8. staging/src/k8s.io/apimachinery/pkg/api/apitesting/naming/naming.go

    	switch tp.Kind() {
    	case reflect.Map, reflect.Slice, reflect.Pointer:
    		errs = append(errs, ensureTags(gvk, tp.Elem(), parents, allowedNonstandardJSONNames)...)
    
    	case reflect.String, reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Interface:
    		// no-op
    
    	case reflect.Struct:
    		for i := 0; i < tp.NumField(); i++ {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jul 27 07:07:03 UTC 2022
    - 5.8K bytes
    - Viewed (0)
  9. src/runtime/race/testdata/reflect_test.go

    package race_test
    
    import (
    	"reflect"
    	"testing"
    )
    
    func TestRaceReflectRW(t *testing.T) {
    	ch := make(chan bool, 1)
    	i := 0
    	v := reflect.ValueOf(&i)
    	go func() {
    		v.Elem().Set(reflect.ValueOf(1))
    		ch <- true
    	}()
    	_ = v.Elem().Int()
    	<-ch
    }
    
    func TestRaceReflectWW(t *testing.T) {
    	ch := make(chan bool, 1)
    	i := 0
    	v := reflect.ValueOf(&i)
    	go func() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 23 13:12:15 UTC 2016
    - 811 bytes
    - Viewed (0)
  10. test/fixedbugs/issue25897a.go

    		// wrapper closure for the "go" statement.
    		f := reflect.MakeFunc(reflect.TypeOf(((func(*int))(nil))),
    			func(args []reflect.Value) []reflect.Value {
    				c <- true
    				return nil
    			}).Interface().(func(*int))
    		go f(nil)
    
    		g := reflect.MakeFunc(reflect.TypeOf(((func())(nil))),
    			func(args []reflect.Value) []reflect.Value {
    				c <- true
    				return nil
    			}).Interface().(func())
    		go g()
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 02 19:04:48 UTC 2022
    - 1.1K bytes
    - Viewed (0)
Back to top