Function Documentation
Inline Stability Checks
#
TypeStability.enable_inline_stability_checks
— Function.
enable_inline_stability_checks(::Bool)
Sets whether to run inline stability checks from @stable_function
.
If it is set to false
(the default value), @stable_function does not perform any type stability checks.
The value is checked when @stable_function is evaluated, so this should useually be set at the begining of a package definition.
See inline_stability_checks_enabled
.
#
TypeStability.inline_stability_checks_enabled
— Function.
inline_stability_checks_enabled()::Bool
Returns whether inline stability checks are enabled.
See enable_inline_stability_checks
.
#
TypeStability.@stable_function
— Macro.
@stable_function arg_lists function_name
@stable_function arg_lists function_definition(s)
@stable_function arg_lists acceptable_instability function_name
@stable_function arg_lists acceptable_instability function_definitions(s)
Checks the type stability of the function under the given argument lists.
If the second value is a function definition, the function is defined before checking type stability.
External Stability Checks
#
TypeStability.StabilityReport
— Type.
StabilityReport()
StabilityReport(unstable_variables::Vector{Tuple{Symbol, Type}})
Holds information about the stability of a method.
If unstable_vars
is present, set the fields. Otherwise, creates an empty set.
See is_stable
#
TypeStability.is_stable
— Function.
is_stable(report::StabilityReport)::Bool
is_stable(reports::AbstractArray{StabilityReport})::Bool
is_stable(reports::AbstractArray{Tuple{<:Any, StabilityReport}})::Bool
Check if the given StabilityReport
s don't have any unstable types.
#
TypeStability.stability_warn
— Function.
stability_warn(func_name, report::AbstractArray{Tuple{<:Any,StabilityReport}})
Displays warnings about the function if any of the reports are not stable
#
TypeStability.check_function
— Function.
check_function(func, signatures, acceptable_instability=Dict())
Check that the function is stable under each of the given signatures.
Return an array of method signature-StabilityReport
pairs from check_method
.
#
TypeStability.check_method
— Function.
check_method(func, signature, acceptable_instability=Dict())
Create a StabilityReport
object describing the type stability of the method.is
Compute non-concrete types of variables and return value, returning them in a StabilityReport
Object
acceptable_instability
, if present, is a mapping of variables that are allowed be non-concrete types. get
is called with the mapping, the variable's symbol and Bool
to get the variable's allowed type. Additionally, the return value is checked using :return
as the symbol.
Utiltities
#
TypeStability.RegexDict
— Type.
RegexDict(::Tuple{Union{Regex, String}, T}...)
Creates a dictionary that uses Regexes as keys and tests against those when looking up keys. Symbols can be used as lookup keys, by using their name. If multiple Regexes match a key, the value associated with any of them may be returned.