-
Notifications
You must be signed in to change notification settings - Fork 1
Solidity
sam bacha edited this page Aug 11, 2021
·
1 revision
Welcome to the prettier-config-solidity wiki!
The solidity versions taken into consideration during formatting are:
-
v0.7.4
: Versions prior0.7.4
had a bug that would not interpret correctly imports unless they are formatted in a single line.// Input import { Foo as Bar } from "/an/extremely/long/location"; // "compiler": undefined import { Foo as Bar } from "/an/extremely/long/location"; // "compiler": "0.7.3" (or lesser) import { Foo as Bar } from "/an/extremely/long/location"; // "compiler": "0.7.4" (or greater) import { Foo as Bar } from "/an/extremely/long/location";
-
v0.8.0
: Introduced these changes- The type
byte
has been removed. It was an alias ofbytes1
. - Exponentiation is right associative, i.e., the expression
a**b**c
is parsed asa**(b**c)
. Before 0.8.0, it was parsed as(a**b)**c
.
// Input bytes1 public a; byte public b; uint public c = 1 ** 2 ** 3; // "compiler": undefined // "explicitTypes": "never" bytes1 public a; bytes1 public b; uint public c = 1 ** 2 ** 3; // "compiler": "0.7.6" (or lesser) // "explicitTypes": "never" byte public a; byte public b; uint public c = (1**2)**3; // "compiler": "0.8.0" (or greater) // "explicitTypes": "never" bytes1 public a; bytes1 public b; uint public c = 1**(2**3);
- The type
You might have a multi-version project, where different files are compiled with different compilers. If that's the case, you can use overrides to have a more granular configuration:
{
"overrides": [
{
"files": "contracts/v1/**/*.sol",
"options": {
"compiler": "0.6.3"
}
},
{
"files": "contracts/v2/**/*.sol",
"options": {
"compiler": "0.8.4"
}
}
]
}
Default | CLI Override | API Override |
---|---|---|
None | --compiler <string> |
compiler: "<string>" |