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