Reproduction
let ranges = [(0, [(1, 2)])];
let values = [];
values ++= ranges.pop()[1];
The analyser reports:
mismatched types: found Any but expected List<Any>
Expected behavior
The compiler should defer this call to runtime. The left side has type List, and the runtime overload for ++= can confirm that the right side is a list before mutating it.
Cause
The stdlib declares pop(List) -> Any, so indexing the returned tuple also produces Any. augmented_rhs_is_compatible requires the inferred right type to subtype the left type before it accepts a specialized mutation. It rejects Any without considering the runtime parameter type of the dynamic overload candidate.
The check should accept an unknown right side when each eligible runtime candidate preserves the left type. It must keep rejecting cases such as appending an unknown List to List.
Workaround
values ++= list(ranges.pop()[1]);
Found while running Advent of Code 2025 day 9 part 2 on master.
Reproduction
The analyser reports:
Expected behavior
The compiler should defer this call to runtime. The left side has type List, and the runtime overload for ++= can confirm that the right side is a list before mutating it.
Cause
The stdlib declares pop(List) -> Any, so indexing the returned tuple also produces Any. augmented_rhs_is_compatible requires the inferred right type to subtype the left type before it accepts a specialized mutation. It rejects Any without considering the runtime parameter type of the dynamic overload candidate.
The check should accept an unknown right side when each eligible runtime candidate preserves the left type. It must keep rejecting cases such as appending an unknown List to List.
Workaround
Found while running Advent of Code 2025 day 9 part 2 on master.