Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.

Commit b5560de

Browse files
committed
Fix deprecated inner-constructor syntax.
Ref JuliaLang/julia#20308
1 parent 17d2ea9 commit b5560de

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/array.jl

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ export
66

77
## construction
88

9-
type CuArray{T,N} <: AbstractArray{T,N}
9+
@compat type CuArray{T,N} <: AbstractArray{T,N}
1010
devptr::DevicePtr{T}
1111
shape::NTuple{N,Int}
1212

13-
function CuArray(shape::NTuple{N,Int})
13+
function (::Type{CuArray{T,N}}){T,N}(shape::NTuple{N,Int})
1414
if !isbits(T)
1515
# non-isbits types results in an array with references to CPU objects
1616
throw(ArgumentError("CuArray with non-bit element type not supported"))
@@ -21,15 +21,14 @@ type CuArray{T,N} <: AbstractArray{T,N}
2121
len = prod(shape)
2222
devptr = Mem.alloc(T, len)
2323

24-
obj = new(devptr, shape)
24+
obj = new{T,N}(devptr, shape)
2525
block_finalizer(obj, devptr.ctx)
2626
finalizer(obj, finalize)
2727
return obj
2828
end
2929

30-
function CuArray(shape::NTuple{N,Int}, devptr::DevicePtr{T})
31-
new(devptr, shape)
32-
end
30+
(::Type{CuArray{T,N}}){T,N}(shape::NTuple{N,Int}, devptr::DevicePtr{T}) =
31+
new{T,N}(devptr, shape)
3332
end
3433

3534
(::Type{CuArray{T}}){T,N}(shape::NTuple{N,Int}) = CuArray{T,N}(shape)

src/module/global.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ export
44
CuGlobal, get, set
55

66

7-
immutable CuGlobal{T}
7+
@compat immutable CuGlobal{T}
88
# TODO: typed pointer
99
devptr::DevicePtr{Void}
1010
nbytes::Cssize_t
1111

12-
function CuGlobal(mod::CuModule, name::String)
12+
function (::Type{CuGlobal{T}}){T}(mod::CuModule, name::String)
1313
ptr_ref = Ref{Ptr{Void}}()
1414
nbytes_ref = Ref{Cssize_t}()
1515
@apicall(:cuModuleGetGlobal, (Ptr{Ptr{Void}}, Ptr{Cssize_t}, CuModule_t, Ptr{Cchar}),
@@ -19,7 +19,7 @@ immutable CuGlobal{T}
1919
end
2020
@assert nbytes_ref[] == sizeof(T)
2121

22-
return new(DevicePtr{Void}(ptr_ref[], CuCurrentContext()), nbytes_ref[])
22+
return new{T}(DevicePtr{Void}(ptr_ref[], CuCurrentContext()), nbytes_ref[])
2323
end
2424
end
2525

src/pointer.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export
1010
# It also keep track of the associated context, preventing it from getting freed while
1111
# there's still a pointer from that context live.
1212

13-
immutable DevicePtr{T}
13+
@compat immutable DevicePtr{T}
1414
ptr::Ptr{T}
1515
ctx::CuContext
1616

17-
DevicePtr(ptr::Ptr{T}, ctx::CuContext) = new(ptr,ctx)
17+
(::Type{DevicePtr{T}}){T}(ptr::Ptr{T}, ctx::CuContext) = new{T}(ptr,ctx)
1818
end
1919

2020
function Base.:(==)(a::DevicePtr, b::DevicePtr)

0 commit comments

Comments
 (0)