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

partially formed union types panic #46

Open
jdhenke opened this issue Apr 23, 2019 · 0 comments
Open

partially formed union types panic #46

jdhenke opened this issue Apr 23, 2019 · 0 comments

Comments

@jdhenke
Copy link

jdhenke commented Apr 23, 2019

#45 illustrates a test case that should error but currently panics because the generated code dereferences a pointer it assumes is present but may not be at line 97:

func (u *ExampleUnion) Accept(v ExampleUnionVisitor) error {
switch u.typ {
default:
if u.typ == "" {
return fmt.Errorf("invalid value in union type")
}
return v.VisitUnknown(u.typ)
case "str":
return v.VisitStr(*u.str)
case "strOptional":
var strOptional *string
if u.strOptional != nil {
strOptional = *u.strOptional
}
return v.VisitStrOptional(strOptional)
case "other":
return v.VisitOther(*u.other)
}
}

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

No branches or pull requests

1 participant