diff --git a/README.md b/README.md index c0c4b40d0..50b8008cd 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `squeeze` with `dims` as keyword argument ([#26660]). +* `fetch` for `Task`s ([#25940]). + * `Compat.qr` takes `pivot` as a `Val` _instance_ and keyword argument `full` ([#22475], [#24279]). * `Compat.rmul!` provides a subset of the functionality of `LinearAlgebra.rmul!` for @@ -618,6 +620,7 @@ includes this fix. Find the minimum version from there. [#25873]: https://github.com/JuliaLang/julia/issues/25873 [#25896]: https://github.com/JuliaLang/julia/issues/25896 [#25935]: https://github.com/JuliaLang/julia/issues/25935 +[#25940]: https://github.com/JuliaLang/julia/issues/25940 [#25959]: https://github.com/JuliaLang/julia/issues/25959 [#25989]: https://github.com/JuliaLang/julia/issues/25989 [#25990]: https://github.com/JuliaLang/julia/issues/25990 diff --git a/src/Compat.jl b/src/Compat.jl index 99dea1564..51b16ae37 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1854,6 +1854,12 @@ elseif VERSION >= v"0.7.0-DEV.3665" # mul1! -> rmul! using LinearAlgebra: rmul! end +@static if VERSION < v"0.7.0-DEV.3936" + Base.fetch(t::Task) = wait(t) +else + import Base: fetch +end + # https://github.com/JuliaLang/julia/pull/27077 @static if VERSION < v"0.7.0-DEV.5087" export isletter diff --git a/test/runtests.jl b/test/runtests.jl index 62412ff00..25d6cae69 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1702,6 +1702,13 @@ let A = [1 2; 3 4] @test Compat.rmul!(Diagonal(A), Diagonal([2, 1])) == Diagonal([8, 120]) end +# 0.7.0-DEV.3936 +@test let ct = current_task(), t = @task true + schedule(ct) + yieldto(t) + fetch(t) +end + # 0.7.0-DEV.5087 @test isletter('a') @test isletter('β')