@@ -2,7 +2,7 @@ push!(LOAD_PATH, joinpath(@__DIR__, "pkgs", "PiracyForeignProject"))
22
33baremodule PiracyModule
44
5- using PiracyForeignProject: ForeignType, ForeignParameterizedType
5+ using PiracyForeignProject: ForeignType, ForeignParameterizedType, ForeignNonSingletonType
66
77using Base:
88 Base,
@@ -44,6 +44,8 @@ export MyUnion
4444Base. findfirst (:: Set{Vector{Char}} , :: Int ) = 1
4545Base. findfirst (:: Union{Foo,Bar{Set{Unsigned}},UInt} , :: Tuple{Vararg{String}} ) = 1
4646Base. findfirst (:: AbstractChar , :: Set{T} ) where {Int <: T <: Integer } = 1
47+ (:: ForeignType )(x:: Int8 ) = x + 1
48+ (:: ForeignNonSingletonType )(x:: Int8 ) = x + 1
4749
4850# Piracy, but not for `ForeignType in treat_as_own`
4951Base. findmax (:: ForeignType , x:: Int ) = x + 1
7577# 1 from MyUnion
7678# 6 from findlast
7779# 3 from findfirst
80+ # 1 from ForeignType
81+ # 1 from ForeignNonSingletonType
7882# 3 from findmax
7983# 3 from findmin
80- @test length (meths) == 2 + 2 + 1 + 6 + 3 + 3 + 3
84+ @test length (meths) == 2 + 2 + 1 + 6 + 3 + 1 + 1 + 3 + 3
8185
8286# Test what is foreign
8387BasePkg = Base. PkgId (Base)
@@ -91,22 +95,22 @@ ThisPkg = Base.PkgId(PiracyModule)
9195
9296# Test what is pirate
9397pirates = filter (m -> Piracy. is_pirate (m), meths)
94- @test length (pirates) == 3 + 3 + 3
95- @test all (pirates) do m
98+ @test length (pirates) == 3 + 3 + 3 + 1 + 1
99+ @test_broken all (pirates) do m
96100 m. name in [:findfirst , :findmax , :findmin ]
97101end
98102
99103# Test what is pirate (with treat_as_own=[ForeignType])
100104pirates = filter (m -> Piracy. is_pirate (m; treat_as_own = [ForeignType]), meths)
101- @test length (pirates) == 3 + 3
102- @test all (pirates) do m
105+ @test_broken length (pirates) == 3 + 3
106+ @test_broken all (pirates) do m
103107 m. name in [:findfirst , :findmin ]
104108end
105109
106110# Test what is pirate (with treat_as_own=[ForeignParameterizedType])
107111pirates = filter (m -> Piracy. is_pirate (m; treat_as_own = [ForeignParameterizedType]), meths)
108- @test length (pirates) == 3 + 3
109- @test all (pirates) do m
112+ @test_broken length (pirates) == 3 + 3
113+ @test_broken all (pirates) do m
110114 m. name in [:findfirst , :findmax ]
111115end
112116
@@ -115,16 +119,16 @@ pirates = filter(
115119 m -> Piracy. is_pirate (m; treat_as_own = [ForeignType, ForeignParameterizedType]),
116120 meths,
117121)
118- @test length (pirates) == 3
119- @test all (pirates) do m
122+ @test_broken length (pirates) == 3
123+ @test_broken all (pirates) do m
120124 m. name in [:findfirst ]
121125end
122126
123127# Test what is pirate (with treat_as_own=[Base.findfirst, Base.findmax])
124128pirates =
125129 filter (m -> Piracy. is_pirate (m; treat_as_own = [Base. findfirst, Base. findmax]), meths)
126- @test length (pirates) == 3
127- @test all (pirates) do m
130+ @test_broken length (pirates) == 3
131+ @test_broken all (pirates) do m
128132 m. name in [:findmin ]
129133end
130134
@@ -136,4 +140,4 @@ pirates = filter(
136140 ),
137141 meths,
138142)
139- @test length (pirates) == 0
143+ @test_broken length (pirates) == 0
0 commit comments