Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 4,177 for switch3 (0.12 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/go/scanner/scanner.go

    		case '=':
    			tok = s.switch2(token.ASSIGN, token.EQL)
    		case '!':
    			tok = s.switch2(token.NOT, token.NEQ)
    		case '&':
    			if s.ch == '^' {
    				s.next()
    				tok = s.switch2(token.AND_NOT, token.AND_NOT_ASSIGN)
    			} else {
    				tok = s.switch3(token.AND, token.AND_ASSIGN, '&', token.LAND)
    			}
    		case '|':
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 24.3K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top