File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -962,7 +962,14 @@ func supportedType(stack []types.Type, t types.Type) (ok bool) {
962
962
case * types.Array :
963
963
return supportedType (stack , x .Elem ())
964
964
case * types.Map :
965
- if b , ok := x .Key ().Underlying ().(* types.Basic ); ! ok || b .Kind () != types .String {
965
+ typ := x .Key ()
966
+ if b , ok := typ .Underlying ().(* types.Basic ); ! ok || b .Kind () != types .String {
967
+ ptr := types .NewPointer (typ )
968
+ for _ , iface := range toString {
969
+ if types .Implements (typ , iface ) || types .Implements (ptr , iface ) {
970
+ return supportedType (stack , x .Elem ())
971
+ }
972
+ }
966
973
return false
967
974
}
968
975
return supportedType (stack , x .Elem ())
@@ -1115,7 +1122,9 @@ func (e *extractor) makeType(expr types.Type) (result cueast.Expr) {
1115
1122
1116
1123
case * types.Map :
1117
1124
if b , ok := x .Key ().Underlying ().(* types.Basic ); ! ok || b .Kind () != types .String {
1118
- panic (fmt .Sprintf ("unsupported map key type %T" , x .Key ()))
1125
+ if alt := e .altType (x .Key ()); alt == nil {
1126
+ panic (fmt .Sprintf ("unsupported map key type %T" , x .Key ()))
1127
+ }
1119
1128
}
1120
1129
1121
1130
f := & cueast.Field {
You can’t perform that action at this time.
0 commit comments