Skip to content

Commit

Permalink
make TypeVar not a Type. fixes #10778
Browse files Browse the repository at this point in the history
This is how things were in 0.3. The change was an experiment that didn't work out.
  • Loading branch information
JeffBezanson committed Apr 19, 2015
1 parent 39c9d1b commit 3074b70
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function complete_methods(ex_org::Expr)
t_in = Tuple{args_ex...} # Input types
for method in methods(func)
# Check if the method's type signature intersects the input types
typeintersect(Tuple{method.sig.parameters[1 : min(length(args_ex), end)]...}, t_in) != None &&
typeintersect(Tuple{method.sig.parameters[1 : min(length(args_ex), end)]...}, t_in) != Union() &&
push!(out,string(method))
end
return out
Expand Down
6 changes: 3 additions & 3 deletions base/replutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function show_method_candidates(io::IO, ex::MethodError)
show_delim_array(buf, tv, '{', ',', '}', false)
end
print(buf, "(")
t_i = [Base.REPLCompletions.method_type_of_arg(arg) for arg in ex.args]
t_i = Any[Base.REPLCompletions.method_type_of_arg(arg) for arg in ex.args]
right_matches = 0
for i = 1 : min(length(t_i), length(sig))
i > (use_constructor_syntax ? 2 : 1) && print(buf, ", ")
Expand All @@ -221,10 +221,10 @@ function show_method_candidates(io::IO, ex::MethodError)
t_in = typeintersect(Tuple{sig[1:i]...}, Tuple{t_i[1:j]...})
# If the function is one of the special cased then it should break the loop if
# the type of the first argument is not matched.
t_in == None && special && i == 1 && break
t_in === Union() && special && i == 1 && break
if use_constructor_syntax && i == 1
right_matches += i
elseif t_in == None
elseif t_in === Union()
if Base.have_color
Base.with_output_color(:red, buf) do buf
print(buf, "::$sigstr")
Expand Down
2 changes: 1 addition & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ static jl_tupletype_t *arg_type_tuple(jl_value_t **args, size_t nargs)
size_t i;
for(i=0; i < nargs; i++) {
jl_value_t *ai = args[i];
if (!jl_is_typevar(ai) && jl_is_type(ai))
if (jl_is_type(ai))
types[i] = (jl_value_t*)jl_wrap_Type(ai);
else
types[i] = jl_typeof(ai);
Expand Down
6 changes: 3 additions & 3 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int jl_is_type(jl_value_t *v)
{
jl_value_t *t = jl_typeof(v);
return (t == (jl_value_t*)jl_datatype_type || t == (jl_value_t*)jl_uniontype_type ||
t == (jl_value_t*)jl_typector_type || t == (jl_value_t*)jl_tvar_type);
t == (jl_value_t*)jl_typector_type);
}

STATIC_INLINE int is_unspec(jl_datatype_t *dt)
Expand Down Expand Up @@ -1328,7 +1328,7 @@ static int solve_tvar_constraints(cenv_t *env, cenv_t *soln)
S = m;
}
}
if (jl_is_type(S)) {
if (jl_is_type(S) || jl_is_typevar(S)) {
if (!jl_is_typevar(S) && !jl_is_leaf_type(S) && S != jl_bottom_type) {
S = (jl_value_t*)jl_new_typevar(underscore_sym,
(jl_value_t*)jl_bottom_type, S);
Expand Down Expand Up @@ -3050,7 +3050,7 @@ void jl_init_types(void)
jl_bottom_type = (jl_value_t*)jl_new_struct(jl_uniontype_type, jl_emptysvec);

jl_tvar_type = jl_new_datatype(jl_symbol("TypeVar"),
jl_type_type, jl_emptysvec,
jl_any_type, jl_emptysvec,
jl_svec(4, jl_symbol("name"),
jl_symbol("lb"), jl_symbol("ub"),
jl_symbol("bound")),
Expand Down

0 comments on commit 3074b70

Please sign in to comment.