@@ -1199,55 +1199,71 @@ JL_DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v) JL_NOTSAFEPOIN
1199
1199
1200
1200
JL_DLLEXPORT size_t jl_static_show_func_sig (JL_STREAM * s , jl_value_t * type ) JL_NOTSAFEPOINT
1201
1201
{
1202
+ size_t n = 0 ;
1203
+ size_t i ;
1202
1204
jl_value_t * ftype = (jl_value_t * )jl_first_argument_datatype (type );
1203
1205
if (ftype == NULL )
1204
1206
return jl_static_show (s , type );
1205
- size_t n = 0 ;
1207
+ jl_unionall_t * tvars = (jl_unionall_t * )type ;
1208
+ int nvars = jl_subtype_env_size (type );
1209
+ struct recur_list * depth = NULL ;
1210
+ if (nvars > 0 ) {
1211
+ depth = (struct recur_list * )alloca (sizeof (struct recur_list ) * nvars );
1212
+ for (i = 0 ; i < nvars ; i ++ ) {
1213
+ depth [i ].prev = i == 0 ? NULL : & depth [i - 1 ];
1214
+ depth [i ].v = type ;
1215
+ type = ((jl_unionall_t * )type )-> body ;
1216
+ }
1217
+ depth += nvars - 1 ;
1218
+ }
1219
+ if (!jl_is_datatype (type )) {
1220
+ n += jl_static_show (s , type );
1221
+ return n ;
1222
+ }
1206
1223
if (jl_nparams (ftype ) == 0 || ftype == ((jl_datatype_t * )ftype )-> name -> wrapper ) {
1207
1224
n += jl_printf (s , "%s" , jl_symbol_name (((jl_datatype_t * )ftype )-> name -> mt -> name ));
1208
1225
}
1209
1226
else {
1210
1227
n += jl_printf (s , "(::" );
1211
- n += jl_static_show (s , ftype );
1228
+ n += jl_static_show_x (s , ftype , depth );
1212
1229
n += jl_printf (s , ")" );
1213
1230
}
1214
- jl_unionall_t * tvars = (jl_unionall_t * )type ;
1215
- type = jl_unwrap_unionall (type );
1216
- if (!jl_is_datatype (type )) {
1217
- n += jl_printf (s , " " );
1218
- n += jl_static_show (s , type );
1219
- return n ;
1220
- }
1221
1231
size_t tl = jl_nparams (type );
1222
1232
n += jl_printf (s , "(" );
1223
- size_t i ;
1224
1233
for (i = 1 ; i < tl ; i ++ ) {
1225
1234
jl_value_t * tp = jl_tparam (type , i );
1226
1235
if (i != tl - 1 ) {
1227
- n += jl_static_show (s , tp );
1236
+ n += jl_static_show_x (s , tp , depth );
1228
1237
n += jl_printf (s , ", " );
1229
1238
}
1230
1239
else {
1231
- if (jl_is_vararg (tp )) {
1232
- n += jl_static_show (s , jl_unwrap_vararg (tp ));
1240
+ if (jl_vararg_kind (tp ) == JL_VARARG_UNBOUND ) {
1241
+ tp = jl_unwrap_vararg (tp );
1242
+ if (jl_is_unionall (tp ))
1243
+ n += jl_printf (s , "(" );
1244
+ n += jl_static_show_x (s , tp , depth );
1245
+ if (jl_is_unionall (tp ))
1246
+ n += jl_printf (s , ")" );
1233
1247
n += jl_printf (s , "..." );
1234
1248
}
1235
1249
else {
1236
- n += jl_static_show (s , tp );
1250
+ n += jl_static_show_x (s , tp , depth );
1237
1251
}
1238
1252
}
1239
1253
}
1240
1254
n += jl_printf (s , ")" );
1241
1255
if (jl_is_unionall (tvars )) {
1256
+ depth -= nvars - 1 ;
1242
1257
int first = 1 ;
1243
1258
n += jl_printf (s , " where {" );
1244
1259
while (jl_is_unionall (tvars )) {
1245
- if (first )
1246
- first = 0 ;
1247
- else
1260
+ if (!first )
1248
1261
n += jl_printf (s , ", " );
1249
- n += jl_static_show (s , (jl_value_t * )tvars -> var );
1262
+ n += jl_static_show_x (s , (jl_value_t * )tvars -> var , first ? NULL : depth );
1250
1263
tvars = (jl_unionall_t * )tvars -> body ;
1264
+ if (!first )
1265
+ depth += 1 ;
1266
+ first = 0 ;
1251
1267
}
1252
1268
n += jl_printf (s , "}" );
1253
1269
}
0 commit comments