Skip to content

Commit

Permalink
gf-cache: avoid listing equivalent types
Browse files Browse the repository at this point in the history
addresses an issue where we might be find an ambiguity with badly designed methods,
such as the ambiguous Nothing/Missing rules (cf #31602)
  • Loading branch information
vtjnash committed Aug 16, 2019
1 parent f0e5f9e commit 39c81e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 39c81e8

Please sign in to comment.