@@ -100,7 +100,7 @@ type UnionAllT <: Ty
100
100
var:: Var
101
101
T
102
102
UnionAllT (v:: Var , t) = new (v, t)
103
- UnionAllT (v:: Var , t:: Union( Type,Tuple) ) = new (v, convert (Ty, t))
103
+ UnionAllT (v:: Var , t:: Union{ Type,Tuple} ) = new (v, convert (Ty, t))
104
104
end
105
105
106
106
function show (io:: IO , x:: UnionAllT )
@@ -313,7 +313,7 @@ function issub(a::Var, b::Var, env)
313
313
end
314
314
end
315
315
316
- function var_lt (b:: Var , a:: Union( Ty,Var) , env)
316
+ function var_lt (b:: Var , a:: Union{ Ty,Var} , env)
317
317
env. outer = false
318
318
bb = env. vars[b]
319
319
# println("$b($(bb.lb),$(bb.ub)) <: $a")
@@ -327,7 +327,7 @@ function var_lt(b::Var, a::Union(Ty,Var), env)
327
327
return true
328
328
end
329
329
330
- function var_gt (b:: Var , a:: Union( Ty,Var) , env)
330
+ function var_gt (b:: Var , a:: Union{ Ty,Var} , env)
331
331
env. outer = false
332
332
bb = env. vars[b]
333
333
# println("$b($(bb.lb),$(bb.ub)) >: $a")
@@ -451,15 +451,15 @@ function xlate(t::DataType, env)
451
451
inst (tn, map (x-> xlate (x,env), t. parameters)... )
452
452
end
453
453
454
- convert (:: Type{Ty} , t:: Union( Type,Tuple) ) = xlate (t)
454
+ convert (:: Type{Ty} , t:: Union{ Type,Tuple} ) = xlate (t)
455
455
convert (:: Type{Ty} , t:: TypeVar ) = xlate (t)
456
456
457
- issub (a:: Union( Type,Tuple) , b:: Union( Type,Tuple) ) = issub (xlate (a), xlate (b))
458
- issub (a:: Ty , b:: Union( Type,Tuple) ) = issub (a , xlate (b))
459
- issub (a:: Union( Type,Tuple) , b:: Ty ) = issub (xlate (a), b)
460
- issub_env (a:: Union( Type,Tuple) , b:: Union( Type,Tuple) ) = issub_env (xlate (a), xlate (b))
461
- issub_env (a:: Ty , b:: Union( Type,Tuple) ) = issub_env (a , xlate (b))
462
- issub_env (a:: Union( Type,Tuple) , b:: Ty ) = issub_env (xlate (a), b)
457
+ issub (a:: Union{ Type,Tuple} , b:: Union{ Type,Tuple} ) = issub (xlate (a), xlate (b))
458
+ issub (a:: Ty , b:: Union{ Type,Tuple} ) = issub (a , xlate (b))
459
+ issub (a:: Union{ Type,Tuple} , b:: Ty ) = issub (xlate (a), b)
460
+ issub_env (a:: Union{ Type,Tuple} , b:: Union{ Type,Tuple} ) = issub_env (xlate (a), xlate (b))
461
+ issub_env (a:: Ty , b:: Union{ Type,Tuple} ) = issub_env (a , xlate (b))
462
+ issub_env (a:: Union{ Type,Tuple} , b:: Ty ) = issub_env (xlate (a), b)
463
463
464
464
tt (ts... ) = Tuple{ts... }
465
465
vt (ts... ) = Tuple{ts[1 : end - 1 ]. .. , Vararg{ts[end ]}}
@@ -687,17 +687,17 @@ end
687
687
function test_4 ()
688
688
@test isequal_type (UnionT (BottomT,BottomT), BottomT)
689
689
690
- @test issub_strict (Int, Union ( Int,String) )
691
- @test issub_strict (Union ( Int,Int8) , Integer)
690
+ @test issub_strict (Int, Union{ Int,String} )
691
+ @test issub_strict (Union{ Int,Int8} , Integer)
692
692
693
- @test isequal_type (Union ( Int,Int8) , Union ( Int,Int8) )
693
+ @test isequal_type (Union{ Int,Int8} , Union{ Int,Int8} )
694
694
695
695
@test isequal_type (UnionT (Ty (Int),Ty (Integer)), Ty (Integer))
696
696
697
- @test isequal_type (tt (Union ( Int,Int8) ,Int16), Union ( tt (Int,Int16),tt (Int8,Int16)) )
697
+ @test isequal_type (tt (Union{ Int,Int8} ,Int16), Union{ tt (Int,Int16),tt (Int8,Int16)} )
698
698
699
- @test issub_strict ((Int,Int8,Int), vt (Union ( Int,Int8) ,))
700
- @test issub_strict ((Int,Int8,Int), vt (Union ( Int,Int8,Int16) ,))
699
+ @test issub_strict ((Int,Int8,Int), vt (Union{ Int,Int8} ,))
700
+ @test issub_strict ((Int,Int8,Int), vt (Union{ Int,Int8,Int16} ,))
701
701
702
702
# nested unions
703
703
@test ! issub (UnionT (Ty (Int),inst (RefT,UnionT (Ty (Int),Ty (Int8)))),
@@ -729,24 +729,24 @@ end
729
729
730
730
# level 5: union and UnionAll
731
731
function test_5 ()
732
- u = Ty (Union ( Int8,Int) )
732
+ u = Ty (Union{ Int8,Int} )
733
733
734
734
@test issub (Ty ((String,Array{Int,1 })),
735
735
(@UnionAll T UnionT (tupletype (T,inst (ArrayT,T,1 )),
736
736
tupletype (T,inst (ArrayT,Ty (Int),1 )))))
737
737
738
- @test issub (Ty ((Union ( Vector{Int},Vector{Int8}) ,)),
738
+ @test issub (Ty ((Union{ Vector{Int},Vector{Int8}} ,)),
739
739
@UnionAll T tupletype (inst (ArrayT,T,1 ),))
740
740
741
- @test ! issub (Ty ((Union ( Vector{Int},Vector{Int8}) ,Vector{Int})),
741
+ @test ! issub (Ty ((Union{ Vector{Int},Vector{Int8}} ,Vector{Int})),
742
742
@UnionAll T tupletype (inst (ArrayT,T,1 ), inst (ArrayT,T,1 )))
743
743
744
- @test ! issub (Ty ((Union ( Vector{Int},Vector{Int8}) ,Vector{Int8})),
744
+ @test ! issub (Ty ((Union{ Vector{Int},Vector{Int8}} ,Vector{Int8})),
745
745
@UnionAll T tupletype (inst (ArrayT,T,1 ), inst (ArrayT,T,1 )))
746
746
747
747
@test ! issub (Ty (Vector{Int}), @UnionAll T>: u inst (ArrayT,T,1 ))
748
748
@test issub (Ty (Vector{Integer}), @UnionAll T>: u inst (ArrayT,T,1 ))
749
- @test issub (Ty (Vector{Union ( Int,Int8) }), @UnionAll T>: u inst (ArrayT,T,1 ))
749
+ @test issub (Ty (Vector{Union{ Int,Int8} }), @UnionAll T>: u inst (ArrayT,T,1 ))
750
750
751
751
@test issub ((@UnionAll Ty (Int)<: T <: u inst (ArrayT,T,1 )),
752
752
(@UnionAll Ty (Int)<: T <: u inst (ArrayT,T,1 )))
@@ -832,7 +832,7 @@ function test_6()
832
832
@test ! issub ((@UnionAll i<: T <: i inst (RefT,inst (RefT,T))),
833
833
inst (RefT,@UnionAll T<: i inst (RefT,T)))
834
834
835
- u = Ty (Union ( Int8,Int64) )
835
+ u = Ty (Union{ Int8,Int64} )
836
836
A = inst (RefT,BottomT)
837
837
B = @UnionAll S<: u inst (RefT,S)
838
838
@test issub (inst (RefT,B), @UnionAll A<: T <: B inst (RefT,T))
@@ -864,7 +864,7 @@ const menagerie =
864
864
Any[BottomT, AnyT, Ty (Int), Ty (Int8), Ty (Integer), Ty (Real),
865
865
Ty (Array{Int,1 }), Ty (AbstractArray{Int,1 }),
866
866
Ty (vt (Int,Integer,)), Ty (vt (Integer,Int,)), Ty (()),
867
- Ty (Union ( Int,Int8) ),
867
+ Ty (Union{ Int,Int8} ),
868
868
(@UnionAll T inst (ArrayT, T, 1 )),
869
869
(@UnionAll T inst (PairT,T,T)),
870
870
(@UnionAll T @UnionAll S inst (PairT,T,S)),
0 commit comments