@@ -342,20 +342,25 @@ JL_DLLEXPORT jl_method_instance_t* jl_set_lambda_inferred(
342342 // there are 6(!) regions here to consider + boundary conditions for each
343343 if (li -> max_world >= min_world && li -> min_world <= max_world ) {
344344 // there is a non-zero overlap between [li->min, li->max] and [min, max]
345- // there are now 3 regions left to consider
345+ // there are now 4 regions left to consider
346346 // TODO: also take into account li->def->world range when computing preferred division
347- if (li -> min_world <= max_world && li -> max_world > max_world ) {
347+ if (li -> max_world > max_world ) {
348348 // prefer making it applicable to future ages,
349349 // as those are more likely to be useful
350- // this covers 2 of the remaining regions
351350 li -> min_world = max_world + 1 ;
352351 truncate_world_range (li , set_min_world );
353352 }
354- else if (li -> max_world >= min_world && li -> min_world < min_world ) {
353+ else if (li -> min_world < min_world ) {
355354 assert (min_world > 1 && "logic violation: min(li->min_world) == 1 (by construction), so min(min_world) == 2" );
356355 li -> max_world = min_world - 1 ;
357356 truncate_world_range (li , set_max_world );
358357 }
358+ else {
359+ // old inferred li is fully covered by new inference result, so just delete it
360+ assert (!uninferred );
361+ li -> max_world = li -> min_world - 1 ;
362+ truncate_world_range (li , set_max_world );
363+ }
359364 }
360365
361366 // build a new entry to describe the new (inferred) applicability
0 commit comments