prettier-plugin-solidity 1.0.0-beta.18 → 1.0.0-beta.19

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.
Files changed (29) hide show
  1. package/.github/workflows/CI.yml +6 -6
  2. package/package.json +16 -12
  3. package/src/nodes/TypeDefinition.js +5 -0
  4. package/src/nodes/index.js +1 -0
  5. package/src/parser.js +0 -9
  6. package/tests/format/ExplicitVariableTypes/ExplicitVariableTypes.sol +1 -1
  7. package/tests/format/ExplicitVariableTypes/__snapshots__/jsfmt.spec.js.snap +6 -6
  8. package/tests/format/HexLiteral/HexLiteral.sol +1 -1
  9. package/tests/format/HexLiteral/__snapshots__/jsfmt.spec.js.snap +4 -4
  10. package/tests/format/ModifierInvocations/ModifierInvocations.sol +1 -1
  11. package/tests/format/ModifierInvocations/__snapshots__/jsfmt.spec.js.snap +2 -2
  12. package/tests/format/Parentheses/AddNoParentheses.sol +1 -1
  13. package/tests/format/Parentheses/BitAndNoParentheses.sol +1 -1
  14. package/tests/format/Parentheses/BitOrNoParentheses.sol +1 -1
  15. package/tests/format/Parentheses/BitXorNoParentheses.sol +1 -1
  16. package/tests/format/Parentheses/DivNoParentheses.sol +1 -1
  17. package/tests/format/Parentheses/ExpNoParentheses.sol +1 -1
  18. package/tests/format/Parentheses/LogicNoParentheses.sol +1 -1
  19. package/tests/format/Parentheses/ModNoParentheses.sol +1 -1
  20. package/tests/format/Parentheses/MulNoParentheses.sol +1 -1
  21. package/tests/format/Parentheses/ShiftLNoParentheses.sol +1 -1
  22. package/tests/format/Parentheses/ShiftRNoParentheses.sol +1 -1
  23. package/tests/format/Parentheses/SubNoParentheses.sol +1 -1
  24. package/tests/format/Parentheses/__snapshots__/jsfmt.spec.js.snap +24 -24
  25. package/tests/format/Pragma/Pragma.sol +1 -0
  26. package/tests/format/Pragma/__snapshots__/jsfmt.spec.js.snap +2 -0
  27. package/tests/format/TypeDefinition/TypeDefinition.sol +12 -0
  28. package/tests/format/TypeDefinition/__snapshots__/jsfmt.spec.js.snap +74 -0
  29. package/tests/format/TypeDefinition/jsfmt.spec.js +1 -0
@@ -15,7 +15,7 @@ jobs:
15
15
  steps:
16
16
  - uses: actions/setup-node@v1
17
17
  with:
18
- node-version: 12
18
+ node-version: 14
19
19
  - uses: actions/checkout@v2
20
20
  - uses: actions/cache@v2
21
21
  id: cache
@@ -33,7 +33,7 @@ jobs:
33
33
  runs-on: ubuntu-latest
34
34
  strategy:
35
35
  matrix:
36
- node: [12, 14, 15]
36
+ node: [14, 16]
37
37
  steps:
38
38
  - uses: actions/setup-node@v1
39
39
  with:
@@ -51,12 +51,12 @@ jobs:
51
51
  run: npm run test:all
52
52
 
53
53
  test_macos:
54
- name: Test on MacOS with Node 12
54
+ name: Test on MacOS with Node 14
55
55
  runs-on: macos-latest
56
56
  steps:
57
57
  - uses: actions/setup-node@v1
58
58
  with:
59
- node-version: 12
59
+ node-version: 14
60
60
  - uses: actions/checkout@v2
61
61
  - uses: actions/cache@v2
62
62
  id: cache
@@ -70,12 +70,12 @@ jobs:
70
70
  run: npm run test:all
71
71
 
72
72
  test_windows:
73
- name: Test on Windows with Node 12
73
+ name: Test on Windows with Node 14
74
74
  runs-on: windows-latest
75
75
  steps:
76
76
  - uses: actions/setup-node@v1
77
77
  with:
78
- node-version: 12
78
+ node-version: 14
79
79
  - uses: actions/checkout@v2
