Skip to content

Commit

Permalink
add tests for issues #10207, #10178, #12939
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Apr 10, 2017
1 parent df2438c commit cbc32a5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@ _bound_vararg_specificity_1{T}(::Type{Array{T,1}}, d::Int) = 1
@test _bound_vararg_specificity_1(Array{Int,1}, 1) == 1
@test _bound_vararg_specificity_1(Array{Int,2}, 1, 1) == 0

# issue #12939
module Issue12939
abstract type Abs; end
struct Foo <: Abs; end
struct Bar; val::Int64; end
struct Baz; val::Int64; end
f{T}(::Type{T}, x::T) = T(3)
f{T <: Abs}(::Type{Bar}, x::T) = Bar(2)
f(::Type{Bar}, x) = Bar(1)
f(::Type{Baz}, x) = Baz(1)
f{T <: Abs}(::Type{Baz}, x::T) = Baz(2)
end

@test Issue12939.f(Issue12939.Baz,Issue12939.Foo()) === Issue12939.Baz(2)
@test Issue12939.f(Issue12939.Bar,Issue12939.Foo()) === Issue12939.Bar(2)

# issue #11840
TT11840{T} = Tuple{T,T}
f11840(::Type) = "Type"
Expand Down
7 changes: 7 additions & 0 deletions test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -738,3 +738,10 @@ let e = code_typed(f21175, ())[1].first.code[1]::Expr
@test e.head === :return
@test e.args[1] == Core.QuoteNode(902221)
end

# issue #10207
type T10207{A, B}
a::A
b::B
end
@test code_typed(T10207, (Int,Any))[1].second == T10207{Int,T} where T
12 changes: 12 additions & 0 deletions test/staged.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,15 @@ end

# issue #19897
@test code_lowered(staged_t1, (Int,Int)) isa Array # check no error thrown

# issue #10178
@generated function f10178(x::X) where X
:(x)
end
g10178(x) = f10178(x)
@test g10178(5) == 5
@generated function f10178(x::X) where X
:(2x)
end
g10178(x) = f10178(x)
@test g10178(5) == 10

0 comments on commit cbc32a5

Please sign in to comment.