File: other_packages.go

package info (click to toggle)
golang-golang-x-exp 0.0~git20231006.7918f67-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 6,492 kB
  • sloc: ansic: 1,900; objc: 276; sh: 272; asm: 48; makefile: 27
file content (44 lines) | stat: -rw-r--r-- 1,039 bytes parent folder | download | duplicates (4)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// These tests demonstrate the correct handling of symbols
// in packages other than two being compared.
// See the lines in establishCorrespondence beginning
//
//	if newn, ok := new.(*types.Named); ok
package p

// both

// gofmt insists on grouping imports, so old and new
// must both have both imports.
import (
	"io"
	"text/tabwriter"
)

// Here we have two named types in different packages.
// They have the same package-relative name, but we compare
// the package-qualified names.

// old
var V io.Writer
var _ tabwriter.Writer

// new
// i V: changed from io.Writer to text/tabwriter.Writer
var V tabwriter.Writer
var _ io.Writer

// Here one type is a basic type.
// Example from https://go.dev/issue/61385.
// apidiff would previously report
//	 F2: changed from func(io.ReadCloser) to func(io.ReadCloser)
//   io.ReadCloser: changed from interface{io.Reader; io.Closer} to int

// old
func F1(io.ReadCloser) {}

// new
// i F1: changed from func(io.ReadCloser) to func(int)
func F1(int) {}

// both
func F2(io.ReadCloser) {}