-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Oct 15, 2024
1 parent
98d148b
commit 929c853
Showing
29 changed files
with
1,387 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.8.8 | ||
v0.8.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.8.8 | ||
v0.8.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"documenter":{"julia_version":"1.11.0","generation_timestamp":"2024-10-15T19:03:59","documenter_version":"1.7.0"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Ambiguities · Aqua.jl</title><meta name="title" content="Ambiguities · Aqua.jl"/><meta property="og:title" content="Ambiguities · Aqua.jl"/><meta property="twitter:title" content="Ambiguities · Aqua.jl"/><meta name="description" content="Documentation for Aqua.jl."/><meta property="og:description" content="Documentation for Aqua.jl."/><meta property="twitter:description" content="Documentation for Aqua.jl."/><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../search_index.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script><link href="../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img src="../assets/logo.svg" alt="Aqua.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../">Aqua.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><span class="tocitem">Tests</span><ul><li><a class="tocitem" href="../test_all/">Test everything</a></li><li class="is-active"><a class="tocitem" href>Ambiguities</a><ul class="internal"><li><a class="tocitem" href="#Examples"><span>Examples</span></a></li><li><a class="tocitem" href="#test_ambiguities"><span>Test function</span></a></li></ul></li><li><a class="tocitem" href="../unbound_args/">Unbound Type Parameters</a></li><li><a class="tocitem" href="../exports/">Undefined exports</a></li><li><a class="tocitem" href="../project_extras/">Project.toml extras</a></li><li><a class="tocitem" href="../stale_deps/">Stale dependencies</a></li><li><a class="tocitem" href="../deps_compat/">Compat entries</a></li><li><a class="tocitem" href="../piracies/">Type piracy</a></li><li><a class="tocitem" href="../persistent_tasks/">Persistent Tasks</a></li></ul></li><li><a class="tocitem" href="../release-notes/">Release notes</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Tests</a></li><li class="is-active"><a href>Ambiguities</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Ambiguities</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/JuliaTesting/Aqua.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/JuliaTesting/Aqua.jl/blob/master/docs/src/ambiguities.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Ambiguities"><a class="docs-heading-anchor" href="#Ambiguities">Ambiguities</a><a id="Ambiguities-1"></a><a class="docs-heading-anchor-permalink" href="#Ambiguities" title="Permalink"></a></h1><p>Method ambiguities are cases where multiple methods are applicable to a given set of arguments, without having a most specific method.</p><h2 id="Examples"><a class="docs-heading-anchor" href="#Examples">Examples</a><a id="Examples-1"></a><a class="docs-heading-anchor-permalink" href="#Examples" title="Permalink"></a></h2><p>One easy example is the following:</p><pre><code class="language-julia-repl hljs" style="display:block;">julia> f(x::Int, y::Integer) = 1</code><code class="nohighlight hljs ansi" style="display:block;">f (generic function with 1 method)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> f(x::Integer, y::Int) = 2</code><code class="nohighlight hljs ansi" style="display:block;">f (generic function with 2 methods)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia> println(f(1, 2))</code><code class="nohighlight hljs ansi" style="display:block;">ERROR: MethodError: f(::Int64, ::Int64) is ambiguous. | ||
|
||
Candidates: | ||
f(<span class="sgr90">x</span>::<span class="sgr1">Integer</span>, <span class="sgr90">y</span>::<span class="sgr1">Int64</span>) | ||
<span class="sgr90"> @</span> <span class="sgr90">Main</span> <span class="sgr90"><span class="sgr4">REPL[2]:1</span></span> | ||
f(<span class="sgr90">x</span>::<span class="sgr1">Int64</span>, <span class="sgr90">y</span>::<span class="sgr1">Integer</span>) | ||
<span class="sgr90"> @</span> <span class="sgr90">Main</span> <span class="sgr90"><span class="sgr4">REPL[1]:1</span></span> | ||
|
||
Possible fix, define | ||
f(::Int64, ::Int64)</code></pre><p>This will throw an <code>MethodError</code> because both methods are equally specific. The solution is to add a third method:</p><pre><code class="language-julia hljs">f(x::Int, y::Int) = ? # `?` is dependent on the use case, most times it will be `1` or `2`</code></pre><h2 id="test_ambiguities"><a class="docs-heading-anchor" href="#test_ambiguities">Test function</a><a id="test_ambiguities-1"></a><a class="docs-heading-anchor-permalink" href="#test_ambiguities" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="Aqua.test_ambiguities" href="#Aqua.test_ambiguities"><code>Aqua.test_ambiguities</code></a> — <span class="docstring-category">Function</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">test_ambiguities(package::Union{Module, PkgId}) | ||
test_ambiguities(packages::Vector{Union{Module, PkgId}})</code></pre><p>Test that there is no method ambiguities in given package(s). It calls <code>Test.detect_ambiguities</code> in a separated clean process to avoid false-positives.</p><p><strong>Keyword Arguments</strong></p><ul><li><code>broken::Bool = false</code>: If true, it uses <code>@test_broken</code> instead of <code>@test</code> and shortens the error message.</li><li><code>color::Union{Bool, Nothing} = nothing</code>: Enable/disable colorful output if a <code>Bool</code>. <code>nothing</code> (default) means to inherit the setting in the current process.</li><li><code>exclude::AbstractVector = []</code>: A vector of functions or types to be excluded from ambiguity testing. A function means to exclude <em>all</em> its methods. A type means to exclude <em>all</em> its methods of the callable (sometimes also called "functor") and the constructor. That is to say, <code>MyModule.MyType</code> means to ignore ambiguities between <code>(::MyType)(x, y::Int)</code> and <code>(::MyType)(x::Int, y)</code>.</li><li><code>recursive::Bool = true</code>: Passed to <code>Test.detect_ambiguities</code>. Note that the default here (<code>true</code>) is different from <code>detect_ambiguities</code>. This is for testing ambiguities in methods defined in all sub-modules.</li><li>Other keyword arguments such as <code>imported</code> and <code>ambiguous_bottom</code> are passed to <code>Test.detect_ambiguities</code> as-is.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaTesting/Aqua.jl/blob/1fca5d9fc494a1c80618d7352655373be7c8d82c/src/ambiguities.jl#L1-L27">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../test_all/">« Test everything</a><a class="docs-footer-nextpage" href="../unbound_args/">Unbound Type Parameters »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Tuesday 15 October 2024 19:03">Tuesday 15 October 2024</span>. Using Julia version 1.11.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Oops, something went wrong.