Skip to content

Commit 3c8a525

Browse files
committed
Fix deprecated type declaration syntax.
Ref JuliaLang/julia#20418
1 parent 7feddb6 commit 3c8a525

File tree

8 files changed

+17
-13
lines changed

8 files changed

+17
-13
lines changed

REQUIRE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
julia 0.5
2-
Compat 0.9.5
2+
Compat 0.17.0

src/core.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# other related types and utilities.
33

44
# forward-declarations
5-
@reftypedef abstract User <: Value
6-
@reftypedef abstract Constant <: User
7-
@reftypedef abstract GlobalValue <: Constant
8-
@reftypedef abstract GlobalObject <: GlobalValue
5+
@reftypedef @compat abstract type User <: Value end
6+
@reftypedef @compat abstract type Constant <: User end
7+
@reftypedef @compat abstract type GlobalValue <: Constant end
8+
@reftypedef @compat abstract type GlobalObject <: GlobalValue end
99
@reftypedef proxy=Value kind=LLVMFunctionValueKind immutable Function <: GlobalObject end
1010
@reftypedef proxy=Value kind=LLVMBasicBlockValueKind immutable BasicBlock <: Value end
1111

src/core/attributes.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export Attribute,
55
EnumAttribute, StringAttribute,
66
kind, value
77

8-
@reftypedef ref=LLVMAttributeRef abstract Attribute
8+
@reftypedef ref=LLVMAttributeRef @compat abstract type Attribute end
99

1010
@reftypedef proxy=Attribute immutable EnumAttribute <: Attribute end
1111

src/core/type.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ width(inttyp::IntegerType) = API.LLVMGetIntTypeWidth(ref(inttyp))
5050

5151
# NOTE: this type doesn't exist in the LLVM API,
5252
# we add it for convenience of typechecking generic values (see execution.jl)
53-
@reftypedef abstract FloatingPointType <: LLVMType
53+
@reftypedef @compat abstract type FloatingPointType <: LLVMType end
5454

5555
# NOTE: we don't handle the obscure types here (:X86FP80, :FP128, :PPCFP128),
5656
# they would also need special casing as LLVMPPCFP128Type != LLVMPPC_FP128TypeKind
@@ -96,14 +96,14 @@ end
9696

9797
## composite types
9898

99-
@reftypedef abstract CompositeType <: LLVMType
99+
@reftypedef @compat abstract type CompositeType <: LLVMType end
100100

101101

102102
## sequential types
103103

104104
export addrspace
105105

106-
@reftypedef abstract SequentialType <: CompositeType
106+
@reftypedef @compat abstract type SequentialType <: CompositeType end
107107

108108
import Base: length, size, eltype
109109

src/pass.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export Pass
22

3-
abstract Pass
3+
@compat abstract type Pass end
44

55

66
#

src/passmanager.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export PassManager,
22
add!, dispose
33

4-
abstract PassManager
4+
@compat abstract type PassManager end
55

66
add!(pm::PassManager, pass::Pass) =
77
API.LLVMAddPass(ref(pm), ref(pass))

src/types.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## forward declarations
22
# TODO: LLVM.Type once JuliaLang/Julia#18756 is backported
3-
@reftypedef ref=LLVMTypeRef enum=LLVMTypeKind abstract LLVMType
4-
@reftypedef ref=LLVMValueRef enum=LLVMValueKind abstract Value
3+
@reftypedef ref=LLVMTypeRef enum=LLVMTypeKind @compat abstract type LLVMType end
4+
@reftypedef ref=LLVMValueRef enum=LLVMValueKind @compat abstract type Value end
55
@reftypedef ref=LLVMModuleRef immutable Module end
66
@reftypedef ref=LLVMTargetDataRef immutable DataLayout end
77

src/util.jl

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ macro reftypedef(args...)
2323
typedef = args[end]
2424

2525
# decode type definition
26+
if typedef.head == :macrocall
27+
# handle `@compat` prefixing 0.6-style type declarations
28+
typedef = macroexpand(typedef)
29+
end
2630
if typedef.head == :abstract
2731
structure = typedef.args[1]
2832
elseif typedef.head == :type

0 commit comments

Comments
 (0)