From 39c81e8b01306c6cf2b3eee6cac1d62b4ee4a26e Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 16 Jul 2019 16:57:05 -0400 Subject: [PATCH] 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) --- src/gf.c | 2 +- test/misc.jl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gf.c b/src/gf.c index 635dcb3feb48e..352eafd7c7037 100644 --- a/src/gf.c +++ b/src/gf.c @@ -882,7 +882,7 @@ static jl_method_instance_t *cache_method( if (!cache_with_orig && mt) { // now examine what will happen if we chose to use this sig in the cache // TODO: should we first check `compilationsig <: definition`? - temp = ml_matches(mt->defs, 0, compilationsig, -1, 1, world, &min_valid, &max_valid); // TODO: use MAX_UNSPECIALIZED_CONFLICTS? + temp = ml_matches(mt->defs, 0, compilationsig, MAX_UNSPECIALIZED_CONFLICTS, 1, world, &min_valid, &max_valid); int guards = 0; if (temp == jl_false) { cache_with_orig = 1; diff --git a/test/misc.jl b/test/misc.jl index 930b80eebeb14..e699084303339 100644 --- a/test/misc.jl +++ b/test/misc.jl @@ -174,6 +174,9 @@ v11801, t11801 = @timed sin(1) # interactive utilities +struct ambigconvert; end # inject a problematic `convert` method to ensure it still works +Base.convert(::Any, v::ambigconvert) = v + import Base.summarysize @test summarysize(Core) > (summarysize(Core.Compiler) + Base.summarysize(Core.Intrinsics)) > Core.sizeof(Core) @test summarysize(Base) > 100_000 * sizeof(Ptr)