@@ -160,10 +160,13 @@ internal class RangeFieldView : View<FieldRef, RangeField, RangeField.Builder>()
160160private fun RangeOptionMetadata.checkDelimiter (): String =
161161 DELIMITER .find(range)?.value
162162 ? : Compilation .error(file, field.span) {
163- " The `($RANGE )` option could not parse the range value `$range ` specified for" +
164- " `${field.qualifiedName} ` field. The lower and upper bounds should be" +
165- " separated either with `..` or ` .. ` delimiter. Examples of the correct " +
166- " ranges: `(0..10]`, `[0 .. 10)`."
163+ """
164+ The `($RANGE )` option could not parse the passed range value.
165+ The passed value: `$range `.
166+ Target field: `${field.qualifiedName} `.
167+ Reason: the lower and upper bounds should be separated either with `..` or ` .. ` delimiter.
168+ Examples of the correct ranges: `(0..10]`, `[0 .. 10)`.
169+ """ .trimIndent()
167170 }
168171
169172private fun RangeOptionMetadata.checkBrackets (
@@ -174,30 +177,40 @@ private fun RangeOptionMetadata.checkBrackets(
174177 ' (' -> true
175178 ' [' -> false
176179 else -> Compilation .error(file, field.span) {
177- " The `($RANGE )` option could not parse the range value `$range ` specified for" +
178- " `${field.qualifiedName} ` field. The lower bound should begin either" +
179- " with `(` for exclusive or `[` for inclusive values. Examples of" +
180- " the correct ranges: `(0..10]`, `(0..10)`, `[5..100]`."
180+ """
181+ The `($RANGE )` option could not parse the passed range value.
182+ The passed value: `$range `.
183+ Target field: `${field.qualifiedName} `.
184+ Reason: the lower bound should begin either with `(` for exclusive or `[` for inclusive values.
185+ Examples of the correct lower bounds: `(5`, `[3`.
186+ """ .trimIndent()
181187 }
182188 }
183189 val upperExclusive = when (upper.last()) {
184190 ' )' -> true
185191 ' ]' -> false
186192 else -> Compilation .error(file, field.span) {
187- " The `($RANGE )` option could not parse the range value `$range ` specified for" +
188- " `${field.qualifiedName} ` field. The upper bound should end either" +
189- " with `)` for exclusive or `]` for inclusive values. Examples of" +
190- " the correct ranges: `(0..10]`, `(0..10)`, `[5..100]`."
193+ """
194+ The `($RANGE )` option could not parse the passed range value.
195+ The passed value: `$range `.
196+ Target field: `${field.qualifiedName} `.
197+ Reason: the upper bound should end either with `)` for exclusive or `]` for inclusive values.
198+ Examples of the correct upper bounds: `5)`, `3]`.
199+ """ .trimIndent()
191200 }
192201 }
193202 return lowerExclusive to upperExclusive
194203}
195204
196205private fun RangeOptionMetadata.checkRelation (lower : KNumericBound , upper : KNumericBound ) {
197206 Compilation .check(lower <= upper, file, field.span) {
198- " The `($RANGE )` option could not parse the range value `$range ` specified for" +
199- " `${field.qualifiedName} ` field. The lower bound `${lower.value} ` should be" +
200- " less than the upper `${upper.value} `."
207+ """
208+ The `($RANGE )` option could not parse the passed range value.
209+ The passed value: `$range `.
210+ Target field: `${field.qualifiedName} `.
211+ Reason: the lower bound `${lower.value} ` must be less than the upper `${upper.value} ` bound.
212+ Examples of the correct ranges: `(-5..5]`, `[0 .. 10)`.
213+ """ .trimIndent()
201214 }
202215}
203216
0 commit comments