conversion-gen: Better error on duplicate objects

This commit is contained in:
Clayton Coleman 2018-07-03 16:07:29 -04:00
parent e9fa259451
commit eb85c83e92
No known key found for this signature in database
GPG Key ID: 3D16906B4F1C5CB3

View File

@ -175,7 +175,7 @@ func getManualConversionFunctions(context *generator.Context, pkg *types.Package
key := conversionPair{inType.Elem, outType.Elem}
// We might scan the same package twice, and that's OK.
if v, ok := manualMap[key]; ok && v != nil && v.Name.Package != pkg.Path {
panic(fmt.Sprintf("duplicate static conversion defined: %s -> %s", key.inType, key.outType))
panic(fmt.Sprintf("duplicate static conversion defined: %s -> %s from:\n%s.%s\n%s.%s", key.inType, key.outType, v.Name.Package, v.Name.Name, f.Name.Package, f.Name.Name))
}
manualMap[key] = f
} else {