argotorg / argotorg/solidity

`pragma solidity` with partial versions in match expression broken on prerelease builds

Open
#12,812 8 comments 0 reactions 0 assignees View on GitHub
bug :bug: low effort low impact must have eventually
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

```
pragma solidity >= 0.8;

contract MyContract { }
```

gives

```
Error: Source file requires different compiler version (current compiler is 0.8.13-develop.2022.3.14+commit.57e012da.Linux.g++) - note that nightly builds are considered to be strictly less than the released version
--> mvce._version.sol:1:1:
|
1 | pragma solidity >= 0.8;
| ^^^^^^^^^^^^^^^^^^^^^^^
```

but there shouldn't have been an error as `0.8.13-develop....` is strictly greater than `0.8.12` which in turn is greater than `0.8`.

The following test cases work as expected:

```
pragma solidity >= 0.8.13; // error but that's correct since the compiler is the prerelease version
pragma solidity >= 0.8.12; // no error; correct
pragma solidity >= 0.7; // no error; correct
```

## Environment

- Compiler version: 0.8.13-develop.2022.3.14+commit.57e012da.Linux.g++
- Target EVM version (as per compiler settings):
- Framework/IDE (e.g. Truffle or Remix): Local
- EVM execution environment / backend / blockchain client: N/A
- Operating system: Ubuntu 20.04

## Steps to Reproduce

```
pragma solidity >= 0.8;

contract MyContract { }
```

compile with a prerelease build of the compiler whose version is `0.8.x`.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown `pragma solidity >= 0.8` contract using a 0.8.x prerelease compiler, then trace the compiler's version-matching logic. Verify that the reported `>= 0.8`, `>= 0.8.13`, `>= 0.8.12`, and `>= 0.7` cases produce the expected acceptance or rejection results.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.