From 3074b708433a170c1749bbb14806b27e3370c579 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sun, 19 Apr 2015 00:12:49 -0400 Subject: [PATCH] make TypeVar not a Type. fixes #10778 This is how things were in 0.3. The change was an experiment that didn't work out. --- base/REPLCompletions.jl | 2 +- base/replutil.jl | 6 +++--- src/gf.c | 2 +- src/jltypes.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/base/REPLCompletions.jl b/base/REPLCompletions.jl index a792d63a081b9..9949a3328806b 100644 --- a/base/REPLCompletions.jl +++ b/base/REPLCompletions.jl @@ -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 diff --git a/base/replutil.jl b/base/replutil.jl index ea58600810076..f303e2fc791cc 100644 --- a/base/replutil.jl +++ b/base/replutil.jl @@ -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, ", ") @@ -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") diff --git a/src/gf.c b/src/gf.c index 916f47c0a7b3a..59b4880ac41d8 100644 --- a/src/gf.c +++ b/src/gf.c @@ -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); diff --git a/src/jltypes.c b/src/jltypes.c index 11e8ac9c67273..ab32307f29c6f 100644 --- a/src/jltypes.c +++ b/src/jltypes.c @@ -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) @@ -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); @@ -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")),