Fixes #18392.
Avoid nil dereferencing n.Right when dealing with non-existent
self referenced interface methods e.g.
type A interface{
Fn(A.Fn)
}
Instead, infer the symbol name from n.Sym itself.
Change-Id: I60d5f8988e7318693e5c8da031285d8d7347b771
Reviewed-on: https://go-review.googlesource.com/34817
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
}
if n.Type.Etype != TFUNC || !n.IsMethod() {
- yyerror("type %v has no method %S", n.Left.Type, n.Right.Sym)
+ yyerror("type %v has no method %S", n.Left.Type, n.Sym)
n.Type = nil
return n
}
--- /dev/null
+// errorcheck
+
+// Copyright 2017 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 p
+
+type A interface {
+ Fn(A.Fn) // ERROR "type A has no method A.Fn"
+}