Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
issue52228.go31 linesDownload Raw Back to typeparam
1// run2 3// Copyright 2022 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 7package main8 9type SomeInterface interface {10	Whatever()11}12 13func X[T any]() T {14	var m T15 16	// for this example, this block should never run17	if _, ok := any(m).(SomeInterface); ok {18		var dst SomeInterface19		_, _ = dst.(T)20		return dst.(T)21	}22 23	return m24}25 26type holder struct{}27 28func main() {29	X[holder]()30}31 
codekingpro/portable-devtools · Team Ai