mirror of
https://github.com/golang/go
synced 2024-11-15 00:20:30 -07:00
dcb6547b76
Now that we always use types2 to validate user source code, we can remove the constSet logic from typecheck for detecting duplicate expression switch cases and duplicate map literal keys. This logic is redundant with types2, and currently causes unified IR to report inappropriate duplicate constant errors that only appear after type substitution. Updates #42758. Change-Id: I51ee2c5106eec9abf40eba2480dc52603c68ba21 Reviewed-on: https://go-review.googlesource.com/c/go/+/390474 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
20 lines
363 B
Go
20 lines
363 B
Go
// run
|
|
|
|
// Copyright 2022 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
func F[T, U int]() interface{} {
|
|
switch interface{}(nil) {
|
|
case int(0), T(0), U(0):
|
|
}
|
|
|
|
return map[interface{}]int{int(0): 0, T(0): 0, U(0): 0}
|
|
}
|
|
|
|
func main() {
|
|
F[int, int]()
|
|
}
|