Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 0.6 abstract and primitive type declaration depwarn #132

Merged
merged 1 commit into from
Feb 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
julia 0.4
HDF5
Compat 0.8.0
Compat 0.17.0
FileIO
LegacyStrings # for julia-0.5
5 changes: 4 additions & 1 deletion src/jld_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,10 @@ function reconstruct_type(parent::JldFile, dtype::HDF5Datatype, savedname::Abstr
@eval (immutable $name; end; $name)
else
sz = Int(HDF5.h5t_get_size(dtype.id))*8
@eval (bitstype $sz $name; $name)
# The new line between `$name` and `$sz` for the `$sz` to be parsed correctly
# on 0.4 and 0.5
@eval (@compat primitive type $name
$sz end; $name)
end
else
# Figure out field names and types
Expand Down
14 changes: 8 additions & 6 deletions test/jldtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ immutable ObjWithPointer
a::Ptr{Void}
end
objwithpointer = ObjWithPointer(0)
# Custom BitsType (#99)
bitstype 64 MyBT
# Custom PrimitiveType (#99)
@compat primitive type MyBT 64 end
bt = reinterpret(MyBT, Int64(55))
# Symbol arrays (#100)
sa_asc = [:a, :b]
Expand Down Expand Up @@ -216,7 +216,7 @@ Abig = kron(eye(10), rand(20,20))
Bbig = Any[i for i=1:3000]
Sbig = "A test string "^1000

# Bitstype type parameters
# Bits type type parameters
type BitsParams{x}; end
bitsparamfloat = BitsParams{1.0}()
bitsparambool = BitsParams{true}()
Expand Down Expand Up @@ -354,9 +354,10 @@ fn = joinpath(tempdir(),"test.jld")

# Issue #106
module Mod106
bitstype 64 Typ{T}
using Compat: @compat
@compat primitive type Typ{T} 64 end
typ{T}(x::Int64, ::Type{T}) = reinterpret(Typ{T}, x)
abstract UnexportedT
@compat abstract type UnexportedT end
end


Expand Down Expand Up @@ -799,6 +800,7 @@ end # compress in (false,true)

# mismatched and missing types
module JLDTemp1
using Compat: @compat
using JLD
import ..fn, Core.Intrinsics.box

Expand All @@ -819,7 +821,7 @@ type TestType5
x::TestType4
end
type TestType6 end
bitstype 8 TestType7
@compat primitive type TestType7 8 end
immutable TestType8
a::TestType4
b::TestType5
Expand Down