Search Options

Results per page
Sort
Preferred Languages
Advance

Results 121 - 130 of 3,055 for REFLECT (0.14 sec)

  1. test/fixedbugs/issue22605.go

    // license that can be found in the LICENSE file.
    
    // We were picking up a special noalg type from typelinks.
    
    package main
    
    import "reflect"
    
    func f(m map[string]int) int {
    	return m["a"]
    }
    
    func g(m map[[8]string]int) int {
    	t := reflect.ArrayOf(8, reflect.TypeOf(""))
    	a := reflect.New(t).Elem()
    	return m[a.Interface().([8]string)]
    }
    
    func main() {
    	m := map[[8]string]int{}
    	g(m)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 07 22:29:48 UTC 2017
    - 504 bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. 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)
  5. pkg/typemap/map.go

    package typemap
    
    import (
    	"reflect"
    
    	"istio.io/istio/pkg/ptr"
    )
    
    // TypeMap provides a map that holds a map of Type -> Value. There can be only a single value per type.
    // The value stored for a type must be of the same type as the key.
    type TypeMap struct {
    	inner map[reflect.Type]any
    }
    
    func NewTypeMap() TypeMap {
    	return TypeMap{make(map[reflect.Type]any)}
    }
    
    func Set[T any](t TypeMap, v T) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Apr 17 16:38:40 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  6. 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)
  7. staging/src/k8s.io/apimachinery/third_party/forked/golang/json/fields_test.go

    package json
    
    import (
    	"reflect"
    	"testing"
    )
    
    func TestLookupPtrToStruct(t *testing.T) {
    	type Elem struct {
    		Key   string
    		Value string
    	}
    	type Outer struct {
    		Inner []Elem `json:"inner" patchStrategy:"merge" patchMergeKey:"key"`
    	}
    	outer := &Outer{}
    	elemType, patchStrategies, patchMergeKey, err := LookupPatchMetadataForStruct(reflect.TypeOf(outer), "inner")
    	if err != nil {
    		t.Fatal(err)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Nov 20 22:35:14 UTC 2017
    - 769 bytes
    - Viewed (0)
  8. 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)
  9. test/typeparam/issue48253.go

    // license that can be found in the LICENSE file.
    
    package main
    
    import (
    	"reflect"
    )
    
    type A[T any] struct {
    	B[int]
    }
    
    type B[T any] struct {
    }
    
    func (b B[T]) Bat() {
    	t := new(T)
    	if tt := reflect.TypeOf(t); tt.Kind() != reflect.Pointer || tt.Elem().Kind() != reflect.Int {
    		panic("unexpected type, want: *int, got: "+tt.String())
    	}
    }
    
    type Foo struct {
    	A[string]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 551 bytes
    - Viewed (0)
  10. staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go

    		gvkToType:                 map[schema.GroupVersionKind]reflect.Type{},
    		typeToGVK:                 map[reflect.Type][]schema.GroupVersionKind{},
    		unversionedTypes:          map[reflect.Type]schema.GroupVersionKind{},
    		unversionedKinds:          map[string]reflect.Type{},
    		fieldLabelConversionFuncs: map[schema.GroupVersionKind]FieldLabelConversionFunc{},
    		defaulterFuncs:            map[reflect.Type]func(interface{}){},
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Dec 18 04:27:38 UTC 2022
    - 25.2K bytes
    - Viewed (0)
Back to top