@@ -119,6 +119,12 @@ for a1 in arith
119
119
end
120
120
121
121
# # test trait definition
122
+ @traitdef FF{X} begin
123
+ f948576 ()
124
+ end
125
+ @test ! istrait (FF{Int})
126
+ f948576 () = 1
127
+ @test istrait (FF{Int})
122
128
123
129
@traitdef Tr20{X} begin
124
130
length (X) -> Bool
@@ -297,25 +303,36 @@ AssocIsBits{T3484675{Int,4.5,:a}}()
297
303
# ###
298
304
# DataType constructors
299
305
# ###
300
-
301
- @traitdef TT45{D} begin
302
- # This trait contains all datatypes which have a constructor with
303
- # no arguments.
304
- D () -> D
305
- end
306
- type A4758 end
307
- type A4759
308
- a
309
- end
310
-
311
- @test istrait (TT45{A4758})
312
- @test ! istrait (TT45{A4759})
313
- @test istrait (TT45{Dict{Int,Int}})
314
- @test istrait (TT45{Set{Int}})
315
- @test ! istrait (TT45{Int})
316
- @test ! istrait (TT45{Array{Int,1 }})
317
-
318
- if varag_not_supported_bug
306
+ if ! constructors_not_supported_bug
307
+ @traitdef TT45{D} begin
308
+ # This trait contains all datatypes which have a constructor with
309
+ # no arguments.
310
+ D () -> D
311
+ end
312
+ type A4758 end
313
+ type A4759
314
+ a
315
+ end
316
+
317
+ @test istrait (TT45{A4758})
318
+ @test ! istrait (TT45{A4759})
319
+ @test istrait (TT45{Dict{Int,Int}})
320
+ @test istrait (TT45{Set{Int}})
321
+ @test ! istrait (TT45{Int})
322
+ @test ! istrait (TT45{Array{Int,1 }})
323
+
324
+ @traitdef TT44{D} begin
325
+ #
326
+ Array (D,Any)
327
+ end
328
+ @test istrait (TT44{A4758})
329
+ @test istrait (TT44{A4759})
330
+ @test istrait (TT44{Dict{Int,Int}})
331
+ @test istrait (TT44{Set{Int}})
332
+ @test istrait (TT44{Int})
333
+ @test istrait (TT44{Array{Int,1 }})
334
+
335
+ if ! varag_not_supported_bug
319
336
# This is the trait for datatypes with Array like constructors:
320
337
@traitdef TT46{Ar} begin
321
338
T = Type{eltype (Ar)}
@@ -339,3 +356,5 @@ if varag_not_supported_bug
339
356
# @test istrait(TT46{Array{Int}}, verbose=true) # this does not pass currently because of https://github.com/JuliaLang/julia/issues/10642
340
357
@test istrait (TT46{Array}, verbose= true )
341
358
end
359
+
360
+ end # !constructors_not_supported_bug
0 commit comments