From 72f3477164655d10e6f2db397386fd32684c2efe Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Fri, 23 Oct 2015 12:24:40 -0400 Subject: [PATCH] fix #13299, overly pessimistic code for constructing an abstract type --- base/inference.jl | 4 ++-- src/jltypes.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/inference.jl b/base/inference.jl index 5943b27231c0b4..86f7df7e053c1e 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -371,7 +371,7 @@ function extract_simple_tparam(Ai) return Bottom end -has_typevars(t::ANY) = ccall(:jl_has_typevars, Cint, (Any,), t)!=0 +has_typevars(t::ANY, all=false) = ccall(:jl_has_typevars_, Cint, (Any,Cint), t, all)!=0 # TODO: handle e.g. apply_type(T, R::Union{Type{Int32},Type{Float64}}) const apply_type_tfunc = function (A, args...) @@ -2283,7 +2283,7 @@ function inlineable(f::ANY, e::Expr, atype::ANY, sv::StaticVarInfo, enclosing_as if (is(f,apply_type) || is(f,fieldtype) || istopfunction(topmod, f, :typejoin) || istopfunction(topmod, f, :promote_type)) && - isleaftype(e.typ.parameters[1]) + !has_typevars(e.typ.parameters[1],true) return (e.typ.parameters[1],()) end end diff --git a/src/jltypes.c b/src/jltypes.c index 6580ef6ca6873d..d97da39334fbc8 100644 --- a/src/jltypes.c +++ b/src/jltypes.c @@ -122,7 +122,7 @@ static int jl_has_typevars__(jl_value_t *v, int incl_wildcard, jl_value_t **p, s return 0; } -static int jl_has_typevars_(jl_value_t *v, int incl_wildcard) +DLLEXPORT int jl_has_typevars_(jl_value_t *v, int incl_wildcard) { if (jl_is_typevar(v)) return 1; return jl_has_typevars__(v, incl_wildcard, NULL, 0);