2012-10-07 09:35:21 -06:00
|
|
|
// errorcheck
|
|
|
|
|
2016-04-10 15:32:26 -06:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
2012-10-07 09:35:21 -06:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Issue 3757: unhelpful typechecking loop message
|
|
|
|
// for constants that refer to themselves.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2022-09-21 21:52:00 -06:00
|
|
|
const a = a // ERROR "refers to itself|definition loop|initialization cycle"
|
2012-10-07 09:35:21 -06:00
|
|
|
|
|
|
|
const (
|
|
|
|
X = A
|
2022-09-21 21:52:00 -06:00
|
|
|
A = B // ERROR "refers to itself|definition loop|initialization cycle"
|
2012-10-07 09:35:21 -06:00
|
|
|
B = D
|
|
|
|
C, D = 1, A
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
}
|