Skip to content

Commit 39c81e8

Browse files
committed
gf-cache: avoid listing equivalent types
addresses an issue where we might be find an ambiguity with badly designed methods, such as the ambiguous Nothing/Missing rules (cf #31602)
1 parent f0e5f9e commit 39c81e8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/gf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ static jl_method_instance_t *cache_method(
882882
if (!cache_with_orig && mt) {
883883
// now examine what will happen if we chose to use this sig in the cache
884884
// TODO: should we first check `compilationsig <: definition`?
885-
temp = ml_matches(mt->defs, 0, compilationsig, -1, 1, world, &min_valid, &max_valid); // TODO: use MAX_UNSPECIALIZED_CONFLICTS?
885+
temp = ml_matches(mt->defs, 0, compilationsig, MAX_UNSPECIALIZED_CONFLICTS, 1, world, &min_valid, &max_valid);
886886
int guards = 0;
887887
if (temp == jl_false) {
888888
cache_with_orig = 1;

test/misc.jl

+3
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ v11801, t11801 = @timed sin(1)
174174

175175
# interactive utilities
176176

177+
struct ambigconvert; end # inject a problematic `convert` method to ensure it still works
178+
Base.convert(::Any, v::ambigconvert) = v
179+
177180
import Base.summarysize
178181
@test summarysize(Core) > (summarysize(Core.Compiler) + Base.summarysize(Core.Intrinsics)) > Core.sizeof(Core)
179182
@test summarysize(Base) > 100_000 * sizeof(Ptr)

0 commit comments

Comments
 (0)