A nested TFORW type would push algtype1 into an impossible case.
Fixes #5125.
R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/
8213043
*bad = T;
switch(t->etype) {
+ case TANY:
+ case TFORW:
+ // will be defined later.
+ *bad = t;
+ return -1;
+
case TINT8:
case TUINT8:
case TINT16:
maptype(Type *key, Type *val)
{
Type *t;
+ Type *bad;
+ int atype;
if(key != nil) {
- switch(key->etype) {
+ atype = algtype1(key, &bad);
+ switch(bad == T ? key->etype : bad->etype) {
default:
- if(algtype1(key, nil) == ANOEQ)
+ if(atype == ANOEQ)
yyerror("invalid map key type %T", key);
break;
case TANY:
--- /dev/null
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package bug
+
+type Node interface {
+ Eval(s *Scene)
+}
+
+type plug struct {
+ node Node
+}
+
+type Scene struct {
+ changed map[plug]bool
+}
--- /dev/null
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import _ "./bug"
+
+func main() {
+}
--- /dev/null
+// compiledir
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 5125: cyclic dependencies between types confuse
+// the hashability test during import.
+
+package ignored