Skip to content

Commit 5eddb81

Browse files
authored
Improve "too many parameters" error (#50539)
I'm still not satisfied with this but ```julia ERROR: too many parameters for type AbstractTriangular Stacktrace: [1] top-level scope @ REPL[3]:1 ``` is slightly better than ```julia ERROR: too many parameters for type Stacktrace: [1] top-level scope @ REPL[3]:1 ```
1 parent 3a9345c commit 5eddb81

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/jltypes.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,12 @@ jl_value_t *jl_apply_type(jl_value_t *tc, jl_value_t **params, size_t n)
13511351
JL_GC_PUSH1(&tc);
13521352
jl_value_t *tc0 = tc;
13531353
for (i=0; i < n; i++) {
1354-
if (!jl_is_unionall(tc0))
1355-
jl_error("too many parameters for type");
1354+
if (!jl_is_unionall(tc0)){
1355+
char *typ = "";
1356+
if (jl_is_datatype(tc0))
1357+
typ = jl_symbol_name_(((jl_datatype_t*)tc0)->name->name);
1358+
jl_errorf("too many parameters for type %s", typ);
1359+
}
13561360
jl_value_t *pi = params[i];
13571361

13581362
tc0 = ((jl_unionall_t*)tc0)->body;

0 commit comments

Comments
 (0)