Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 4,191 for switchn (0.14 sec)

  1. src/cmd/compile/internal/walk/switch.go

    // expression switch.
    func walkSwitchExpr(sw *ir.SwitchStmt) {
    	lno := ir.SetPos(sw)
    
    	cond := sw.Tag
    	sw.Tag = nil
    
    	// convert switch {...} to switch true {...}
    	if cond == nil {
    		cond = ir.NewBool(base.Pos, true)
    		cond = typecheck.Expr(cond)
    		cond = typecheck.DefaultLit(cond, nil)
    	}
    
    	// Given "switch string(byteslice)",
    	// with all cases being side-effect free,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:01 UTC 2024
    - 30.1K bytes
    - Viewed (0)
  2. test/switch5.go

    	case 5.0: // ERROR "duplicate case (5 in switch)?"
    	}
    }
    
    func f2(s string) {
    	switch s {
    	case "":
    	case "": // ERROR "duplicate case (.. in switch)?"
    	case "abc":
    	case "abc": // ERROR "duplicate case (.abc. in switch)?"
    	}
    }
    
    func f3(e interface{}) {
    	switch e {
    	case 0:
    	case 0: // ERROR "duplicate case (0 in switch)?"
    	case int64(0):
    	case float32(10):
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 14 21:28:48 UTC 2020
    - 2.3K bytes
    - Viewed (0)
  3. test/switch6.go

    func f1(e interface{}) {
    	switch e {
    	default:
    	default: // ERROR "multiple defaults( in switch)?"
    	}
    	switch e.(type) {
    	default:
    	default: // ERROR "multiple defaults( in switch)?"
    	}
    }
    
    type I interface {
    	Foo()
    }
    
    type X int
    
    func (*X) Foo() {}
    func f2() {
    	var i I
    	switch i.(type) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Sep 24 17:04:15 UTC 2022
    - 1.1K bytes
    - Viewed (0)
  4. test/switch3.go

    	default:
    	}
    
    	var ar, ar1 [4]func()
    	switch ar { // ERROR "cannot switch on"
    	case ar1:
    	default:
    	}
    
    	var st, st1 struct{ f func() }
    	switch st { // ERROR "cannot switch on"
    	case st1:
    	}
    }
    
    func good() {
    	var i interface{}
    	var s string
    
    	switch i {
    	case s:
    	}
    
    	switch s {
    	case i:
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 15 19:43:32 UTC 2020
    - 1.2K bytes
    - Viewed (0)
  5. test/switch2.go

    // Verify that erroneous switch statements are detected by the compiler.
    // Does not compile.
    
    package main
    
    func f() {
    	switch {
    	case 0; // ERROR "expecting := or = or : or comma|expected :"
    	}
    
    	switch {
    	case 0; // ERROR "expecting := or = or : or comma|expected :"
    	default:
    	}
    
    	switch {
    	case 0: case 0: default:
    	}
    
    	switch {
    	case 0: f(); case 0:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 01 22:37:04 UTC 2022
    - 775 bytes
    - Viewed (0)
  6. test/switch4.go

    // Verify that erroneous switch statements are detected by the compiler.
    // Does not compile.
    
    package main
    
    type I interface {
    	M()
    }
    
    func bad() {
    
    	i5 := 5
    	switch i5 {
    	case 5:
    		fallthrough // ERROR "cannot fallthrough final case in switch"
    	}
    }
    
    func good() {
    	var i interface{}
    	var s string
    
    	switch i {
    	case s:
    	}
    
    	switch s {
    	case i:
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 15 04:35:09 UTC 2013
    - 526 bytes
    - Viewed (0)
  7. tensorflow/compiler/mlir/tensorflow/tests/graphdef2mlir/switch_n.pbtxt

    # CHECK: tf_executor._SwitchN
    # CHECK-SAME: of 3 : tensor<*xi32>
    # CHECK-SAME: T = i32
    # CHECK-SAME: loc(fused["_SwitchN:", "Case/branch_index/_3"])
    # CHECK: tf_executor._SwitchN
    # CHECK-SAME: of 2 : tensor<*xf32>
    # CHECK-SAME: T = f32
    # CHECK-SAME: loc(fused["_SwitchN:", "Case/Case/input_0/_7"])
    
    node {
      name: "Case/branch_index"
      op: "Const"
      attr {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Mon Nov 15 19:42:47 UTC 2021
    - 3.7K bytes
    - Viewed (0)
  8. test/switch.go

    	// switch on nil-only comparison types
    	switch f := func() {}; f {
    	case nil:
    		assert(false, "f should not be nil")
    	default:
    	}
    
    	switch m := make(map[int]int); m {
    	case nil:
    		assert(false, "m should not be nil")
    	default:
    	}
    
    	switch a := make([]int, 1); a {
    	case nil:
    		assert(false, "m should not be nil")
    	default:
    	}
    
    	// switch on interface.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jul 19 23:30:49 UTC 2022
    - 6.5K bytes
    - Viewed (0)
  9. test/switch7.go

    // Verify that type switch statements with duplicate cases are detected
    // by the compiler.
    // Does not compile.
    
    package main
    
    import "fmt"
    
    func f4(e interface{}) {
    	switch e.(type) {
    	case int:
    	case int: // ERROR "duplicate case int in type switch"
    	case int64:
    	case error:
    	case error: // ERROR "duplicate case error in type switch"
    	case fmt.Stringer:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 14 21:28:48 UTC 2020
    - 796 bytes
    - Viewed (0)
  10. test/codegen/switch.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // These tests check code generation of switch statements.
    
    package codegen
    
    // see issue 33934
    func f(x string) int {
    	// amd64:-`cmpstring`
    	switch x {
    	case "":
    		return -1
    	case "1", "2", "3":
    		return -2
    	default:
    		return -3
    	}
    }
    
    // use jump tables for 8+ int cases
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 18:39:50 UTC 2023
    - 3.6K bytes
    - Viewed (0)
Back to top