Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior of * and empty string in outputSelection #15747

Open
cameel opened this issue Jan 20, 2025 · 0 comments
Open

Inconsistent behavior of * and empty string in outputSelection #15747

cameel opened this issue Jan 20, 2025 · 0 comments
Labels
bug 🐛 low effort There is not much implementation work to be done. The task is very easy or tiny. low impact Changes are not very noticeable or potential benefits are limited. must have eventually Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.

Comments

@cameel
Copy link
Member

cameel commented Jan 20, 2025

Discovered in #15447.

Description

outputSelection in Standard JSON has two selectors that are handled specially: "*" and "".

The asterisk consistently works a wildcard selecting all sources/contracts. The empty string, on the other hand, is sometimes treated as a wildcard and sometimes as a literal empty string:

  • When selecting outputs, it's a literal empty string. Will never match an output.
  • When selecting contracts, it's a literal empty string. Will never match a contract.
  • When selecting sources, it depends on what's at the contract level. Combined with "*" acts as a wildcard matching all sources, while with a specific name (or empty string) will only match a source with an empty name.

Another quirk is that, even though * is a valid source name, it cannot be matched literally. It can still be matched with a wildcard, but cannot be selected on its own. This should be documented because tools must be aware of this and handle it in some way (e.g. by disallowing * as a name). Perhaps we should consider disallowing * as well.

Environment

  • Compiler version: 0.8.28

Steps to Reproduce

See standard_output_selection_multiple_matching_source_and_contract_selectors/input.json.

@cameel cameel added bug 🐛 low effort There is not much implementation work to be done. The task is very easy or tiny. low impact Changes are not very noticeable or potential benefits are limited. must have eventually Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it. labels Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 low effort There is not much implementation work to be done. The task is very easy or tiny. low impact Changes are not very noticeable or potential benefits are limited. must have eventually Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.
Projects
None yet
Development

No branches or pull requests

1 participant