Skip to content

Commit

Permalink
Fix docs for Experimental.@force_compile (#42760)
Browse files Browse the repository at this point in the history
Also adds a direct test
  • Loading branch information
timholy authored Oct 23, 2021
1 parent 6ab06b8 commit 030a0f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
23 changes: 12 additions & 11 deletions base/experimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,18 @@ Force compilation of the block or function (Julia's built-in interpreter is bloc
# Examples
```
module WithPrecompiles
#=
code definitions
=#
if Sys.iswindows()
Experimental.@compile
compile_me() # `compile_me` will be compiled before execution
end
end
julia> occursin("interpreter", string(stacktrace(begin
# with forced compilation
Base.Experimental.@force_compile
backtrace()
end, true)))
false
julia> occursin("interpreter", string(stacktrace(begin
# without forced compilation
backtrace()
end, true)))
true
```
"""
macro force_compile() Expr(:meta, :force_compile) end
Expand Down
11 changes: 11 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7589,3 +7589,14 @@ end

# avoid impossible normalization (don't try to form Tuple{Complex{String}} here)
@test Tuple{Complex{T} where String<:T<:String} == Tuple{Complex{T} where String<:T<:String}

# control over compilation/interpreter
@test !occursin("interpreter", string(stacktrace(
begin
Base.Experimental.@force_compile
backtrace()
end, true)))
@test occursin("interpreter", string(stacktrace(
begin
backtrace()
end, true)))

2 comments on commit 030a0f9

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.