diff options
Diffstat (limited to 'src/cmd/compile/internal/types2/testdata/check')
-rw-r--r-- | src/cmd/compile/internal/types2/testdata/check/const0.go | 19 | ||||
-rw-r--r-- | src/cmd/compile/internal/types2/testdata/check/expr0.go | 7 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/testdata/check/const0.go b/src/cmd/compile/internal/types2/testdata/check/const0.go index 3cffdf904c8..229c248643d 100644 --- a/src/cmd/compile/internal/types2/testdata/check/const0.go +++ b/src/cmd/compile/internal/types2/testdata/check/const0.go @@ -349,6 +349,25 @@ const _ = unsafe.Sizeof(func() { assert(iota == 0) }) +// issue #52438 +const i1 = iota +const i2 = iota +const i3 = iota + +func _() { + assert(i1 == 0) + assert(i2 == 0) + assert(i3 == 0) + + const i4 = iota + const i5 = iota + const i6 = iota + + assert(i4 == 0) + assert(i5 == 0) + assert(i6 == 0) +} + // untyped constants must not get arbitrarily large const prec = 512 // internal maximum precision for integers const maxInt = (1<<(prec/2) - 1) * (1<<(prec/2) + 1) // == 1<<prec - 1 diff --git a/src/cmd/compile/internal/types2/testdata/check/expr0.go b/src/cmd/compile/internal/types2/testdata/check/expr0.go index 1aac726327b..821b07f0075 100644 --- a/src/cmd/compile/internal/types2/testdata/check/expr0.go +++ b/src/cmd/compile/internal/types2/testdata/check/expr0.go @@ -178,3 +178,10 @@ func _() { _ = -g /* ERROR 2-valued g */ () _ = <-g /* ERROR 2-valued g */ () } + +// ~ is accepted as unary operator only permitted in interface type elements +var ( + _ = ~ /* ERROR cannot use ~ outside of interface or type constraint */ 0 + _ = ~ /* ERROR cannot use ~ outside of interface or type constraint */ "foo" + _ = ~ /* ERROR cannot use ~ outside of interface or type constraint */ i0 +)
\ No newline at end of file |