]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/types/mono.go
go/types, types2: implement Alias proposal (export API)
[gostls13.git] / src / go / types / mono.go
index f95d200b9315d78d6396a5bbe7ae01bb40ba2b84..74113392149fbdc1362af3d085496b8daf907b12 100644 (file)
@@ -139,7 +139,7 @@ func (check *Checker) reportInstanceLoop(v int) {
        // TODO(mdempsky): Pivot stack so we report the cycle from the top?
 
        obj0 := check.mono.vertices[v].obj
-       check.errorf(obj0, InvalidInstanceCycle, "instantiation cycle:")
+       check.error(obj0, InvalidInstanceCycle, "instantiation cycle:")
 
        qf := RelativeTo(check.pkg)
        for _, v := range stack {
@@ -206,7 +206,7 @@ func (w *monoGraph) assign(pkg *Package, pos token.Pos, tpar *TypeParam, targ Ty
        // 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 +282,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() < obj.Pos() {
+                       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)