Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
Update to latest Julia master
Browse files Browse the repository at this point in the history
Fix of JuliaLang/julia#11840 incorporated.

Julia regression uncovered in tests:
JuliaLang/julia#12826
  • Loading branch information
mauro3 committed Aug 27, 2015
1 parent eb9d7d3 commit 38e8781
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
6 changes: 1 addition & 5 deletions src/base_fixes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

export indextype

# This just redefines isbits as is, because of a strange bug:
# https://github.com/JuliaLang/julia/issues/11840
Base.isbits(t::TypeConstructor) = false

# https://github.com/JuliaLang/julia/issues/10178#issuecomment-74136186
println(" This warning is ok:")
function Core.Inference.func_for_method(m::Method, tt, env)
Expand All @@ -32,7 +28,7 @@ indextype(t::DataType) = eltype(super(t))

indextype(::Any) = Int # fall back...

println(" endof ok-warning.")
println(" endof ok-warnings.")


# iterate over Tuple. Remove after merge of https://github.com/JuliaLang/julia/pull/11547
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ using Traits
check_return_types(true) # should test both true & false
## BUG flags: set to false once fixed to activate tests
# Julia issues:
method_exists_bug1 = false # see https://github.com/JuliaLang/julia/issues/8959
method_exists_bug2 = false # see https://github.com/JuliaLang/julia/issues/9043 and https://github.com/mauro3/Traits.jl/issues/2
# these two are not relevant anymore as method_exists is not used anymore

jl_issue_12826 = true # https://github.com/JuliaLang/julia/issues/12826 return_types regression


return_types_bug1 = true # see Pr0 in traitdef.jl

Expand Down
12 changes: 5 additions & 7 deletions test/traitdef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ end
#coll = [Vector, Vector{Int}, Dict{Int}, Dict{Int,Int}, Set{Int}]
coll = [Vector{Int}, Dict{Int,Int}, Set{Int}]
iter = [Traits.GenerateTypeVars{:upcase}, Int] #todo: add String,
if method_exists_bug1
dicts = [] #todo add again: Dict{Int,Int}] # , ObjectIdDict]
else
dicts = [Dict{Int,Int}] # Dict and Dict{Int} does not work, ObjectIdDict does not fulfill the trait
end
dicts = [Dict{Int,Int}] # Dict and Dict{Int} does not work, ObjectIdDict does not fulfill the trait
index = [Array{Int,2}, StepRange{Int,Int}]
c=1
for c in coll
Expand Down Expand Up @@ -195,8 +191,10 @@ end
fn76{I<:Integer}(X, Vector{I}) -> I
end
fn76{I<:Integer}(x::Uint8, v::Vector{I}) = v[x]
if method_exists_bug2
@test !istrait(Pr1{UInt8})
if jl_issue_12826
check_return_types(false)
@test istrait(Pr1{UInt8})
check_return_types(true)
else
@test istrait(Pr1{UInt8})
end
Expand Down
14 changes: 6 additions & 8 deletions test/traitfns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,12 @@ a = yt1(5,6)
@traitfn xt1{X<:Int,Y<:FloatingPoint; Arith{X,Y}}(x::X,y::Y) = x-y
@test_throws MethodError xt1(5,6)

if !(method_exists_bug1)
od = ObjectIdDict(); od[5]=8
@traitfn yt1{X,Y; IsAssociative{X}}(x::X,y::Y) = x==y
@test yt1(Dict(5=>7), Dict(5=>8))==false
@traitfn xt1{X<:Dict,Y<:ObjectIdDict; IsAssociative{X}}(x::X,y::Y) = x==y
@test xt1(Dict(5=>7), od)==false
@test_throws MethodError xt1(od, od)
end
od = ObjectIdDict(); od[5]=8
@traitfn yt1{X,Y; IsAssociative{X}}(x::X,y::Y) = x==y
@test yt1(Dict(5=>7), Dict(5=>8))==false
@traitfn xt1{X<:Dict,Y<:ObjectIdDict; IsAssociative{X}}(x::X,y::Y) = x==y
@test xt1(Dict(5=>7), od)==false
@test_throws MethodError xt1(od, od)

# mixing with normal methods:
xt1(x::Int, y::Int) = 77
Expand Down

0 comments on commit 38e8781

Please sign in to comment.