Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
switch2.go40 linesDownload Raw Back to test
1// errorcheck2 3// Copyright 2015 The Go Authors. All rights reserved.4// Use of this source code is governed by a BSD-style5// license that can be found in the LICENSE file.6 7// Verify that erroneous switch statements are detected by the compiler.8// Does not compile.9 10package main11 12func f() {13	switch {14	case 0; // ERROR "expecting := or = or : or comma|expected :"15	}16 17	switch {18	case 0; // ERROR "expecting := or = or : or comma|expected :"19	default:20	}21 22	switch {23	case 0: case 0: default:24	}25 26	switch {27	case 0: f(); case 0:28	case 0: f() case 0: // ERROR "unexpected keyword case at end of statement"29	}30 31	switch {32	case 0: f(); default:33	case 0: f() default: // ERROR "unexpected keyword default at end of statement"34	}35 36	switch {37	if x: // ERROR "expected case or default or }"38	}39}40 
codekingpro/portable-devtools · Team Ai