Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 210 for predeclared (0.3 sec)

  1. test/chancap.go

    // run
    
    // Copyright 2009 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Test the cap predeclared function applied to channels.
    
    package main
    
    import (
    	"strings"
    	"unsafe"
    )
    
    type T chan int
    
    const ptrSize = unsafe.Sizeof((*byte)(nil))
    
    func main() {
    	c := make(T, 10)
    	if len(c) != 0 || cap(c) != 10 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 26 14:06:28 UTC 2018
    - 1.6K bytes
    - Viewed (0)
  2. src/go/doc/testdata/generics.go

    // Constraint is a constraint interface with two type parameters.
    type Constraint[P, Q interface{ string | ~int | Type[int] }] interface {
    	~int | ~byte | Type[string]
    	M() P
    }
    
    // int16 shadows the predeclared type int16.
    type int16 int
    
    // NewEmbeddings demonstrates how we filter the new embedded elements.
    type NewEmbeddings interface {
    	string // should not be filtered
    	int16
    	struct{ f int }
    	~struct{ f int }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 10 18:06:32 UTC 2021
    - 2.1K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/basic.go

    // license that can be found in the LICENSE file.
    
    package types2
    
    // BasicKind describes the kind of basic type.
    type BasicKind int
    
    const (
    	Invalid BasicKind = iota // type is invalid
    
    	// predeclared types
    	Bool
    	Int
    	Int8
    	Int16
    	Int32
    	Int64
    	Uint
    	Uint8
    	Uint16
    	Uint32
    	Uint64
    	Uintptr
    	Float32
    	Float64
    	Complex64
    	Complex128
    	String
    	UnsafePointer
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 01 22:17:50 UTC 2021
    - 1.5K bytes
    - Viewed (0)
  4. src/go/doc/testdata/generics.1.golden

    	// MethodB has a blank receiver type parameter. 
    	func (t Type[_]) MethodB()
    
    	// MethodC has a lower-case receiver type parameter. 
    	func (t Type[c]) MethodC()
    
    	// int16 shadows the predeclared type int16. 
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 10 18:06:32 UTC 2021
    - 1.6K bytes
    - Viewed (0)
  5. src/go/types/basic.go

    // license that can be found in the LICENSE file.
    
    package types
    
    // BasicKind describes the kind of basic type.
    type BasicKind int
    
    const (
    	Invalid BasicKind = iota // type is invalid
    
    	// predeclared types
    	Bool
    	Int
    	Int8
    	Int16
    	Int32
    	Int64
    	Uint
    	Uint8
    	Uint16
    	Uint32
    	Uint64
    	Uintptr
    	Float32
    	Float64
    	Complex64
    	Complex128
    	String
    	UnsafePointer
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  6. src/internal/types/testdata/fixedbugs/issue48008.go

    	}
    }
    
    // Make sure a parenthesized nil is ok.
    
    func _(x interface{}) {
    	switch x.(type) {
    	case ((nil)), int:
    	}
    }
    
    // Make sure we look for the predeclared nil.
    
    func _(x interface{}) {
    	type nil int
    	switch x.(type) {
    	case nil: // ok - this is the type nil
    	}
    }
    
    func _(x interface{}) {
    	var nil int
    	switch x.(type) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:27 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  7. test/typeparam/slices.go

    	if len(s) == 0 {
    		var zero Elem
    		return zero
    	}
    	return _Reduce(s[1:], s[0], _Min[Elem])
    }
    
    // _Append adds values to the end of a slice, returning a new slice.
    // This is like the predeclared append function; it's an example
    // of how to write it using generics. We used to write code like
    // this before append was added to the language, but we had to write
    // a separate copy for each type.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 7.8K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/types2/return.go

    		*syntax.AssignStmt, *syntax.CallStmt:
    		// no chance
    
    	case *syntax.LabeledStmt:
    		return check.isTerminating(s.Stmt, s.Label.Value)
    
    	case *syntax.ExprStmt:
    		// calling the predeclared (possibly parenthesized) panic() function is terminating
    		if call, ok := syntax.Unparen(s.X).(*syntax.CallExpr); ok && check.isPanic[call] {
    			return true
    		}
    
    	case *syntax.ReturnStmt:
    		return true
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  9. src/internal/types/testdata/check/decls3.go

    	type T2 struct {
    		unsafe /* ERROR "cannot be unsafe.Pointer" */ .Pointer
    		*/* ERROR "cannot be unsafe.Pointer" */ unsafe.Pointer /* ERROR "Pointer redeclared" */
    		UP /* ERROR "cannot be unsafe.Pointer" */
    		* /* ERROR "cannot be unsafe.Pointer" */ UP /* ERROR "UP redeclared" */
    	}
    }
    
    // Named types that are pointers.
    
    type S struct{ x int }
    func (*S) m() {}
    type P *S
    
    func _() {
    	var s *S
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 24 23:16:04 UTC 2023
    - 4.2K bytes
    - Viewed (0)
  10. src/go/types/return.go

    		*ast.RangeStmt:
    		// no chance
    
    	case *ast.LabeledStmt:
    		return check.isTerminating(s.Stmt, s.Label.Name)
    
    	case *ast.ExprStmt:
    		// calling the predeclared (possibly parenthesized) panic() function is terminating
    		if call, ok := ast.Unparen(s.X).(*ast.CallExpr); ok && check.isPanic[call] {
    			return true
    		}
    
    	case *ast.ReturnStmt:
    		return true
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.2K bytes
    - Viewed (0)
Back to top