@@ -101,10 +101,42 @@ function _find_ambiguities(
101101 packages:: Vector{PkgId} ;
102102 color:: Union{Bool,Nothing} = nothing ,
103103 exclude:: AbstractVector = [],
104+ extensions:: AbstractVector = [],
104105 # Options to be passed to `Test.detect_ambiguities`:
105106 detect_ambiguities_options... ,
106107)
108+ extdeppackages = PkgId[]
109+ @static if JULIA_HAS_EXTENSIONS
110+ extensions = String .(extensions)
111+ for ext in extensions
112+ found = false
113+ for pkg in setdiff (packages, [PkgId (Base), PkgId (Core)])
114+ exts, weakdeps, deps = get_extension_data_from_toml (pkg)
115+ if haskey (exts, ext)
116+ found = true
117+ extdeps = exts[ext] isa String ? [exts[ext]] : exts[ext]
118+ for extdepname in extdeps
119+ if haskey (deps, extdepname)
120+ push! (extdeppackages, deps[extdepname])
121+ elseif haskey (weakdeps, extdepname)
122+ push! (extdeppackages, weakdeps[extdepname])
123+ else
124+ error (
125+ " Extension $ext depends on $extdepname , but it is not found." ,
126+ )
127+ end
128+ end
129+ push! (packages, PkgId (Base. uuid5 (pkg. uuid, ext), ext))
130+ break
131+ end
132+ end
133+ found && continue
134+ error (" Extension $ext is not found." )
135+ end
136+ end
137+
107138 packages_repr = reprpkgids (collect (packages))
139+ extdeppackages_repr = reprpkgids (collect (extdeppackages))
108140 options_repr = checked_repr ((; recursive = true , detect_ambiguities_options... ))
109141 exclude_repr = reprexclude (normalize_and_check_exclude (exclude))
110142
@@ -115,6 +147,7 @@ function _find_ambiguities(
115147 using Aqua
116148 Aqua.test_ambiguities_impl(
117149 $packages_repr ,
150+ $extdeppackages_repr ,
118151 $options_repr ,
119152 $exclude_repr ,
120153 ) || exit(1)
200233
201234function test_ambiguities_impl (
202235 packages:: Vector{PkgId} ,
236+ extdeppackages:: Vector{PkgId} ,
203237 options:: NamedTuple ,
204238 exspecs:: Vector{ExcludeSpec} ,
205239)
240+ deps = map (Base. require, extdeppackages)
206241 modules = map (Base. require, packages)
207242 @debug " Testing method ambiguities" modules
208243 ambiguities = detect_ambiguities (modules... ; options... )
0 commit comments