argotorg / argotorg/solidity

Incorrect error message when declaring storage parameters public functions

Open
#15,567 2 comments 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

The following code throws an error with message `Data location must be "memory" or "calldata" for parameter in external function, but "storage" was given.`

```solidity
function f(S storage s) external view {

}
```

The after changing `external` into `public`, I got `Data location must be "memory" or "calldata" for parameter in function, but "storage" was given.`. It's a simple typo I think. We need to specify that no `storage` in the parameter list of a `public` function.

## Environment

- Compiler version: 0.8.28

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or entry points are named. Reproduce the diagnostic with the supplied Solidity example using compiler version 0.8.28, then trace how parameter data-location errors distinguish external and public functions. Done means the public-function message explicitly states that storage is not permitted in the parameter list and the relevant diagnostic tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
blockchain, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.