Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 2,058 for switch3 (0.13 sec)

  1. 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)
  2. src/cmd/go/internal/toolchain/switch.go

    	}
    }
    
    // NeedSwitch reports whether Switch would attempt to switch toolchains.
    func (s *Switcher) NeedSwitch() bool {
    	return s.TooNew != nil && (HasAuto() || HasPath())
    }
    
    // Switch decides whether to switch to a newer toolchain
    // to resolve any of the saved errors.
    // It switches if toolchain switches are permitted and there is at least one TooNewError.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 18:15:22 UTC 2024
    - 7K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  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. 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)
  8. 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)
  9. tensorflow/compiler/mlir/tensorflow/tests/mlir2graphdef/switchn.mlir

            "tf_executor.yield"(%0) : (tensor<i32>) -> ()
          }) : () -> (tensor<i32>, !tf_executor.control)
          %outputs_0:3, %control_1 = "tf_executor._SwitchN"(%outputs, %outputs) {T = i32, device = "", num_outs = 3 : i64} : (tensor<i32>, tensor<i32>) -> (tensor<*xi32>, tensor<*xi32>, tensor<*xi32>, !tf_executor.control)
          %outputs_2, %control_3 = "tf_executor.island"() ({
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Tue Mar 22 14:25:57 UTC 2022
    - 4K 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