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

Make it easier to debug conversion mismatches #31942

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/libs/go2idl/conversion-gen/generators/conversion.go
Expand Up @@ -359,6 +359,7 @@ func isDirectlyConvertible(in, out *types.Type, manualConversions conversionFunc
// Check if there is an out member with that name.
outMember, found := findMember(out, inMember.Name)
if !found {
glog.V(5).Infof("%s.%s is not directly convertible to %s because the destination struct field did not exist", in.Name, inMember.Name, out.Name)
return false
}
convertible = convertible && isConvertible(inMember.Type, outMember.Type, manualConversions)
Expand Down Expand Up @@ -577,7 +578,11 @@ func (g *genConversion) GenerateType(c *generator.Context, t *types.Type, w io.W
g.generateConversion(peerType, t, sw)
}
if didForward != didBackward {
glog.Fatalf("Could only generate one direction of conversion for %v <-> %v", t, peerType)
if didForward {
glog.Fatalf("Could only generate one direction of conversion for %v -> %v", t, peerType)
} else {
glog.Fatalf("Could only generate one direction of conversion for %v <- %v", t, peerType)
}
}
if !didForward && !didBackward {
// TODO: This should be fatal but we have at least 8 types that
Expand Down