argotorg / argotorg/solcore

SC0201 type mismatch: expected uint256, found uint256

Open Beginner friendly
#576 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
113
Forks
9
Avg merge
4d 9h
Merged PRs (30d)
1

Description

Compiling the following function:
```solidity
public function getBalance() -> uint256 {
return selfbalance();
}
```
results in the following compile error:
```txt
SC0201 type mismatch: expected uint256, found uint256
```
The reason seems to be: The call checker reverses expected and actual return types, then overwrites only the expected label,
producing “expected uint256, found uint256” instead of “expected uint256, found word.”

Location: most likely `infer_direct_call()` and `infer_indirect_call()` in [expr.rs](https://github.com/argotorg/solcore-rs/blob/8d5576699a8ca139e43b72c39f4545d3d2312de1/crates/hir-ty/src/infer/expr.rs).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in crates/hir-ty/src/infer/expr.rs, reading infer_direct_call() and infer_indirect_call() alongside the reported getBalance() reproducer. Check how expected and actual return types are reversed and how the expected label is overwritten. Done means the compiler reports “expected uint256, found word” rather than “expected uint256, found uint256”.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.