Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: undocumented limit to number of embedded structs #13337

Closed
qAison opened this issue Nov 20, 2015 · 1 comment
Closed

cmd/compile: undocumented limit to number of embedded structs #13337

qAison opened this issue Nov 20, 2015 · 1 comment

Comments

@qAison
Copy link

qAison commented Nov 20, 2015

go version go1.5.1 linux/amd64 | CentOS 7.0x64
go version go1.5.1 windows/amd64 | Window 10x64

package main

import (
    "fmt"
)

type StructIntf interface {
    Get() string
}

type Struct0 struct{}

func (self *Struct0) Get() string {
    return "x1111"
}

type Struct1 struct{ Struct0 }
type Struct2 struct{ Struct1 }
type Struct3 struct{ Struct2 }
type Struct4 struct{ Struct3 }
type Struct5 struct{ Struct4 }
type Struct6 struct{ Struct5 }
type Struct7 struct{ Struct6 }
type Struct8 struct{ Struct7 }
type Struct9 struct{ Struct8 }

func main() {
    //  var intf StructIntf = new(Struct0) // OK
    //  var intf StructIntf = new(Struct8) // OK
    //  fmt.Println(new(Struct9).Get()) // OK

    // panic: interface conversion: *main.Struct9 is not main.StructIntf: missing method Get
    var intf StructIntf = new(Struct9)  
    // embedded struct level limit ???

    fmt.Println(intf)
}
@ianlancetaylor ianlancetaylor changed the title embedded struct level limit? cmd/compile: undocumented limit to number of embedded structs Nov 20, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Nov 20, 2015
@rsc rsc modified the milestones: Unplanned, Go1.6 Dec 5, 2015
@mdempsky mdempsky self-assigned this Feb 26, 2016
@gopherbot
Copy link

CL https://golang.org/cl/19932 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants