]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/types2/mono.go
go/types, types2: introduce _Alias type node
[gostls13.git] / src / cmd / compile / internal / types2 / mono.go
index 7bd79f4282efdcc1d196c4149428c07c3c459169..497276083abeda374c46c56ccb156f612acdfe6a 100644 (file)
@@ -6,6 +6,7 @@ package types2
 
 import (
        "cmd/compile/internal/syntax"
+       . "internal/types/errors"
 )
 
 // This file implements a check to validate that a Go package doesn't
@@ -137,6 +138,7 @@ func (check *Checker) reportInstanceLoop(v int) {
        // 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:")
 
@@ -206,7 +208,7 @@ func (w *monoGraph) assign(pkg *Package, pos syntax.Pos, tpar *TypeParam, targ T
        // type parameters.
        var do func(typ Type)
        do = func(typ Type) {
-               switch typ := typ.(type) {
+               switch typ := _Unalias(typ).(type) {
                default:
                        panic("unexpected type")
 
@@ -282,7 +284,7 @@ func (w *monoGraph) localNamedVertex(pkg *Package, named *Named) int {
        // 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)