golang.org/x/exp@v0.0.0-20240506185415-9bf2ced13842/apidiff/testdata/constants.go (about)

     1  package p
     2  
     3  // old
     4  type u1 int
     5  
     6  // both
     7  type u2 int
     8  
     9  // type changes
    10  // old
    11  
    12  const (
    13  	C1     = 1
    14  	C2 int = 2
    15  	C3     = 3
    16  	C4 u1  = 4
    17  )
    18  
    19  var V8 int
    20  
    21  // new
    22  const (
    23  	// i C1: changed from untyped int to untyped string
    24  	C1 = "1"
    25  	// i C2: changed from int to untyped int
    26  	C2 = -1
    27  	// i C3: changed from untyped int to int
    28  	C3 int = 3
    29  	// i V8: changed from var to const
    30  	V8 int = 1
    31  	C4 u2  = 4 // OK: u1 corresponds to u2
    32  )
    33  
    34  // value change
    35  // old
    36  const (
    37  	Cr1 = 1
    38  	Cr2 = "2"
    39  	Cr3 = 3.5
    40  	Cr4 = complex(0, 4.1)
    41  )
    42  
    43  // new
    44  const (
    45  	// i Cr1: value changed from 1 to -1
    46  	Cr1 = -1
    47  	// i Cr2: value changed from "2" to "3"
    48  	Cr2 = "3"
    49  	// i Cr3: value changed from 3.5 to 3.8
    50  	Cr3 = 3.8
    51  	// i Cr4: value changed from (0 + 4.1i) to (4.1 + 0i)
    52  	Cr4 = complex(4.1, 0)
    53  )