@@ -24,6 +24,24 @@ contract ModifierInvocations is ModifierDefinitions {
2424 function test() public emptyParams noParams() {}
2525}
2626
27+ library ModifierInvocationsLibrary {
28+ // We enforce the use of parentheses in modifiers without parameters.
29+ modifier emptyParams {_;}
30+ modifier noParams () {_;}
31+
32+ modifier nonZero (uint x ) {
33+ require (x != 0);
34+ _;
35+ }
36+
37+ function isPrime (uint x ) public nonZero (x ) returns (bool ) {
38+ // Complicated logic here
39+ }
40+
41+ // We remove parentheses in modifiers without arguments.
42+ function test() public emptyParams noParams() {}
43+ }
44+
2745=====================================output=====================================
2846// SPDX-License-Identifier: MIT
2947pragma solidity 0.8.34;
@@ -47,5 +65,27 @@ contract ModifierInvocations is ModifierDefinitions {
4765 function test() public emptyParams noParams {}
4866}
4967
68+ library ModifierInvocationsLibrary {
69+ // We enforce the use of parentheses in modifiers without parameters.
70+ modifier emptyParams () {
71+ _;
72+ }
73+ modifier noParams () {
74+ _;
75+ }
76+
77+ modifier nonZero (uint x ) {
78+ require(x != 0);
79+ _;
80+ }
81+
82+ function isPrime(uint x ) public nonZero(x ) returns (bool ) {
83+ // Complicated logic here
84+ }
85+
86+ // We remove parentheses in modifiers without arguments.
87+ function test() public emptyParams noParams {}
88+ }
89+
5090================================================================================
5191` ;
0 commit comments