Skip to content

Commit

Permalink
Add event! to userfacing docs, export correct version of reject!
Browse files Browse the repository at this point in the history
This adds `event!` to the listing of user-facing supported API,
as well as exports the correct version of `reject!`.

In addition, this adds a warning that was missed in the initial
documentation of `event!`, and changes a doc-warning to a
doc-danger admonition.
  • Loading branch information
Seelengrab committed Mar 21, 2024
1 parent c3769df commit 79445d4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/src/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Supposition.target!(::Float64)
Supposition.assume!(::Bool)
Supposition.produce!(::Data.Possibility)
Supposition.reject!
Supposition.event!
Supposition.err_less
Supposition.DEFAULT_CONFIG
```
Expand Down
2 changes: 1 addition & 1 deletion src/Supposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The package features:
"""
module Supposition

export assume!, target!, event!, reject, example
export assume!, target!, event!, reject!, example
export Data, @composed, @check

using Base
Expand Down
7 changes: 6 additions & 1 deletion src/api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ Update the currently running testcase to track the given score as its target.
`score` must be `convert`ible to a `Float64`.
!!! warning "Multiple Updates"
!!! danger "Multiple Updates"
This score can only be set once! Repeated calls will be ignored.
!!! warning "Callability"
Expand Down Expand Up @@ -581,6 +581,11 @@ Data.produce!(p::Data.Possibility) = Data.produce!(CURRENT_TESTCASE[], p)
Record `obj` as an event in the current testcase that occured while running
your property. If no `label` is given, a default one will be chosen.
!!! warning "Callability"
This can only be called while a testcase is currently being examined or an example for a `Possibility`
is being actively generated. It is ok to call this inside of `@composed` or `@check`, as well as any
functions only intended to be called from one of those places.
"""
function event! end

Expand Down
2 changes: 1 addition & 1 deletion src/data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ as well as these utility functions:
module Data

using Supposition
using Supposition: smootherstep, lerp, TestCase, choice!, weighted!, forced_choice!
using Supposition: smootherstep, lerp, TestCase, choice!, weighted!, forced_choice!, reject
using RequiredInterfaces: @required

"""
Expand Down
2 changes: 1 addition & 1 deletion src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using PrecompileTools
i isa Int
end
rejects(i::Int8) = begin
reject()
reject!()
i isa Int
end
errors(_) = error()
Expand Down

0 comments on commit 79445d4

Please sign in to comment.