Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
switch7.go36 linesDownload Raw Back to test
1// errorcheck2 3// Copyright 2016 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 type switch statements with duplicate cases are detected8// by the compiler.9// Does not compile.10 11package main12 13import "fmt"14 15func f4(e interface{}) {16	switch e.(type) {17	case int:18	case int: // ERROR "duplicate case int in type switch"19	case int64:20	case error:21	case error: // ERROR "duplicate case error in type switch"22	case fmt.Stringer:23	case fmt.Stringer: // ERROR "duplicate case fmt.Stringer in type switch"24	case struct {25		i int "tag1"26	}:27	case struct {28		i int "tag2"29	}:30	case struct { // ERROR "duplicate case struct { i int .tag1. } in type switch|duplicate case"31		i int "tag1"32	}:33	}34}35 36 
codekingpro/portable-devtools · Team Ai