Search Options

Results per page
Sort
Preferred Languages
Advance

Results 81 - 90 of 4,191 for switchn (0.11 sec)

  1. test/fixedbugs/issue29562.go

    // license that can be found in the LICENSE file.
    
    // Triggers a double walk of the (inlined) switch in il
    
    package p
    
    func il(s string) string {
    	switch len(s) {
    	case 0:
    		return "zero"
    	case 1:
    		return "one"
    	}
    	return s
    }
    
    func f() {
    	var s string
    	var as []string
    	switch false && (s+"a"+as[0]+il(s)+as[0]+s == "") {
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 04 21:51:37 UTC 2019
    - 449 bytes
    - Viewed (0)
  2. test/fixedbugs/bug373.go

    // Issue 873, 2162
    
    package foo
    
    func f(x interface{}) {
    	switch t := x.(type) {  // ERROR "declared and not used"
    	case int:
    	}
    }
    
    func g(x interface{}) {
    	switch t := x.(type) {
    	case int:
    	case float32:
    		println(t)
    	}
    }
    
    func h(x interface{}) {
    	switch t := x.(type) {
    	case int:
    	case float32:
    	default:
    		println(t)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 27 21:10:19 UTC 2022
    - 502 bytes
    - Viewed (0)
  3. test/fixedbugs/issue25006.go

    // license that can be found in the LICENSE file.
    
    package p
    
    func spin() {
    	var i int
    	var b bool
    
    	switch 1 {
    	case 0:
    		i = 1
    	}
    	switch 1 {
    	case i:
    	default:
    		i = 1
    		b = !b && (b && !b) && b
    	}
    	switch false {
    	case false:
    		i = 3 + -i
    		switch 0 {
    		case 1 - i:
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 24 16:20:41 UTC 2018
    - 400 bytes
    - Viewed (0)
  4. test/fixedbugs/bug157.go

    func f() {}
    
    func main() {
    	x := 0;
    
    	// this compiles
    	switch x {
    	case 0: f();
    	default: f();
    	}
    
    	// this doesn't but it should
    	// (semicolons are not needed at the end of a statement list)
    	switch x {
    	case 0: f()
    	default: f()
    	}
    }
    
    
    /*
    bug157.go:20: syntax error near default
    bug157.go:20: first switch statement must be a case
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 18 21:15:42 UTC 2012
    - 524 bytes
    - Viewed (0)
  5. src/internal/types/testdata/fixedbugs/issue42758.go

    package p
    
    func _[T any](x interface{}){
    	switch x.(type) {
    	case T: // ok to use a type parameter
    	case int:
    	}
    
    	switch x.(type) {
    	case T:
    	case T /* ERROR "duplicate case" */ :
    	}
    }
    
    type constraint interface {
    	~int
    }
    
    func _[T constraint](x interface{}){
    	switch x.(type) {
    	case T: // ok to use a type parameter even if type set contains int
    	case int:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:25 UTC 2023
    - 649 bytes
    - Viewed (0)
  6. src/math/cmplx/sin.go

    // Also tested by csin(casin(z)) = z.
    
    // Sin returns the sine of x.
    func Sin(x complex128) complex128 {
    	switch re, im := real(x), imag(x); {
    	case im == 0 && (math.IsInf(re, 0) || math.IsNaN(re)):
    		return complex(math.NaN(), im)
    	case math.IsInf(im, 0):
    		switch {
    		case re == 0:
    			return x
    		case math.IsInf(re, 0) || math.IsNaN(re):
    			return complex(math.NaN(), im)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 17:59:44 UTC 2022
    - 4.8K bytes
    - Viewed (0)
  7. src/net/platform_test.go

    func testableNetwork(network string) bool {
    	net, _, _ := strings.Cut(network, ":")
    	switch net {
    	case "ip+nopriv":
    	case "ip", "ip4", "ip6":
    		switch runtime.GOOS {
    		case "plan9":
    			return false
    		default:
    			if os.Getuid() != 0 {
    				return false
    			}
    		}
    	case "unix", "unixgram":
    		switch runtime.GOOS {
    		case "android", "ios", "plan9", "windows":
    			return false
    		case "aix":
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 18 17:20:52 UTC 2023
    - 4.3K bytes
    - Viewed (0)
  8. src/internal/types/testdata/fixedbugs/issue50965.go

    // license that can be found in the LICENSE file.
    
    package p
    
    func _(x int, c string) {
    	switch x {
    	case c /* ERROR "invalid case c in switch on x (mismatched types string and int)" */ :
    	}
    }
    
    func _(x, c []int) {
    	switch x {
    	case c /* ERROR "invalid case c in switch on x (slice can only be compared to nil)" */ :
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:27 UTC 2023
    - 431 bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/arch/x86/x86asm/gnu.go

    			found := false
    			for i := len(inst.Prefix) - 1; i >= 0; i-- {
    				switch inst.Prefix[i] & 0xFF {
    				case 0xF3:
    					if !found {
    						found = true
    						inst.Prefix[i] |= PrefixImplicit
    					}
    				case 0xF2:
    					inst.Prefix[i] &^= PrefixImplicit
    				}
    			}
    			inst.Op = MOVNTSS
    		}
    	}
    
    	// Add implicit arguments.
    	switch inst.Op {
    	case MONITOR:
    		inst.Args[0] = EDX
    		inst.Args[1] = ECX
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:33 UTC 2023
    - 21.4K bytes
    - Viewed (0)
  10. test/alias1.go

    package main
    
    func main() {
    	var x interface{}
    
    	x = byte(1)
    	switch x.(type) {
    	case uint8:
    		// ok
    	default:
    		panic("byte != uint8")
    	}
    
    	x = uint8(2)
    	switch x.(type) {
    	case byte:
    		// ok
    	default:
    		panic("uint8 != byte")
    	}
    
    	rune32 := false
    	x = rune(3)
    	switch x.(type) {
    	case int:
    		// ok
    	case int32:
    		// must be new code
    		rune32 = true
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 803 bytes
    - Viewed (0)
Back to top