Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for TypeFor (0.13 sec)

  1. src/reflect/type_test.go

    	)
    
    	testcases := []struct {
    		wantFrom any
    		got      reflect.Type
    	}{
    		{new(int), reflect.TypeFor[int]()},
    		{new(int64), reflect.TypeFor[int64]()},
    		{new(string), reflect.TypeFor[string]()},
    		{new(mystring), reflect.TypeFor[mystring]()},
    		{new(any), reflect.TypeFor[any]()},
    		{new(myiface), reflect.TypeFor[myiface]()},
    	}
    	for _, tc := range testcases {
    		want := reflect.ValueOf(tc.wantFrom).Elem().Type()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 23:39:44 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  2. src/cmd/vet/testdata/stdversion/stdversion.go

    package stdversion
    
    import "reflect"
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 01:02:40 UTC 2024
    - 142 bytes
    - Viewed (0)
  3. src/encoding/gob/type.go

    var (
    	gobEncoderInterfaceType        = reflect.TypeFor[GobEncoder]()
    	gobDecoderInterfaceType        = reflect.TypeFor[GobDecoder]()
    	binaryMarshalerInterfaceType   = reflect.TypeFor[encoding.BinaryMarshaler]()
    	binaryUnmarshalerInterfaceType = reflect.TypeFor[encoding.BinaryUnmarshaler]()
    	textMarshalerInterfaceType     = reflect.TypeFor[encoding.TextMarshaler]()
    	textUnmarshalerInterfaceType   = reflect.TypeFor[encoding.TextUnmarshaler]()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 02:00:26 UTC 2024
    - 27.2K bytes
    - Viewed (0)
  4. src/unique/clone_test.go

    	testCloneSeq[testStruct](t, cSeq(8))
    }
    
    func cSeq(stringOffsets ...uintptr) cloneSeq {
    	return cloneSeq{stringOffsets: stringOffsets}
    }
    
    func testCloneSeq[T any](t *testing.T, want cloneSeq) {
    	typName := reflect.TypeFor[T]().Name()
    	typ := abi.TypeOf(*new(T))
    	t.Run(typName, func(t *testing.T) {
    		got := makeCloneSeq(typ)
    		if !reflect.DeepEqual(got, want) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 22 18:14:07 UTC 2024
    - 1K bytes
    - Viewed (0)
  5. src/encoding/json/decode_test.go

    	{CaseName: Name(""), in: `{"X": [1,2,3], "Y": 4}`, ptr: new(T), out: T{Y: 4}, err: &UnmarshalTypeError{"array", reflect.TypeFor[string](), 7, "T", "X"}},
    	{CaseName: Name(""), in: `{"X": 23}`, ptr: new(T), out: T{}, err: &UnmarshalTypeError{"number", reflect.TypeFor[string](), 8, "T", "X"}},
    	{CaseName: Name(""), in: `{"x": 1}`, ptr: new(tx), out: tx{}},
    	{CaseName: Name(""), in: `{"x": 1}`, ptr: new(tx), out: tx{}},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 16:40:14 UTC 2024
    - 67.6K bytes
    - Viewed (0)
  6. pkg/typemap/map.go

    }
    
    func Set[T any](t TypeMap, v T) {
    	interfaceType := reflect.TypeOf((*T)(nil)).Elem()
    	t.inner[interfaceType] = v
    }
    
    func Get[T any](t TypeMap) *T {
    	v, f := t.inner[reflect.TypeFor[T]()]
    	if f {
    		return ptr.Of(v.(T))
    	}
    	return nil
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Apr 17 16:38:40 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  7. src/unique/handle_test.go

    		s: [2]testStringStruct{testStringStruct{"y"}, testStringStruct{"z"}},
    	})
    	testHandle[testStruct](t, testStruct{0.5, "184"})
    }
    
    func testHandle[T comparable](t *testing.T, value T) {
    	name := reflect.TypeFor[T]().Name()
    	t.Run(fmt.Sprintf("%s/%#v", name, value), func(t *testing.T) {
    		t.Parallel()
    
    		v0 := Make(value)
    		v1 := Make(value)
    
    		if v0.Value() != v1.Value() {
    			t.Error("v0.Value != v1.Value")
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 22 18:14:07 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  8. doc/next/3-tools.md

    by any [`//go:build` constraints](https://pkg.go.dev/cmd/go#hdr-Build_constraints)
    in the file.)
    
    For example, it will report a diagnostic for a reference to the
    `reflect.TypeFor` function (introduced in go1.22) from a file in a
    module whose go.mod file specifies `go 1.21`.
    
    ### Cgo {#cgo}
    
    <!-- go.dev/issue/66456 -->
    [cmd/cgo] supports the new `-ldflags` flag for passing flags to the C linker.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 28 19:06:07 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  9. doc/next/9-todo.md

    CL 514775 - implements a performance optimization for accepted proposal https://go.dev/issue/59488
    CL 484995 - x/sys CL implements accepted proposal https://go.dev/issue/59537 to add x/sys/unix API
    CL 555597 - optimizes TypeFor (added in accepted proposal https://go.dev/issue/60088) for non-interface types; doesn't seem to need a release note
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 11 17:18:52 UTC 2024
    - 6K bytes
    - Viewed (0)
  10. src/text/template/exec.go

    		}
    	}
    	s.errorf("can't evaluate field %s in type %s", fieldName, typ)
    	panic("not reached")
    }
    
    var (
    	errorType        = reflect.TypeFor[error]()
    	fmtStringerType  = reflect.TypeFor[fmt.Stringer]()
    	reflectValueType = reflect.TypeFor[reflect.Value]()
    )
    
    // evalCall executes a function or method call. If it's a method, fun already has the receiver bound, so
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 21:22:24 UTC 2024
    - 32K bytes
    - Viewed (0)
Back to top