aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go.golden
blob: 93c6f707c32d0a91960e505af5d89f2b12b5d0b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2021 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.

// We should not suggest removing type arguments if doing so would change the
// resulting type.

package a

func id[T any](t T) T { return t }

var _ = id(1)     // want "unnecessary type arguments"
var _ = id("foo") // want "unnecessary type arguments"
var _ = id[int64](2)

func pair[T any](t T) (T, T) { return t, t }

var _, _ = pair(3) // want "unnecessary type arguments"
var _, _ = pair[int64](3)

func noreturn[T any](t T) {}

func _() {
	noreturn[int64](4)
	noreturn(4) // want "unnecessary type arguments"
}