80
80
  - name: Install
81
81
  run: npm install
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-solidity",
3
- "version": "1.0.0-beta.18",
3
+ "version": "1.0.0-beta.19",
4
4
  "description": "A Prettier Plugin for automatically formatting your Solidity code.",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -50,6 +50,10 @@
50
50
  {
51
51
  "email": "klahott@gmail.com",
52
52
  "name": "Klaus Hott Vidal"
53
+ },
54
+ {
55
+ "email": "soham@zemse.in",
56
+ "name": "Soham Zemse"
53
57
  }
54
58
  ],
55
59
  "license": "MIT",
@@ -61,30 +65,30 @@
61
65
  "node": ">=12"
62
66
  },
63
67
  "devDependencies": {
64
- "@babel/code-frame": "^7.14.5",
68
+ "@babel/code-frame": "^7.16.0",
65
69
  "cross-env": "^7.0.3",
66
70
  "dir-to-object": "^2.0.0",
67
- "eslint": "^7.32.0",
68
- "eslint-config-airbnb-base": "^14.2.1",
71
+ "eslint": "^8.2.0",
72
+ "eslint-config-airbnb-base": "^15.0.0",
69
73
  "eslint-config-prettier": "^8.3.0",
70
- "eslint-plugin-import": "^2.24.2",
71
- "jest": "^27.1.0",
74
+ "eslint-plugin-import": "^2.25.3",
75
+ "jest": "^27.3.1",
72
76
  "jest-mock-now": "^1.3.0",
73
77
  "jest-snapshot-serializer-ansi": "^1.0.0",
74
78
  "jest-snapshot-serializer-raw": "^1.2.0",
75
- "jest-watch-typeahead": "^0.6.4",
79
+ "jest-watch-typeahead": "^1.0.0",
76
80
  "lines-and-columns": "^1.1.6",
77
81
  "outdent": "^0.8.0",
78
- "prettier": "^2.3.2",
79
- "solc": "^0.8.7-fixed"
82
+ "prettier": "^2.4.1",
83
+ "solc": "^0.8.10"
80
84
  },
81
85
  "dependencies": {
82
- "@solidity-parser/parser": "^0.13.2",
83
- "emoji-regex": "^9.2.2",
86
+ "@solidity-parser/parser": "^0.14.0",
87
+ "emoji-regex": "^10.0.0",
84
88
  "escape-string-regexp": "^4.0.0",
85
89
  "semver": "^7.3.5",
86
90
  "solidity-comments-extractor": "^0.0.7",
87
- "string-width": "^4.2.2"
91
+ "string-width": "^4.2.3"
88
92
  },
