argotorg / argotorg/solidity

Ranked overload resolution

Open
#1,256 13 comments 7 reactions 0 assignees View on GitHub
language design :rage4: medium effort medium impact must have eventually needs design
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

Currently, functions are selected as overload candidates if all arguments can be implicitly converted to the expected types. If there is not exactly one candidate, resolution fails.
This makes it impossible to call different functions depending on whether one argument is a storage or a memory array, because storage arrays can be implicitly converted to both storage and memory arrays.
We should add a ranking of candidates depending on which conversions have to take place.
For this, a conversion from e.g. storage to memory should be "worse" than a widening of an integer type which in turn is worse than no conversion at all.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating the overload-resolution implementation and its candidate-conversion tests, then trace how storage-to-memory conversion, integer widening, and exact matches are represented. Done means overloads can be selected by the stated conversion ranking, including the storage-versus-memory case, with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.