|
| 1 | +package tests.validation.other.declarations.parameterLists.mustNotHaveRequiredAfterOptional |
| 2 | + |
| 3 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 4 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 5 | +// $TEST$ error "After the first optional parameter all parameters must be optional." |
| 6 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 7 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 8 | +annotation MyAnnotation1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) |
| 9 | + |
| 10 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 11 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 12 | +annotation MyAnnotation2(»a«: Int, »b«: Int = 1) |
| 13 | + |
| 14 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 15 | +annotation MyAnnotation3(»a«: Int) |
| 16 | + |
| 17 | + |
| 18 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 19 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 20 | +// $TEST$ error "After the first optional parameter all parameters must be optional." |
| 21 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 22 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 23 | +class MyClass1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) |
| 24 | + |
| 25 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 26 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 27 | +class MyClass2(»a«: Int, »b«: Int = 1) |
| 28 | + |
| 29 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 30 | +class MyClass3(»a«: Int) |
| 31 | + |
| 32 | + |
| 33 | +enum MyEnum { |
| 34 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 35 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 36 | + // $TEST$ error "After the first optional parameter all parameters must be optional." |
| 37 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 38 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 39 | + MyEnumVariant1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) |
| 40 | + |
| 41 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 42 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 43 | + MyEnumVariant2(»a«: Int, »b«: Int = 1) |
| 44 | + |
| 45 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 46 | + MyEnumVariant3(»a«: Int) |
| 47 | +} |
| 48 | + |
| 49 | + |
| 50 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 51 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 52 | +// $TEST$ error "After the first optional parameter all parameters must be optional." |
| 53 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 54 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 55 | +fun myFunction1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) |
| 56 | + |
| 57 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 58 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 59 | +fun myFunction2(»a«: Int, »b«: Int = 1) |
| 60 | + |
| 61 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 62 | +fun myFunction3(»a«: Int) |
| 63 | + |
| 64 | + |
| 65 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 66 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 67 | +// $TEST$ error "After the first optional parameter all parameters must be optional." |
| 68 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 69 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 70 | +segment mySegment1(»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) {} |
| 71 | + |
| 72 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 73 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 74 | +segment mySegment2(»a«: Int, »b«: Int = 1) {} |
| 75 | + |
| 76 | +// $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 77 | +segment mySegment3(»a«: Int) {} |
| 78 | + |
| 79 | + |
| 80 | +pipeline myPipeline { |
| 81 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 82 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 83 | + // $TEST$ error "After the first optional parameter all parameters must be optional." |
| 84 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 85 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 86 | + (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) {}; |
| 87 | + |
| 88 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 89 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 90 | + (»a«: Int, »b«: Int = 1) {}; |
| 91 | + |
| 92 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 93 | + (»a«: Int) {}; |
| 94 | + |
| 95 | + |
| 96 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 97 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 98 | + // $TEST$ error "After the first optional parameter all parameters must be optional." |
| 99 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 100 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 101 | + (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) -> 1; |
| 102 | + |
| 103 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 104 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 105 | + (»a«: Int, »b«: Int = 1) -> 1; |
| 106 | + |
| 107 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 108 | + (»a«: Int) -> 1; |
| 109 | +} |
| 110 | + |
| 111 | + |
| 112 | +fun myFunction4( |
| 113 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 114 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 115 | + // $TEST$ error "After the first optional parameter all parameters must be optional." |
| 116 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 117 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 118 | + p1: (»a«: Int, »b«: Int = 1, »c«: Int, »d«: Int = 2, vararg »e«: Int) -> (), |
| 119 | + |
| 120 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 121 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 122 | + p2: (»a«: Int, »b«: Int = 1) -> (), |
| 123 | + |
| 124 | + // $TEST$ no error "After the first optional parameter all parameters must be optional." |
| 125 | + p3: (»a«: Int) -> (), |
| 126 | +) |
0 commit comments