SC0201 type mismatch: expected uint256, found uint256

Open Beginner friendly
#576 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

Description

Compiling the following function:

public function getBalance() -> uint256 {
    return selfbalance();
}

results in the following compile error:

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.

Dominant language
Haskell
Stars
113
Forks
10
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from argotorg/solcore

All issues in argotorg/solcore

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.