Commit 7fa1e87d authored by Tim Hockin's avatar Tim Hockin

Simplify convertible check - same type is OK

This is to clarify the code. No actual effect at the moment, but I manually verified this in the case of identical types.
parent ed59210f
...@@ -309,6 +309,9 @@ func isDirectlyConvertible(in, out *types.Type, manualConversions conversionFunc ...@@ -309,6 +309,9 @@ func isDirectlyConvertible(in, out *types.Type, manualConversions conversionFunc
return isConvertible(in, out.Underlying, manualConversions) return isConvertible(in, out.Underlying, manualConversions)
} }
if in == out {
return true
}
if in.Kind != out.Kind { if in.Kind != out.Kind {
return false return false
} }
...@@ -318,12 +321,6 @@ func isDirectlyConvertible(in, out *types.Type, manualConversions conversionFunc ...@@ -318,12 +321,6 @@ func isDirectlyConvertible(in, out *types.Type, manualConversions conversionFunc
// We don't support conversion of other types yet. // We don't support conversion of other types yet.
return false return false
} }
switch out.Kind {
case types.Builtin, types.Struct, types.Map, types.Slice, types.Pointer:
default:
// We don't support conversion of other types yet.
return false
}
switch in.Kind { switch in.Kind {
case types.Builtin: case types.Builtin:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment