Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for testTypeSwitch (0.11 sec)

  1. src/runtime/gc_test.go

    			case <-done:
    				return
    			default:
    				runtime.GC()
    			}
    		}
    	}()
    	for i := 0; i < 1e4; i++ {
    		func() {
    			defer print("")
    		}()
    	}
    	close(done)
    }
    
    func testTypeSwitch(x any) error {
    	switch y := x.(type) {
    	case nil:
    		// ok
    	case error:
    		return y
    	}
    	return nil
    }
    
    func testAssert(x any) error {
    	if y, ok := x.(error); ok {
    		return y
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 05 22:33:52 UTC 2024
    - 17.6K bytes
    - Viewed (0)
Back to top