Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 for HasNil (0.39 sec)

  1. src/cmd/compile/internal/ir/const.go

    	return NewBasicLit(pos, types.Types[types.TUINTPTR], constant.MakeInt64(v))
    }
    
    // NewZero returns a zero value of the given type.
    func NewZero(pos src.XPos, typ *types.Type) Node {
    	switch {
    	case typ.HasNil():
    		return NewNilExpr(pos, typ)
    	case typ.IsInteger():
    		return NewBasicLit(pos, typ, intZero)
    	case typ.IsFloat():
    		return NewBasicLit(pos, typ, floatZero)
    	case typ.IsComplex():
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 12 18:53:26 UTC 2023
    - 4K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/types2/predicates.go

    	}
    	return false
    }
    
    // hasNil reports whether type t includes the nil value.
    func hasNil(t Type) bool {
    	switch u := under(t).(type) {
    	case *Basic:
    		return u.kind == UnsafePointer
    	case *Slice, *Pointer, *Signature, *Map, *Chan:
    		return true
    	case *Interface:
    		return !isTypeParam(t) || u.typeSet().underIs(func(u Type) bool {
    			return u != nil && hasNil(u)
    		})
    	}
    	return false
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 17.5K bytes
    - Viewed (0)
  3. src/go/types/predicates.go

    	}
    	return false
    }
    
    // hasNil reports whether type t includes the nil value.
    func hasNil(t Type) bool {
    	switch u := under(t).(type) {
    	case *Basic:
    		return u.kind == UnsafePointer
    	case *Slice, *Pointer, *Signature, *Map, *Chan:
    		return true
    	case *Interface:
    		return !isTypeParam(t) || u.typeSet().underIs(func(u Type) bool {
    			return u != nil && hasNil(u)
    		})
    	}
    	return false
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 17.6K bytes
    - Viewed (0)
  4. src/go/types/expr.go

    		if allString(x.typ) != allString(y.typ) {
    			return false
    		}
    		// Untyped nil can only convert to a type that has a nil.
    		if x.isNil() {
    			return hasNil(y.typ)
    		}
    		if y.isNil() {
    			return hasNil(x.typ)
    		}
    		// An untyped operand cannot convert to a pointer.
    		// TODO(gri) generalize to type parameters
    		if isPointer(x.typ) || isPointer(y.typ) {
    			return false
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 49.7K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/typecheck/const.go

    	if n.Type().Kind() == types.TNIL {
    		if n.Op() != ir.ONIL {
    			base.Fatalf("unexpected op: %v (%v)", n, n.Op())
    		}
    		n = ir.Copy(n)
    		if t == nil {
    			base.Fatalf("use of untyped nil")
    		}
    
    		if !t.HasNil() {
    			// Leave for caller to handle.
    			return n
    		}
    
    		n.SetType(t)
    		return n
    	}
    
    	if t == nil || !ir.OKForConst[t.Kind()] {
    		t = defaultType(n.Type())
    	}
    
    	switch n.Op() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 05 15:20:28 UTC 2023
    - 10.5K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/types2/expr.go

    		if allString(x.typ) != allString(y.typ) {
    			return false
    		}
    		// Untyped nil can only convert to a type that has a nil.
    		if x.isNil() {
    			return hasNil(y.typ)
    		}
    		if y.isNil() {
    			return hasNil(x.typ)
    		}
    		// An untyped operand cannot convert to a pointer.
    		// TODO(gri) generalize to type parameters
    		if isPointer(x.typ) || isPointer(y.typ) {
    			return false
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 51.7K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types/type.go

    func (t *Type) IsPtrShaped() bool {
    	return t.kind == TPTR || t.kind == TUNSAFEPTR ||
    		t.kind == TMAP || t.kind == TCHAN || t.kind == TFUNC
    }
    
    // HasNil reports whether the set of values determined by t includes nil.
    func (t *Type) HasNil() bool {
    	switch t.kind {
    	case TCHAN, TFUNC, TINTER, TMAP, TNIL, TPTR, TSLICE, TUNSAFEPTR:
    		return true
    	}
    	return false
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:29:45 UTC 2024
    - 49.5K bytes
    - Viewed (0)
  8. src/go/types/stmt.go

    			// By checking assignment of x to an invisible temporary
    			// (as a compiler would), we get all the relevant checks.
    			check.assignment(&x, nil, "switch expression")
    			if x.mode != invalid && !Comparable(x.typ) && !hasNil(x.typ) {
    				check.errorf(&x, InvalidExprSwitch, "cannot switch on %s (%s is not comparable)", &x, x.typ)
    				x.mode = invalid
    			}
    		} else {
    			// spec: "A missing switch expression is
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/types2/stmt.go

    		// By checking assignment of x to an invisible temporary
    		// (as a compiler would), we get all the relevant checks.
    		check.assignment(&x, nil, "switch expression")
    		if x.mode != invalid && !Comparable(x.typ) && !hasNil(x.typ) {
    			check.errorf(&x, InvalidExprSwitch, "cannot switch on %s (%s is not comparable)", &x, x.typ)
    			x.mode = invalid
    		}
    	} else {
    		// spec: "A missing switch expression is
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.7K bytes
    - Viewed (0)
  10. docs/tr/docs/alternatives.md

    Ama... Python'un tip belirteçleri gelmeden önce oluşturulmuştu. Yani her <abbr title="Verilerin nasıl oluşturulması gerektiğinin tanımı">şemayı</abbr> tanımlamak için Marshmallow'un sunduğu spesifik araçları ve sınıfları kullanmanız gerekiyordu.
    
    !!! check "**FastAPI**'a nasıl ilham verdi?"
        Kod kullanarak otomatik olarak veri tipini ve veri doğrulamayı belirten "şemalar" tanımlamalı.
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Mar 22 01:42:11 UTC 2024
    - 28.8K bytes
    - Viewed (0)
Back to top