import (
"cmd/compile/internal/syntax"
+ . "internal/types/errors"
)
// This file implements a check to validate that a Go package doesn't
// TODO(mdempsky): Pivot stack so we report the cycle from the top?
var err error_
+ err.code = InvalidInstanceCycle
obj0 := check.mono.vertices[v].obj
err.errorf(obj0, "instantiation cycle:")
// type parameters.
var do func(typ Type)
do = func(typ Type) {
- switch typ := typ.(type) {
+ switch typ := _Unalias(typ).(type) {
default:
panic("unexpected type")
// parameters that it's implicitly parameterized by.
for scope := obj.Parent(); scope != root; scope = scope.Parent() {
for _, elem := range scope.elems {
- if elem, ok := elem.(*TypeName); ok && !elem.IsAlias() && elem.Pos().Cmp(obj.Pos()) < 0 {
+ if elem, ok := elem.(*TypeName); ok && !elem.IsAlias() && cmpPos(elem.Pos(), obj.Pos()) < 0 {
if tpar, ok := elem.Type().(*TypeParam); ok {
if idx < 0 {
idx = len(w.vertices)