Skip to content

Commit 5183933

Browse files
committed
Revert "improve apply_type error message (#42422)"
This reverts commit ada1cd2.
1 parent 593357f commit 5183933

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/jltypes.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,7 @@ jl_value_t *jl_apply_type(jl_value_t *tc, jl_value_t **params, size_t n)
846846
}
847847
// if this is a wrapper, let check_datatype_parameters give the error
848848
if (!iswrapper)
849-
jl_type_error_rt(jl_is_datatype(inner) ? jl_symbol_name(inner->name->name) : "Type",
850-
jl_symbol_name(ua->var->name), (jl_value_t*)ua->var, pi);
849+
jl_type_error_rt("Type", jl_symbol_name(ua->var->name), (jl_value_t*)ua->var, pi);
851850
}
852851

853852
tc = jl_instantiate_unionall(ua, pi);
@@ -1064,19 +1063,16 @@ static void check_datatype_parameters(jl_typename_t *tn, jl_value_t **params, si
10641063
}
10651064
assert(i == np*2);
10661065
wrapper = tn->wrapper;
1067-
for (i = 0; i < np; i++) {
1066+
for(i=0; i < np; i++) {
10681067
assert(jl_is_unionall(wrapper));
10691068
jl_tvar_t *tv = ((jl_unionall_t*)wrapper)->var;
10701069
if (!within_typevar(params[i], bounds[2*i], bounds[2*i+1])) {
1071-
if (tv->lb != bounds[2*i] || tv->ub != bounds[2*i+1])
1072-
// pass a new version of `tv` containing the instantiated bounds
1073-
tv = jl_new_typevar(tv->name, bounds[2*i], bounds[2*i+1]);
1074-
JL_GC_PUSH1(&tv);
1070+
// TODO: pass a new version of `tv` containing the instantiated bounds
10751071
jl_type_error_rt(jl_symbol_name(tn->name), jl_symbol_name(tv->name), (jl_value_t*)tv, params[i]);
10761072
}
10771073
int j;
1078-
for (j = 2*i + 2; j < 2*np; j++) {
1079-
jl_value_t *bj = bounds[j];
1074+
for(j=2*i+2; j < 2*np; j++) {
1075+
jl_value_t*bj = bounds[j];
10801076
if (bj != (jl_value_t*)jl_any_type && bj != jl_bottom_type)
10811077
bounds[j] = jl_substitute_var(bj, tv, params[i]);
10821078
}

test/errorshow.jl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ let
271271
@test occursin("column vector", err_str)
272272
end
273273

274-
struct TypeWithIntParam{T<:Integer, Vector{T}<:A<:AbstractArray{T}} end
274+
struct TypeWithIntParam{T <: Integer} end
275275
struct Bounded # not an AbstractArray
276276
bound::Int
277277
end
@@ -315,14 +315,8 @@ let undefvar
315315
@test err_str == "TypeError: in Type, in parameter, expected Type, got a value of type String"
316316
err_str = @except_str TypeWithIntParam{Any} TypeError
317317
@test err_str == "TypeError: in TypeWithIntParam, in T, expected T<:Integer, got Type{Any}"
318-
err_str = @except_str TypeWithIntParam{Int64,Vector{Float64}} TypeError
319-
@test err_str == "TypeError: in TypeWithIntParam, in A, expected Vector{Int64}<:A<:(AbstractArray{Int64}), got Type{Vector{Float64}}"
320-
err_str = @except_str TypeWithIntParam{Int64}{Vector{Float64}} TypeError
321-
@test err_str == "TypeError: in TypeWithIntParam, in A, expected Vector{Int64}<:A<:(AbstractArray{Int64}), got Type{Vector{Float64}}"
322318
err_str = @except_str Type{Vararg} TypeError
323319
@test err_str == "TypeError: in Type, in parameter, expected Type, got Vararg"
324-
err_str = @except_str Ref{Vararg} TypeError
325-
@test err_str == "TypeError: in Type, in parameter, expected Type, got Vararg"
326320

327321
err_str = @except_str mod(1,0) DivideError
328322
@test err_str == "DivideError: integer division error"

0 commit comments

Comments
 (0)