From 7e3cbc1b4d76137450968ba4c0a3c01b7788a072 Mon Sep 17 00:00:00 2001 From: Sukera Date: Fri, 8 Mar 2024 10:49:59 +0100 Subject: [PATCH] Fix tests on nightly `numsToZero` relies on being able to sample arbitrary `AbstractFloat` with `rand`, which seemingly isn't possible with the new `Core.BFloat16` introduced in https://github.com/JuliaLang/julia/pull/51470. See https://github.com/JuliaLang/julia/issues/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. --- test/runtests.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 8de26bb..aaf39a5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 @@ -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)