Skip to content

Commit

Permalink
fix #10165, which gives wrong method for eltype(AbstractArray{Int})
Browse files Browse the repository at this point in the history
regression watch: this is a risky commit. seems crazy, but all the tests
pass so let's see what happens.

this really needs #8974 to be fixed properly
  • Loading branch information
JeffBezanson committed Feb 12, 2015
1 parent 3757424 commit 34dbb0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,8 @@ int jl_is_leaf_type(jl_value_t *v)
{
if (jl_is_datatype(v)) {
if (((jl_datatype_t*)v)->abstract) {
if (jl_is_type_type(v)) {
jl_value_t *tp0 = jl_tparam0(v);
return (jl_is_datatype(tp0) && is_unspec((jl_datatype_t*)tp0)) ||
!jl_has_typevars_(tp0,1);
}
if (jl_is_type_type(v))
return !jl_is_typevar(jl_tparam0(v));
return 0;
}
jl_tuple_t *t = ((jl_datatype_t*)v)->parameters;
Expand Down
6 changes: 6 additions & 0 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ end
@test isbits(Float32)
@test isbits(Int)
@test !isbits(AbstractString)

# issue #10165
i10165(::DataType) = 0
i10165{T,n}(::Type{AbstractArray{T,n}}) = 1
@test i10165(AbstractArray{Int}) == 0
@test which(i10165, (Type{AbstractArray{Int}},)).sig == (DataType,)

0 comments on commit 34dbb0f

Please sign in to comment.