Skip to content

Commit

Permalink
Fix tests on nightly
Browse files Browse the repository at this point in the history
`numsToZero` relies on being able to sample arbitrary `AbstractFloat`
with `rand`, which seemingly isn't possible with the new `Core.BFloat16`
introduced in JuliaLang/julia#51470.
See JuliaLang/julia#53651 for the upstream
issue tracking this.

1.11 also introduces `AnnotatedString`, which interacts badly
with the local scope of `@testset` and trying to lazily `join`
things that may degenerate in inference to `AbstractString`. The type
assertion is a quick "fix", since other than moving `irb` outside of
that scope, inference will continue to mess with the test,
even though no `AnnotatedString` could ever actually be produced.
  • Loading branch information
Seelengrab committed Mar 8, 2024
1 parent ef65810 commit 7e3cbc1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ const numTypes = union(getSubtypes(Integer), getSubtypes(AbstractFloat))
@testset "numsToZero" begin
@testset "$T" for T in numTypes
if VERSION >= v"1.7"
@test numsToZero(T) broken=(T == BigInt || T == BigFloat)
@test numsToZero(T) broken=(T == BigInt || T == BigFloat || T == Core.BFloat16)
else
# we don't need to add Core.BFloat16 here, since it was only added in 1.11
if T != BigInt && T != BigFloat
@test numsToZero(T)
end
Expand Down Expand Up @@ -424,7 +425,8 @@ const numTypes = union(getSubtypes(Integer), getSubtypes(AbstractFloat))
foocount_correct(s) = 2*count(==('f'), s) == count(==('o'), s)
@testset "with Choice" begin
irb = PC.IntegratedBoundedRec{String}(10);
a = map(join, interleave(ival("foo", PC.noshrink), irb))
# this needs a type assertion because `irb` is not a `const`...
a = map(col -> join(col)::String, interleave(ival("foo", PC.noshrink), irb))
b = PC.IntegratedChoice(a, a, a, a, a, ival("bar", PC.noshrink))
PC.bind!(irb, b)
@test check(foocount_correct, b)
Expand Down

0 comments on commit 7e3cbc1

Please sign in to comment.