Source file src/internal/types/testdata/fixedbugs/issue69955.go

     1  // Copyright 2024 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package p
     6  
     7  import "math/big"
     8  
     9  type (
    10  	S struct{}
    11  	N int
    12  
    13  	A = S
    14  	B = int
    15  	C = N
    16  )
    17  
    18  var (
    19  	i int
    20  	s S
    21  	n N
    22  	a A
    23  	b B
    24  	c C
    25  	w big.Word
    26  )
    27  
    28  const (
    29  	_ = i // ERROR "i (variable of type int) is not constant"
    30  	_ = s // ERROR "s (variable of struct type S) is not constant"
    31  	_ = struct /* ERROR "struct{}{} (value of type struct{}) is not constant" */ {}{}
    32  	_ = n // ERROR "n (variable of int type N) is not constant"
    33  
    34  	_ = a // ERROR "a (variable of struct type A) is not constant"
    35  	_ = b // ERROR "b (variable of int type B) is not constant"
    36  	_ = c // ERROR "c (variable of int type C) is not constant"
    37  	_ = w // ERROR "w (variable of uint type big.Word) is not constant"
    38  )
    39  
    40  var _ int = w /* ERROR "cannot use w + 1 (value of uint type big.Word) as int value in variable declaration" */ + 1
    41  

View as plain text