prettier-plugin-solidity 1.0.0-dev.21 → 1.0.0-dev.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -12
- package/src/binary-operator-printers/index.js +1 -1
- package/src/nodes/FunctionCall.js +17 -14
- package/src/nodes/InlineAssemblyStatement.js +17 -1
- package/src/nodes/ModifierDefinition.js +5 -3
- package/src/nodes/UsingForDeclaration.js +19 -3
- package/src/nodes/index.js +1 -2
- package/tests/config/format-test.js +1 -1
- package/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol +1 -0
- package/tests/format/AllSolidityFeatures/__snapshots__/jsfmt.spec.js.snap +2 -0
- package/tests/format/Assembly/Assembly.sol +7 -0
- package/tests/format/Assembly/__snapshots__/jsfmt.spec.js.snap +16 -0
- package/tests/format/Comments/Comments.sol +12 -0
- package/tests/format/Comments/__snapshots__/jsfmt.spec.js.snap +26 -0
- package/tests/format/ExplicitVariableTypes/ExplicitVariableTypes.sol +1 -1
- package/tests/format/ExplicitVariableTypes/__snapshots__/jsfmt.spec.js.snap +6 -6
- package/tests/format/HexLiteral/HexLiteral.sol +1 -1
- package/tests/format/HexLiteral/__snapshots__/jsfmt.spec.js.snap +4 -4
- package/tests/format/Libraries/Libraries.sol +10 -0
- package/tests/format/Libraries/__snapshots__/jsfmt.spec.js.snap +102 -0
- package/tests/format/Libraries/jsfmt.spec.js +2 -0
- package/tests/format/ModifierDefinitions/ModifierDefinitions.sol +2 -0
- package/tests/format/ModifierDefinitions/__snapshots__/jsfmt.spec.js.snap +4 -0
- package/tests/format/ModifierInvocations/ModifierInvocations.sol +1 -1
- package/tests/format/ModifierInvocations/__snapshots__/jsfmt.spec.js.snap +2 -2
- package/tests/format/Parentheses/AddNoParentheses.sol +1 -1
- package/tests/format/Parentheses/BitAndNoParentheses.sol +1 -1
- package/tests/format/Parentheses/BitOrNoParentheses.sol +1 -1
- package/tests/format/Parentheses/BitXorNoParentheses.sol +1 -1
- package/tests/format/Parentheses/DivNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ExpNoParentheses.sol +1 -1
- package/tests/format/Parentheses/LogicNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ModNoParentheses.sol +1 -1
- package/tests/format/Parentheses/MulNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ShiftLNoParentheses.sol +1 -1
- package/tests/format/Parentheses/ShiftRNoParentheses.sol +1 -1
- package/tests/format/Parentheses/SubNoParentheses.sol +1 -1
- package/tests/format/Parentheses/__snapshots__/jsfmt.spec.js.snap +24 -24
- package/Foo.sol +0 -404
- package/src/nodes/TypeNameExpression.js +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-solidity",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.22",
|
|
4
4
|
"description": "A Prettier Plugin for automatically formatting your Solidity code.",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
@@ -65,28 +65,28 @@
|
|
|
65
65
|
"node": ">=12"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@babel/code-frame": "^7.
|
|
68
|
+
"@babel/code-frame": "^7.18.6",
|
|
69
69
|
"cross-env": "^7.0.3",
|
|
70
70
|
"dir-to-object": "^2.0.0",
|
|
71
|
-
"eslint": "^8.
|
|
71
|
+
"eslint": "^8.19.0",
|
|
72
72
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
73
|
-
"eslint-config-prettier": "^8.
|
|
74
|
-
"eslint-plugin-import": "^2.
|
|
75
|
-
"jest": "^
|
|
73
|
+
"eslint-config-prettier": "^8.5.0",
|
|
74
|
+
"eslint-plugin-import": "^2.26.0",
|
|
75
|
+
"jest": "^28.1.2",
|
|
76
76
|
"jest-mock-now": "^1.3.0",
|
|
77
77
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
78
78
|
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
79
|
-
"jest-watch-typeahead": "^
|
|
79
|
+
"jest-watch-typeahead": "^2.0.0",
|
|
80
80
|
"lines-and-columns": "^2.0.3",
|
|
81
81
|
"outdent": "^0.8.0",
|
|
82
|
-
"prettier": "^2.
|
|
83
|
-
"solc": "^0.8.
|
|
82
|
+
"prettier": "^2.7.1",
|
|
83
|
+
"solc": "^0.8.15"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@solidity-parser/parser": "^0.14.
|
|
87
|
-
"emoji-regex": "^10.
|
|
86
|
+
"@solidity-parser/parser": "^0.14.2",
|
|
87
|
+
"emoji-regex": "^10.1.0",
|
|
88
88
|
"escape-string-regexp": "^4.0.0",
|
|
89
|
-
"semver": "^7.3.
|
|
89
|
+
"semver": "^7.3.7",
|
|
90
90
|
"solidity-comments-extractor": "^0.0.7",
|
|
91
91
|
"string-width": "^4.2.3"
|
|
92
92
|
},
|
|
@@ -6,18 +6,21 @@ const {
|
|
|
6
6
|
|
|
7
7
|
const printSeparatedList = require('./print-separated-list');
|
|
8
8
|
|
|
9
|
-
const printObject = (
|
|
10
|
-
'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
const printObject = (path, print, options) => {
|
|
10
|
+
const identifiers = path.map(print, 'identifiers');
|
|
11
|
+
return [
|
|
12
|
+
'{',
|
|
13
|
+
printSeparatedList(
|
|
14
|
+
path
|
|
15
|
+
.map(print, 'arguments')
|
|
16
|
+
.map((arg, index) => [identifiers[index], ': ', arg]),
|
|
17
|
+
{
|
|
18
|
+
firstSeparator: options.bracketSpacing ? line : softline,
|
|
19
|
+
lastSeparator: [options.bracketSpacing ? line : softline, '})']
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
];
|
|
23
|
+
};
|
|
21
24
|
|
|
22
25
|
const printArguments = (path, print) =>
|
|
23
26
|
printSeparatedList(path.map(print, 'arguments'), {
|
|
@@ -31,8 +34,8 @@ const FunctionCall = {
|
|
|
31
34
|
let argumentsDoc = ')';
|
|
32
35
|
|
|
33
36
|
if (node.arguments && node.arguments.length > 0) {
|
|
34
|
-
if (node.
|
|
35
|
-
argumentsDoc = printObject(
|
|
37
|
+
if (node.identifiers && node.identifiers.length > 0) {
|
|
38
|
+
argumentsDoc = printObject(path, print, options);
|
|
36
39
|
} else {
|
|
37
40
|
argumentsDoc = printArguments(path, print);
|
|
38
41
|
}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
// @TODO: add support for assembly language specifier
|
|
2
|
+
const { printString } = require('../prettier-comments/common/util');
|
|
3
|
+
const printSeparatedList = require('./print-separated-list');
|
|
4
|
+
|
|
2
5
|
const InlineAssemblyStatement = {
|
|
3
|
-
print: ({ path, print }) => [
|
|
6
|
+
print: ({ node, path, print, options }) => [
|
|
7
|
+
'assembly ',
|
|
8
|
+
node.language ? `${printString(node.language, options)} ` : '',
|
|
9
|
+
node.flags && node.flags.length > 0
|
|
10
|
+
? [
|
|
11
|
+
'(',
|
|
12
|
+
printSeparatedList(
|
|
13
|
+
node.flags.map((flag) => printString(flag, options))
|
|
14
|
+
),
|
|
15
|
+
') '
|
|
16
|
+
]
|
|
17
|
+
: '',
|
|
18
|
+
path.call(print, 'body')
|
|
19
|
+
]
|
|
4
20
|
};
|
|
5
21
|
module.exports = InlineAssemblyStatement;
|
|
@@ -39,8 +39,11 @@ const override = (node, path, print) => {
|
|
|
39
39
|
];
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const body = (node, path, print) =>
|
|
43
|
-
|
|
42
|
+
const body = (node, path, print) => {
|
|
43
|
+
if (!node.body) return ';';
|
|
44
|
+
if (node.isVirtual) return group([' ', path.call(print, 'body')]);
|
|
45
|
+
return [' ', path.call(print, 'body')];
|
|
46
|
+
};
|
|
44
47
|
|
|
45
48
|
const ModifierDefinition = {
|
|
46
49
|
print: ({ node, path, print }) => [
|
|
@@ -48,7 +51,6 @@ const ModifierDefinition = {
|
|
|
48
51
|
node.name,
|
|
49
52
|
modifierParameters(node, path, print),
|
|
50
53
|
group(indent([virtual(node), override(node, path, print)])),
|
|
51
|
-
' ',
|
|
52
54
|
body(node, path, print)
|
|
53
55
|
]
|
|
54
56
|
};
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
const {
|
|
2
|
+
doc: {
|
|
3
|
+
builders: { line, softline }
|
|
4
|
+
}
|
|
5
|
+
} = require('prettier');
|
|
6
|
+
|
|
7
|
+
const printSeparatedList = require('./print-separated-list');
|
|
8
|
+
|
|
1
9
|
const UsingForDeclaration = {
|
|
2
|
-
print: ({ node, path, print }) => [
|
|
10
|
+
print: ({ node, path, print, options }) => [
|
|
3
11
|
'using ',
|
|
4
|
-
node.
|
|
12
|
+
node.functions && node.functions.length
|
|
13
|
+
? [
|
|
14
|
+
'{',
|
|
15
|
+
printSeparatedList(node.functions, {
|
|
16
|
+
firstSeparator: options.bracketSpacing ? line : softline
|
|
17
|
+
}),
|
|
18
|
+
'}'
|
|
19
|
+
]
|
|
20
|
+
: node.libraryName,
|
|
5
21
|
' for ',
|
|
6
22
|
node.typeName ? path.call(print, 'typeName') : '*',
|
|
7
|
-
';'
|
|
23
|
+
node.isGlobal ? ' global;' : ';'
|
|
8
24
|
]
|
|
9
25
|
};
|
|
10
26
|
|
package/src/nodes/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* This file was automatically generated on
|
|
1
|
+
/* This file was automatically generated on 1653243394.65 */
|
|
2
2
|
|
|
3
3
|
/* eslint-disable global-require */
|
|
4
4
|
|
|
@@ -66,7 +66,6 @@ module.exports = {
|
|
|
66
66
|
TryStatement: require('./TryStatement'),
|
|
67
67
|
TupleExpression: require('./TupleExpression'),
|
|
68
68
|
TypeDefinition: require('./TypeDefinition'),
|
|
69
|
-
TypeNameExpression: require('./TypeNameExpression'),
|
|
70
69
|
UnaryOperation: require('./UnaryOperation'),
|
|
71
70
|
UncheckedStatement: require('./UncheckedStatement'),
|
|
72
71
|
UserDefinedTypeName: require('./UserDefinedTypeName'),
|
|
@@ -22,7 +22,7 @@ const RANGE_END_PLACEHOLDER = "<<<PRETTIER_RANGE_END>>>";
|
|
|
22
22
|
|
|
23
23
|
// Here we add files that will not be the same when formatting a second time.
|
|
24
24
|
const unstableTests = new Map(
|
|
25
|
-
[].map((fixture) => {
|
|
25
|
+
["Comments/Comments.sol"].map((fixture) => {
|
|
26
26
|
const [file, isUnstable = () => true] = Array.isArray(fixture)
|
|
27
27
|
? fixture
|
|
28
28
|
: [fixture];
|
|
@@ -270,6 +270,7 @@ library UsingExampleLibrary {
|
|
|
270
270
|
contract UsingExampleContract {
|
|
271
271
|
using UsingExampleLibrary for *;
|
|
272
272
|
using UsingExampleLibrary for uint[];
|
|
273
|
+
using Example.UsingExampleLibrary for uint;
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
contract NewStuff {
|
|
@@ -822,6 +823,7 @@ library UsingExampleLibrary {
|
|
|
822
823
|
contract UsingExampleContract {
|
|
823
824
|
using UsingExampleLibrary for *;
|
|
824
825
|
using UsingExampleLibrary for uint256[];
|
|
826
|
+
using Example.UsingExampleLibrary for uint256;
|
|
825
827
|
}
|
|
826
828
|
|
|
827
829
|
contract NewStuff {
|
|
@@ -185,6 +185,13 @@ function $somefn(somearg) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
|
|
189
|
+
function memorySafe() {
|
|
190
|
+
assembly ("memory-safe") {
|
|
191
|
+
}
|
|
192
|
+
assembly "evmasm" ("memory-safe") {
|
|
193
|
+
}
|
|
194
|
+
}
|
|
188
195
|
}
|
|
189
196
|
|
|
190
197
|
=====================================output=====================================
|
|
@@ -400,6 +407,15 @@ contract Assembly {
|
|
|
400
407
|
}
|
|
401
408
|
}
|
|
402
409
|
}
|
|
410
|
+
|
|
411
|
+
function memorySafe() {
|
|
412
|
+
assembly ("memory-safe") {
|
|
413
|
+
|
|
414
|
+
}
|
|
415
|
+
assembly "evmasm" ("memory-safe") {
|
|
416
|
+
|
|
417
|
+
}
|
|
418
|
+
}
|
|
403
419
|
}
|
|
404
420
|
|
|
405
421
|
================================================================================
|
|
@@ -102,3 +102,15 @@ contract Comments11 {
|
|
|
102
102
|
// this should not be removed
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
contract Comments12 {
|
|
107
|
+
function f() public {
|
|
108
|
+
purchaseData[0] = DomainPurchaseData({
|
|
109
|
+
/* test */prices: _rootPrices,
|
|
110
|
+
// test2
|
|
111
|
+
subdomainMintingEnabled: /* test3 */_rootPrices.short > 0,
|
|
112
|
+
allowSubdomainsToMint: true, // test4
|
|
113
|
+
wasAllowedToSubdomainMintOnCreation: true
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -111,6 +111,18 @@ contract Comments11 {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
contract Comments12 {
|
|
115
|
+
function f() public {
|
|
116
|
+
purchaseData[0] = DomainPurchaseData({
|
|
117
|
+
/* test */prices: _rootPrices,
|
|
118
|
+
// test2
|
|
119
|
+
subdomainMintingEnabled: /* test3 */_rootPrices.short > 0,
|
|
120
|
+
allowSubdomainsToMint: true, // test4
|
|
121
|
+
wasAllowedToSubdomainMintOnCreation: true
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
114
126
|
=====================================output=====================================
|
|
115
127
|
pragma solidity ^0.4.24;
|
|
116
128
|
|
|
@@ -240,5 +252,19 @@ contract Comments11 {
|
|
|
240
252
|
}
|
|
241
253
|
}
|
|
242
254
|
|
|
255
|
+
contract Comments12 {
|
|
256
|
+
function f() public {
|
|
257
|
+
purchaseData[0] = DomainPurchaseData({
|
|
258
|
+
/* test */
|
|
259
|
+
prices: _rootPrices,
|
|
260
|
+
// test2
|
|
261
|
+
subdomainMintingEnabled: /* test3 */
|
|
262
|
+
_rootPrices.short > 0,
|
|
263
|
+
allowSubdomainsToMint: true, // test4
|
|
264
|
+
wasAllowedToSubdomainMintOnCreation: true
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
243
269
|
================================================================================
|
|
244
270
|
`;
|
|
@@ -9,7 +9,7 @@ printWidth: 80
|
|
|
9
9
|
| printWidth
|
|
10
10
|
=====================================input======================================
|
|
11
11
|
// SPDX-License-Identifier: MIT
|
|
12
|
-
pragma solidity 0.8.
|
|
12
|
+
pragma solidity 0.8.15;
|
|
13
13
|
|
|
14
14
|
contract VariableTypesMixed {
|
|
15
15
|
uint256 public a;
|
|
@@ -47,7 +47,7 @@ contract VariableTypesMixed {
|
|
|
47
47
|
|
|
48
48
|
=====================================output=====================================
|
|
49
49
|
// SPDX-License-Identifier: MIT
|
|
50
|
-
pragma solidity 0.8.
|
|
50
|
+
pragma solidity 0.8.15;
|
|
51
51
|
|
|
52
52
|
contract VariableTypesMixed {
|
|
53
53
|
uint public a;
|
|
@@ -95,7 +95,7 @@ printWidth: 80
|
|
|
95
95
|
| printWidth
|
|
96
96
|
=====================================input======================================
|
|
97
97
|
// SPDX-License-Identifier: MIT
|
|
98
|
-
pragma solidity 0.8.
|
|
98
|
+
pragma solidity 0.8.15;
|
|
99
99
|
|
|
100
100
|
contract VariableTypesMixed {
|
|
101
101
|
uint256 public a;
|
|
@@ -133,7 +133,7 @@ contract VariableTypesMixed {
|
|
|
133
133
|
|
|
134
134
|
=====================================output=====================================
|
|
135
135
|
// SPDX-License-Identifier: MIT
|
|
136
|
-
pragma solidity 0.8.
|
|
136
|
+
pragma solidity 0.8.15;
|
|
137
137
|
|
|
138
138
|
contract VariableTypesMixed {
|
|
139
139
|
uint256 public a;
|
|
@@ -180,7 +180,7 @@ printWidth: 80
|
|
|
180
180
|
| printWidth
|
|
181
181
|
=====================================input======================================
|
|
182
182
|
// SPDX-License-Identifier: MIT
|
|
183
|
-
pragma solidity 0.8.
|
|
183
|
+
pragma solidity 0.8.15;
|
|
184
184
|
|
|
185
185
|
contract VariableTypesMixed {
|
|
186
186
|
uint256 public a;
|
|
@@ -218,7 +218,7 @@ contract VariableTypesMixed {
|
|
|
218
218
|
|
|
219
219
|
=====================================output=====================================
|
|
220
220
|
// SPDX-License-Identifier: MIT
|
|
221
|
-
pragma solidity 0.8.
|
|
221
|
+
pragma solidity 0.8.15;
|
|
222
222
|
|
|
223
223
|
contract VariableTypesMixed {
|
|
224
224
|
uint256 public a;
|
|
@@ -9,7 +9,7 @@ singleQuote: false
|
|
|
9
9
|
| printWidth
|
|
10
10
|
=====================================input======================================
|
|
11
11
|
// SPDX-License-Identifier: MIT
|
|
12
|
-
pragma solidity 0.8.
|
|
12
|
+
pragma solidity 0.8.15;
|
|
13
13
|
|
|
14
14
|
contract HexLiteral {
|
|
15
15
|
bytes8 hex1 = hex'DeadBeef';
|
|
@@ -18,7 +18,7 @@ contract HexLiteral {
|
|
|
18
18
|
|
|
19
19
|
=====================================output=====================================
|
|
20
20
|
// SPDX-License-Identifier: MIT
|
|
21
|
-
pragma solidity 0.8.
|
|
21
|
+
pragma solidity 0.8.15;
|
|
22
22
|
|
|
23
23
|
contract HexLiteral {
|
|
24
24
|
bytes8 hex1 = hex"DeadBeef";
|
|
@@ -37,7 +37,7 @@ singleQuote: true
|
|
|
37
37
|
| printWidth
|
|
38
38
|
=====================================input======================================
|
|
39
39
|
// SPDX-License-Identifier: MIT
|
|
40
|
-
pragma solidity 0.8.
|
|
40
|
+
pragma solidity 0.8.15;
|
|
41
41
|
|
|
42
42
|
contract HexLiteral {
|
|
43
43
|
bytes8 hex1 = hex'DeadBeef';
|
|
@@ -46,7 +46,7 @@ contract HexLiteral {
|
|
|
46
46
|
|
|
47
47
|
=====================================output=====================================
|
|
48
48
|
// SPDX-License-Identifier: MIT
|
|
49
|
-
pragma solidity 0.8.
|
|
49
|
+
pragma solidity 0.8.15;
|
|
50
50
|
|
|
51
51
|
contract HexLiteral {
|
|
52
52
|
bytes8 hex1 = hex'DeadBeef';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
using Lib for uint;
|
|
2
|
+
using Lib for
|
|
3
|
+
uint global;
|
|
4
|
+
using { f} for uint;
|
|
5
|
+
using {f } for uint global;
|
|
6
|
+
using { a, very, long, and, complex, Function, list, with, long, names } for
|
|
7
|
+
uint;
|
|
8
|
+
using { a, very,
|
|
9
|
+
long, and, complex, Function,
|
|
10
|
+
list, with, long, names } for uint global;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Libraries.sol - {"bracketSpacing":true} format 1`] = `
|
|
4
|
+
====================================options=====================================
|
|
5
|
+
bracketSpacing: true
|
|
6
|
+
parsers: ["solidity-parse"]
|
|
7
|
+
printWidth: 80
|
|
8
|
+
| printWidth
|
|
9
|
+
=====================================input======================================
|
|
10
|
+
using Lib for uint;
|
|
11
|
+
using Lib for
|
|
12
|
+
uint global;
|
|
13
|
+
using { f} for uint;
|
|
14
|
+
using {f } for uint global;
|
|
15
|
+
using { a, very, long, and, complex, Function, list, with, long, names } for
|
|
16
|
+
uint;
|
|
17
|
+
using { a, very,
|
|
18
|
+
long, and, complex, Function,
|
|
19
|
+
list, with, long, names } for uint global;
|
|
20
|
+
|
|
21
|
+
=====================================output=====================================
|
|
22
|
+
using Lib for uint256;
|
|
23
|
+
using Lib for uint256 global;
|
|
24
|
+
using { f } for uint256;
|
|
25
|
+
using { f } for uint256 global;
|
|
26
|
+
using {
|
|
27
|
+
a,
|
|
28
|
+
very,
|
|
29
|
+
long,
|
|
30
|
+
and,
|
|
31
|
+
complex,
|
|
32
|
+
Function,
|
|
33
|
+
list,
|
|
34
|
+
with,
|
|
35
|
+
long,
|
|
36
|
+
names
|
|
37
|
+
} for uint256;
|
|
38
|
+
using {
|
|
39
|
+
a,
|
|
40
|
+
very,
|
|
41
|
+
long,
|
|
42
|
+
and,
|
|
43
|
+
complex,
|
|
44
|
+
Function,
|
|
45
|
+
list,
|
|
46
|
+
with,
|
|
47
|
+
long,
|
|
48
|
+
names
|
|
49
|
+
} for uint256 global;
|
|
50
|
+
|
|
51
|
+
================================================================================
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
exports[`Libraries.sol format 1`] = `
|
|
55
|
+
====================================options=====================================
|
|
56
|
+
parsers: ["solidity-parse"]
|
|
57
|
+
printWidth: 80
|
|
58
|
+
| printWidth
|
|
59
|
+
=====================================input======================================
|
|
60
|
+
using Lib for uint;
|
|
61
|
+
using Lib for
|
|
62
|
+
uint global;
|
|
63
|
+
using { f} for uint;
|
|
64
|
+
using {f } for uint global;
|
|
65
|
+
using { a, very, long, and, complex, Function, list, with, long, names } for
|
|
66
|
+
uint;
|
|
67
|
+
using { a, very,
|
|
68
|
+
long, and, complex, Function,
|
|
69
|
+
list, with, long, names } for uint global;
|
|
70
|
+
|
|
71
|
+
=====================================output=====================================
|
|
72
|
+
using Lib for uint256;
|
|
73
|
+
using Lib for uint256 global;
|
|
74
|
+
using {f} for uint256;
|
|
75
|
+
using {f} for uint256 global;
|
|
76
|
+
using {
|
|
77
|
+
a,
|
|
78
|
+
very,
|
|
79
|
+
long,
|
|
80
|
+
and,
|
|
81
|
+
complex,
|
|
82
|
+
Function,
|
|
83
|
+
list,
|
|
84
|
+
with,
|
|
85
|
+
long,
|
|
86
|
+
names
|
|
87
|
+
} for uint256;
|
|
88
|
+
using {
|
|
89
|
+
a,
|
|
90
|
+
very,
|
|
91
|
+
long,
|
|
92
|
+
and,
|
|
93
|
+
complex,
|
|
94
|
+
Function,
|
|
95
|
+
list,
|
|
96
|
+
with,
|
|
97
|
+
long,
|
|
98
|
+
names
|
|
99
|
+
} for uint256 global;
|
|
100
|
+
|
|
101
|
+
================================================================================
|
|
102
|
+
`;
|
|
@@ -11,6 +11,8 @@ contract ModifierDefinitions {
|
|
|
11
11
|
modifier oneParam(uint a) {}
|
|
12
12
|
modifier twoParams(uint a,uint b) {}
|
|
13
13
|
modifier threeParams(uint a,uint b ,uint c) {}
|
|
14
|
+
modifier test() virtual;
|
|
15
|
+
modifier test() virtual {}
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
=====================================output=====================================
|
|
@@ -23,6 +25,8 @@ contract ModifierDefinitions {
|
|
|
23
25
|
uint256 b,
|
|
24
26
|
uint256 c
|
|
25
27
|
) {}
|
|
28
|
+
modifier test() virtual;
|
|
29
|
+
modifier test() virtual {}
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
================================================================================
|
|
@@ -7,7 +7,7 @@ printWidth: 80
|
|
|
7
7
|
| printWidth
|
|
8
8
|
=====================================input======================================
|
|
9
9
|
// SPDX-License-Identifier: MIT
|
|
10
|
-
pragma solidity 0.8.
|
|
10
|
+
pragma solidity 0.8.15;
|
|
11
11
|
|
|
12
12
|
contract ModifierDefinitions {
|
|
13
13
|
// We enforce the use of parentheses in modifiers without parameters.
|
|
@@ -26,7 +26,7 @@ contract ModifierInvocations is ModifierDefinitions {
|
|
|
26
26
|
|
|
27
27
|
=====================================output=====================================
|
|
28
28
|
// SPDX-License-Identifier: MIT
|
|
29
|
-
pragma solidity 0.8.
|
|
29
|
+
pragma solidity 0.8.15;
|
|
30
30
|
|
|
31
31
|
contract ModifierDefinitions {
|
|
32
32
|
// We enforce the use of parentheses in modifiers without parameters.
|