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

Invalid recursive type allowed #98

Open
ghost opened this issue Jun 10, 2020 · 1 comment
Open

Invalid recursive type allowed #98

ghost opened this issue Jun 10, 2020 · 1 comment
Assignees

Comments

@ghost
Copy link

ghost commented Jun 10, 2020

gomacro> type N struct{n N}
gomacro> n := N{n: N{}}
reflect: call of reflect.Value.Type on zero Value
gomacro> n
<nil>   // main.N
gomacro>

https://play.golang.org/p/QxubPiPUpdU

The following illegal recursive type declaration is allowed, too: type N N

The type type N struct{n []N} works in both gomacro and go with same result.

@cosmos72 cosmos72 self-assigned this Jun 10, 2020
@cosmos72
Copy link
Owner

cosmos72 commented Jun 10, 2020

True, invalid recursive types should be detected earlier - ideally when the type is defined, not when it's used (and sometimes not even then)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant