diff --git a/Project.toml b/Project.toml index 9888436..70ec9e3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,13 +1,12 @@ name = "FunctionWrappersWrappers" uuid = "77dc65aa-8811-40c2-897b-53d922fa7daf" authors = ["Chris Elrod and contributors"] -version = "1.11.0" +version = "1.11.1" [deps] FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" SciMLPublic = "431bcebd-1456-4ced-9d72-93c2757fff0b" -TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77" [weakdeps] Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" @@ -28,7 +27,6 @@ SafeTestsets = "0.1, 1" SciMLPublic = "1" SciMLTesting = "2.4" Test = "1" -TruncatedStacktraces = "1.1" julia = "1.10" [extras] diff --git a/src/FunctionWrappersWrappers.jl b/src/FunctionWrappersWrappers.jl index 5645d41..64f04af 100644 --- a/src/FunctionWrappersWrappers.jl +++ b/src/FunctionWrappersWrappers.jl @@ -2,7 +2,6 @@ module FunctionWrappersWrappers using FunctionWrappers: FunctionWrappers using SciMLPublic: @public -import TruncatedStacktraces export FunctionWrappersWrapper, unwrap, wrapped_signatures, wrapped_return_types export NoCache, SingleCache, DictCache @@ -223,7 +222,49 @@ struct FunctionWrappersWrapper{FW, P, CS} end end -TruncatedStacktraces.@truncate_stacktrace FunctionWrappersWrapper +@doc """ + FunctionWrappersWrapper{FW, P, CS}(fw, cs) -> FunctionWrappersWrapper{FW, P, CS} + +Create a `FunctionWrappersWrapper` from an already-built wrapper tuple and cache storage, +with every type parameter fixed by the caller. + +This is the fully explicit form. Prefer it when the result type must be inferrable from +type parameters alone: `FW`, `P` and `CS` are given directly rather than derived from +argument values, so nothing rests on constant propagation through a keyword-argument +frame. Solver stacks that wrap a type-erased callable — where the wrapper type, and every +cache built from it, must stay concrete — construct through this method. + +The caller is responsible for consistency: `fw` must match `FW`, and `cs` must be the +storage type `P`'s fallback path expects — [`NoCacheStorage`](@ref), +[`SingleCacheStorage`](@ref), or [`DictCacheStorage`](@ref), matching the intended cache +mode. + +# Arguments +- `fw`: Tuple of `FunctionWrappers.FunctionWrapper`s, tried in order on call. +- `cs`: Cache storage instance used by the fallback path. + +# Type Parameters +- `FW`: Tuple type of the wrapped `FunctionWrapper`s. +- `P`: Fallback policy type, such as `Strict`, `AllowAll`, or `AllowNonIsBits`. +- `CS`: Cache storage type, matching `typeof(cs)`. + +# Returns +- `FunctionWrappersWrapper{FW, P, CS}`: A callable wrapper around `fw`. + +# Examples +```jldoctest +julia> using FunctionWrappers: FunctionWrapper + +julia> fw = (FunctionWrapper{Float64, Tuple{Float64, Float64}}(+),); + +julia> cs = FunctionWrappersWrappers.SingleCacheStorage(); + +julia> fww = FunctionWrappersWrapper{typeof(fw), AllowNonIsBits, typeof(cs)}(fw, cs); + +julia> fww(1.0, 2.0) +3.0 +``` +""" FunctionWrappersWrapper{FW, P, CS}(fw::FW, cs::CS) where {FW, P, CS} """ FunctionWrappersWrapper{FW, P, CS}(f) -> FunctionWrappersWrapper{FW, P, CS} diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 4ce61f8..82b5be8 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,3 +1,15 @@ using SciMLTesting, FunctionWrappersWrappers -run_qa(FunctionWrappersWrappers) +run_qa( + FunctionWrappersWrappers; + ei_kwargs = (; + # `FunctionWrappers.FunctionWrapper` is not declared `public` in its owning + # module. It is the type this package exists to wrap: it appears in the + # signature of every public constructor, and callers must build + # `FunctionWrapper` tuples themselves to reach the inference-stable + # construction path, so it cannot be hidden behind our own API. Drop this + # entry once JuliaLang/FunctionWrappers.jl#41 is released and the compat + # floor is raised. + all_qualified_accesses_are_public = (; ignore = (:FunctionWrapper,)), + ), +)