Search Options

Results per page
Sort
Preferred Languages
Advance

Results 171 - 180 of 504 for nelem (0.09 sec)

  1. test/fixedbugs/issue47068.dir/b.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package b
    
    import "reflect"
    
    func B() {
    	t1 := reflect.TypeOf([30]int{})
    	t2 := reflect.TypeOf(new([30]int)).Elem()
    	if t1 != t2 {
    		panic("[30]int types do not match")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 23 19:49:23 UTC 2021
    - 334 bytes
    - Viewed (0)
  2. src/cmd/compile/internal/ssa/_gen/dec.rules

    (SlicePtr (SliceMake ptr _ _ )) => ptr
    (SliceLen (SliceMake _ len _)) => len
    (SliceCap (SliceMake _ _ cap)) => cap
    (SlicePtrUnchecked (SliceMake ptr _ _ )) => ptr
    
    (Load <t> ptr mem) && t.IsSlice() =>
      (SliceMake
        (Load <t.Elem().PtrTo()> ptr mem)
        (Load <typ.Int>
          (OffPtr <typ.IntPtr> [config.PtrSize] ptr)
          mem)
        (Load <typ.Int>
          (OffPtr <typ.IntPtr> [2*config.PtrSize] ptr)
          mem))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 12 00:48:31 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  3. src/cmd/link/internal/ld/testdata/deadcode/ifacemethod3.go

    func (s S) M() { println("S.M") }
    
    type I interface{ M() }
    
    type T float64
    
    func (t T) F(s S) {}
    
    func main() {
    	var t T
    	ft := reflect.TypeOf(t).Method(0).Type
    	at := ft.In(1)
    	v := reflect.New(at).Elem()
    	v.Interface().(I).M()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 15 21:49:19 UTC 2021
    - 615 bytes
    - Viewed (0)
  4. test/fixedbugs/issue22605.go

    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)
  5. src/cmd/compile/internal/types2/predicates.go

    			// assume they are the same to avoid spurious follow-on errors.
    			return (x.len < 0 || y.len < 0 || x.len == y.len) && c.identical(x.elem, y.elem, p)
    		}
    
    	case *Slice:
    		// Two slice types are identical if they have identical element types.
    		if y, ok := y.(*Slice); ok {
    			return c.identical(x.elem, y.elem, p)
    		}
    
    	case *Struct:
    		// Two struct types are identical if they have the same sequence of fields,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 17.5K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/walk/complit.go

    	if n.Op() != ir.OSLICELIT {
    		return false
    	}
    
    	return n.Type().Elem().Size() == 0 || n.Len <= ir.MaxSmallArraySize/n.Type().Elem().Size()
    }
    
    func slicelit(ctxt initContext, n *ir.CompLitExpr, var_ ir.Node, init *ir.Nodes) {
    	// make an array type corresponding the number of elements we have
    	t := types.NewArray(n.Type().Elem(), n.Len)
    	types.CalcSize(t)
    
    	if ctxt == inNonInitFunction {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 19:03:54 UTC 2023
    - 19.5K bytes
    - Viewed (0)
  7. test/typeparam/issue48253.go

    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]
    }
    func main() {
    	Foo{}.A.Bat()
    	Foo{}.A.B.Bat()
    	Foo{}.Bat()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 551 bytes
    - Viewed (0)
  8. test/clear.go

    // license that can be found in the LICENSE file.
    
    package main
    
    import "math"
    
    func checkClearSlice() {
    	s := []int{1, 2, 3}
    	clear(s)
    	for i := range s {
    		if s[i] != 0 {
    			panic("clear not zeroing slice elem")
    		}
    	}
    
    	clear([]int{})
    }
    
    func checkClearMap() {
    	m1 := make(map[int]int)
    	m1[0] = 0
    	m1[1] = 1
    	clear(m1)
    	if len(m1) != 0 {
    		panic("m1 is not cleared")
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 31 19:43:07 UTC 2023
    - 743 bytes
    - Viewed (0)
  9. test/fixedbugs/issue65957.dir/main.go

    package main
    
    import (
    	"./a"
    	"reflect"
    )
    
    var s = []rune{0, 1, 2, 3}
    
    func main() {
    	m := map[any]int{}
    	k := reflect.New(reflect.ArrayOf(4, reflect.TypeOf(int32(0)))).Elem().Interface()
    	m[k] = 1
    	a.F()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 28 05:32:14 UTC 2024
    - 368 bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/cel/value.go

    		return lv, nil
    	}
    
    	// List conversion.
    	otherElem := typeDesc.Elem()
    
    	// Allow the element ConvertToNative() function to determine whether conversion is possible.
    	sz := len(lv.Entries)
    	nativeList := reflect.MakeSlice(typeDesc, int(sz), int(sz))
    	for i := 0; i < sz; i++ {
    		elem := lv.Entries[i]
    		nativeElemVal, err := elem.ConvertToNative(otherElem)
    		if err != nil {
    			return nil, err
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 10 22:05:55 UTC 2022
    - 20.5K bytes
    - Viewed (0)
Back to top