Skip to content

Commit

Permalink
fix type problem that was plaguing #7147
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jun 9, 2014
1 parent 2935fd4 commit e97bb5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ static int jl_has_typevars__(jl_value_t *v, int incl_wildcard, jl_tuple_t *p)

static 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);
}

Expand All @@ -140,6 +141,7 @@ static int jl_has_typevars_from(jl_value_t *v, jl_tuple_t *p)

int jl_has_typevars(jl_value_t *v)
{
if (jl_is_typevar(v)) return 1;
return jl_has_typevars__(v, 0, NULL);
}

Expand Down
7 changes: 7 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ end
@test typeintersect(Type{(Int...)}, Type{(Bool...)}) === None
@test typeintersect((Bool,Int...), (Bool...)) === (Bool,)

let T = TypeVar(:T,Union(Float32,Float64))
@test typeintersect(AbstractArray, Matrix{T}) == Matrix{T}
end
let T = TypeVar(:T,Union(Float32,Float64),true)
@test typeintersect(AbstractArray, Matrix{T}) == Matrix{T}
end

@test isa(Int,Type{TypeVar(:T,Number)})
@test !isa(DataType,Type{TypeVar(:T,Number)})
@test DataType <: Type{TypeVar(:T,Type)}
Expand Down

1 comment on commit e97bb5e

@mbauman
Copy link
Member

@mbauman mbauman commented on e97bb5e Jun 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wild. Thanks!

Please sign in to comment.