89
93
  "peerDependencies": {
90
94
  "prettier": "^2.3.0"
@@ -0,0 +1,5 @@
1
+ const TypeDefinition = {
2
+ print: ({ node }) => ['type ', node.name, ' is ', node.definition.name, ';']
3
+ };
4
+
5
+ module.exports = TypeDefinition;
@@ -65,6 +65,7 @@ module.exports = {
65
65
  ThrowStatement: require('./ThrowStatement'),
66
66
  TryStatement: require('./TryStatement'),
67
67
  TupleExpression: require('./TupleExpression'),
68
+ TypeDefinition: require('./TypeDefinition'),
68
69
  TypeNameExpression: require('./TypeNameExpression'),
69
70
  UnaryOperation: require('./UnaryOperation'),
70
71
  UncheckedStatement: require('./UncheckedStatement'),
package/src/parser.js CHANGED
@@ -20,15 +20,6 @@ function parse(text, _parsers, options) {
20
20
 
21
21
  parser.visit(parsed, {
22
22
  PragmaDirective(ctx) {
23
- // @TODO: remove hack once the retrieval of @solidity-parser/parser is fixed
24
- ctx.value = ctx.value
25
- .replace(/([<>=])/g, ' $1')
26
- .replace(/< =/g, '<=')
27
- .replace(/> =/g, '>=')
28
- .trim();
29
- if (ctx.value.split(' ').length > 1) {
30
- ctx.value = semver.validRange(ctx.value);
31
- }
32
23
  // if the pragma is not for solidity we leave.
33
24
  if (ctx.name !== 'solidity') return;
34
25
  // if the compiler option has not been provided we leave.
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract VariableTypesMixed {
5
5
  uint256 public a;
@@ -9,7 +9,7 @@ printWidth: 80
9
9
  | printWidth
10
10
  =====================================input======================================
11
11
  // SPDX-License-Identifier: MIT
12
- pragma solidity 0.8.7;
12
+ pragma solidity 0.8.10;
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.7;
50
+ pragma solidity 0.8.10;
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.7;
98
+ pragma solidity 0.8.10;
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.7;
136
+ pragma solidity 0.8.10;
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.7;
183
+ pragma solidity 0.8.10;
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.7;
221
+ pragma solidity 0.8.10;
222
222
 
223
223
  contract VariableTypesMixed {
224
224
  uint256 public a;
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract HexLiteral {
5
5
  bytes8 hex1 = hex'DeadBeef';
@@ -9,7 +9,7 @@ singleQuote: false
9
9
  | printWidth
10
10
  =====================================input======================================
11
11
  // SPDX-License-Identifier: MIT
12
- pragma solidity 0.8.7;
12
+ pragma solidity 0.8.10;
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.7;
21
+ pragma solidity 0.8.10;
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.7;
40
+ pragma solidity 0.8.10;
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.7;
49
+ pragma solidity 0.8.10;
50
50
 
51
51
  contract HexLiteral {
52
52
  bytes8 hex1 = hex'DeadBeef';
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract ModifierDefinitions {
5
5
  // We enforce the use of parentheses in modifiers without parameters.
@@ -7,7 +7,7 @@ printWidth: 80
7
7
  | printWidth
8
8
  =====================================input======================================
9
9
  // SPDX-License-Identifier: MIT
10
- pragma solidity 0.8.7;
10
+ pragma solidity 0.8.10;
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.7;
29
+ pragma solidity 0.8.10;
30
30
 
31
31
  contract ModifierDefinitions {
32
32
  // We enforce the use of parentheses in modifiers without parameters.
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract AddNoParentheses {
5
5
  function addAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract BitAndNoParentheses {
5
5
  function bitAndAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract BitOrNoParentheses {
5
5
  function bitOrAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract BitXorNoParentheses {
5
5
  function bitXorAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract DivNoParentheses {
5
5
  function divAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract ExpNoParentheses {
5
5
  function expAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract LogicNoParentheses {
5
5
  function orOr(bool a, bool b, bool c) public pure returns (bool) {
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract ModNoParentheses {
5
5
  function modAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract MulNoParentheses {
5
5
  function mulAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract ShiftLNoParentheses {
5
5
  function shiftLAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract ShiftRNoParentheses {
5
5
  function shiftRAdd(uint256 a, uint256 b, uint256 c)
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.7;
2
+ pragma solidity 0.8.10;
3
3
 
4
4
  contract SubNoParentheses {
5
5
  function subAdd(uint256 a, uint256 b, uint256 c)
@@ -8,7 +8,7 @@ printWidth: 80
8
8
  | printWidth
9
9
  =====================================input======================================
10
10
  // SPDX-License-Identifier: MIT
11
- pragma solidity 0.8.7;
11
+ pragma solidity 0.8.10;
12
12
 
13
13
  contract AddNoParentheses {
14
14
  function addAdd(uint256 a, uint256 b, uint256 c)
@@ -102,7 +102,7 @@ contract AddNoParentheses {
102
102
 
103
103
  =====================================output=====================================
104
104
  // SPDX-License-Identifier: MIT
105
- pragma solidity 0.8.7;
105
+ pragma solidity 0.8.10;
106
106
 
107
107
  contract AddNoParentheses {
108
108
  function addAdd(
@@ -205,7 +205,7 @@ printWidth: 80
205
205
  | printWidth
206
206
  =====================================input======================================
207
207
  // SPDX-License-Identifier: MIT
208
- pragma solidity 0.8.7;
208
+ pragma solidity 0.8.10;
209
209
 
210
210
  contract BitAndNoParentheses {
211
211
  function bitAndAdd(uint256 a, uint256 b, uint256 c)
@@ -299,7 +299,7 @@ contract BitAndNoParentheses {
299
299
 
300
300
  =====================================output=====================================
301
301
  // SPDX-License-Identifier: MIT
302
- pragma solidity 0.8.7;
302
+ pragma solidity 0.8.10;
303
303
 
304
304
  contract BitAndNoParentheses {
305
305
  function bitAndAdd(
@@ -402,7 +402,7 @@ printWidth: 80
402
402
  | printWidth
403
403
  =====================================input======================================
404
404
  // SPDX-License-Identifier: MIT
405
- pragma solidity 0.8.7;
405
+ pragma solidity 0.8.10;
406
406
 
407
407
  contract BitOrNoParentheses {
408
408
  function bitOrAdd(uint256 a, uint256 b, uint256 c)
@@ -496,7 +496,7 @@ contract BitOrNoParentheses {
496
496
 
497
497
  =====================================output=====================================
498
498
  // SPDX-License-Identifier: MIT
499
- pragma solidity 0.8.7;
499
+ pragma solidity 0.8.10;
500
500
 
501
501
  contract BitOrNoParentheses {
502
502
  function bitOrAdd(
@@ -599,7 +599,7 @@ printWidth: 80
599
599
  | printWidth
600
600
  =====================================input======================================
601
601
  // SPDX-License-Identifier: MIT
602
- pragma solidity 0.8.7;
602
+ pragma solidity 0.8.10;
603
603
 
604
604
  contract BitXorNoParentheses {
605
605
  function bitXorAdd(uint256 a, uint256 b, uint256 c)
@@ -693,7 +693,7 @@ contract BitXorNoParentheses {
693
693
 
694
694
  =====================================output=====================================
695
695
  // SPDX-License-Identifier: MIT
696
- pragma solidity 0.8.7;
696
+ pragma solidity 0.8.10;
697
697
 
698
698
  contract BitXorNoParentheses {
699
699
  function bitXorAdd(
@@ -796,7 +796,7 @@ printWidth: 80
796
796
  | printWidth
797
797
  =====================================input======================================
798
798
  // SPDX-License-Identifier: MIT
799
- pragma solidity 0.8.7;
799
+ pragma solidity 0.8.10;
800
800
 
801
801
  contract DivNoParentheses {
802
802
  function divAdd(uint256 a, uint256 b, uint256 c)
@@ -890,7 +890,7 @@ contract DivNoParentheses {
890
890
 
891
891
  =====================================output=====================================
892
892
  // SPDX-License-Identifier: MIT
893
- pragma solidity 0.8.7;
893
+ pragma solidity 0.8.10;
894
894
 
895
895
  contract DivNoParentheses {
896
896
  function divAdd(
@@ -993,7 +993,7 @@ printWidth: 80
993
993
  | printWidth
994
994
  =====================================input======================================
995
995
  // SPDX-License-Identifier: MIT
996
- pragma solidity 0.8.7;
996
+ pragma solidity 0.8.10;
997
997
 
998
998
  contract ExpNoParentheses {
999
999
  function expAdd(uint256 a, uint256 b, uint256 c)
@@ -1087,7 +1087,7 @@ contract ExpNoParentheses {
1087
1087
 
1088
1088
  =====================================output=====================================
1089
1089
  // SPDX-License-Identifier: MIT
1090
- pragma solidity 0.8.7;
1090
+ pragma solidity 0.8.10;
1091
1091
 
1092
1092
  contract ExpNoParentheses {
1093
1093
  function expAdd(
@@ -1190,7 +1190,7 @@ printWidth: 80
1190
1190
  | printWidth
1191
1191
  =====================================input======================================
1192
1192
  // SPDX-License-Identifier: MIT
1193
- pragma solidity 0.8.7;
1193
+ pragma solidity 0.8.10;
1194
1194
 
1195
1195
  contract LogicNoParentheses {
1196
1196
  function orOr(bool a, bool b, bool c) public pure returns (bool) {
@@ -1212,7 +1212,7 @@ contract LogicNoParentheses {
1212
1212
 
1213
1213
  =====================================output=====================================
1214
1214
  // SPDX-License-Identifier: MIT
1215
- pragma solidity 0.8.7;
1215
+ pragma solidity 0.8.10;
1216
1216
 
1217
1217
  contract LogicNoParentheses {
1218
1218
  function orOr(
@@ -1259,7 +1259,7 @@ printWidth: 80
1259
1259
  | printWidth
1260
1260
  =====================================input======================================
1261
1261
  // SPDX-License-Identifier: MIT
1262
- pragma solidity 0.8.7;
1262
+ pragma solidity 0.8.10;
1263
1263
 
1264
1264
  contract ModNoParentheses {
1265
1265
  function modAdd(uint256 a, uint256 b, uint256 c)
@@ -1353,7 +1353,7 @@ contract ModNoParentheses {
1353
1353
 
1354
1354
  =====================================output=====================================
1355
1355
  // SPDX-License-Identifier: MIT
1356
- pragma solidity 0.8.7;
1356
+ pragma solidity 0.8.10;
1357
1357
 
1358
1358
  contract ModNoParentheses {
1359
1359
  function modAdd(
@@ -1456,7 +1456,7 @@ printWidth: 80
1456
1456
  | printWidth
1457
1457
  =====================================input======================================
1458
1458
  // SPDX-License-Identifier: MIT
1459
- pragma solidity 0.8.7;
1459
+ pragma solidity 0.8.10;
1460
1460
 
1461
1461
  contract MulNoParentheses {
1462
1462
  function mulAdd(uint256 a, uint256 b, uint256 c)
@@ -1550,7 +1550,7 @@ contract MulNoParentheses {
1550
1550
 
1551
1551
  =====================================output=====================================
1552
1552
  // SPDX-License-Identifier: MIT
1553
- pragma solidity 0.8.7;
1553
+ pragma solidity 0.8.10;
1554
1554
 
1555
1555
  contract MulNoParentheses {
1556
1556
  function mulAdd(
@@ -1653,7 +1653,7 @@ printWidth: 80
1653
1653
  | printWidth
1654
1654
  =====================================input======================================
1655
1655
  // SPDX-License-Identifier: MIT
1656
- pragma solidity 0.8.7;
1656
+ pragma solidity 0.8.10;
1657
1657
 
1658
1658
  contract ShiftLNoParentheses {
1659
1659
  function shiftLAdd(uint256 a, uint256 b, uint256 c)
@@ -1747,7 +1747,7 @@ contract ShiftLNoParentheses {
1747
1747
 
1748
1748
  =====================================output=====================================
1749
1749
  // SPDX-License-Identifier: MIT
1750
- pragma solidity 0.8.7;
1750
+ pragma solidity 0.8.10;
1751
1751
 
1752
1752
  contract ShiftLNoParentheses {
1753
1753
  function shiftLAdd(
@@ -1850,7 +1850,7 @@ printWidth: 80
1850
1850
  | printWidth
1851
1851
  =====================================input======================================
1852
1852
  // SPDX-License-Identifier: MIT
1853
- pragma solidity 0.8.7;
1853
+ pragma solidity 0.8.10;
1854
1854
 
1855
1855
  contract ShiftRNoParentheses {
1856
1856
  function shiftRAdd(uint256 a, uint256 b, uint256 c)
@@ -1944,7 +1944,7 @@ contract ShiftRNoParentheses {
1944
1944
 
1945
1945
  =====================================output=====================================
1946
1946
  // SPDX-License-Identifier: MIT
1947
- pragma solidity 0.8.7;
1947
+ pragma solidity 0.8.10;
1948
1948
 
1949
1949
  contract ShiftRNoParentheses {
1950
1950
  function shiftRAdd(
@@ -2047,7 +2047,7 @@ printWidth: 80
2047
2047
  | printWidth
2048
2048
  =====================================input======================================
2049
2049
  // SPDX-License-Identifier: MIT
2050
- pragma solidity 0.8.7;
2050
+ pragma solidity 0.8.10;
2051
2051
 
2052
2052
  contract SubNoParentheses {
2053
2053
  function subAdd(uint256 a, uint256 b, uint256 c)
@@ -2141,7 +2141,7 @@ contract SubNoParentheses {
2141
2141
 
2142
2142
  =====================================output=====================================
2143
2143
  // SPDX-License-Identifier: MIT
2144
- pragma solidity 0.8.7;
2144
+ pragma solidity 0.8.10;
2145
2145
 
2146
2146
  contract SubNoParentheses {
2147
2147
  function subAdd(
@@ -5,3 +5,4 @@ pragma solidity >0.4.21 <=0.6.0;
5
5
  pragma solidity >=0.4.21<0.6.0;
6
6
  pragma solidity ^ 0.4.21 ;
7
7
  pragma solidity ~ 0.4.21 ;
8
+ pragma solidity ^0.5.0 || ^0.6.0 || ^0.7.0 ;
@@ -13,6 +13,7 @@ pragma solidity >0.4.21 <=0.6.0;
13
13
  pragma solidity >=0.4.21<0.6.0;
14
14
  pragma solidity ^ 0.4.21 ;
15
15
  pragma solidity ~ 0.4.21 ;
16
+ pragma solidity ^0.5.0 || ^0.6.0 || ^0.7.0 ;
16
17
 
17
18
  =====================================output=====================================
18
19
  pragma solidity >=0.4.21 <0.6.0;
@@ -22,6 +23,7 @@ pragma solidity >0.4.21 <=0.6.0;
22
23
  pragma solidity >=0.4.21 <0.6.0;
23
24
  pragma solidity ^0.4.21;
24
25
  pragma solidity ~0.4.21;
26
+ pragma solidity ^0.5.0 || ^0.6.0 || ^0.7.0;
25
27
 
26
28
  ================================================================================
27
29
  `;
@@ -0,0 +1,12 @@
1
+ pragma solidity ^0.8.8;
2
+
3
+ type Hello is uint;
4
+
5
+ contract TypeDefinition {
6
+ event Moon(Hello world);
7
+
8
+ function demo(Hello world) public {
9
+ world = Hello.wrap(Hello.unwrap(world) + 1337);
10
+ emit Moon(world);
11
+ }
12
+ }
@@ -0,0 +1,74 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`TypeDefinition.sol format 1`] = `
4
+ ====================================options=====================================
5
+ parsers: ["solidity-parse"]
6
+ printWidth: 80
7
+ | printWidth
8
+ =====================================input======================================
9
+ pragma solidity ^0.8.8;
10
+
11
+ type Hello is uint;
12
+
13
+ contract TypeDefinition {
14
+ event Moon(Hello world);
15
+
16
+ function demo(Hello world) public {
17
+ world = Hello.wrap(Hello.unwrap(world) + 1337);
18
+ emit Moon(world);
19
+ }
20
+ }
21
+
22
+
23
+ =====================================output=====================================
24
+ pragma solidity ^0.8.8;
25
+
26
+ type Hello is uint256;
27
+
28
+ contract TypeDefinition {
29
+ event Moon(Hello world);
30
+
31
+ function demo(Hello world) public {
32
+ world = Hello.wrap(Hello.unwrap(world) + 1337);
33
+ emit Moon(world);
34
+ }
35
+ }
36
+
37
+ ================================================================================
38
+ `;
39
+
40
+ exports[`TypeDefinition.sol format 1`] = `
41
+ ====================================options=====================================
42
+ parsers: ["solidity-parse"]
43
+ printWidth: 80
44
+ | printWidth
45
+ =====================================input======================================
46
+ pragma solidity ^0.8.8;
47
+
48
+ type Hello is uint;
49
+
50
+ contract TypeDefinition {
51
+ event Moon(Hello world);
52
+
53
+ function demo(Hello world) public {
54
+ world = Hello.wrap(Hello.unwrap(world) + 1337);
55
+ emit Moon(world);
56
+ }
57
+ }
58
+
59
+ =====================================output=====================================
60
+ pragma solidity ^0.8.8;
61
+
62
+ type Hello is uint256;
63
+
64
+ contract TypeDefinition {
65
+ event Moon(Hello world);
66
+
67
+ function demo(Hello world) public {
68
+ world = Hello.wrap(Hello.unwrap(world) + 1337);
69
+ emit Moon(world);
70
+ }
71
+ }
72
+
73
+ ================================================================================
74
+ `;
@@ -0,0 +1 @@
1
+ run_spec(__dirname, ['solidity-parse']);