groostav
06/12/2016, 7:34 AMval suggested = avai//...
val footer = if(suggested != null) "things with $suggested" else ""
val nlsvars = "available vars:" + avialableVars.fold{ "\n\t$it" } //or {accum, next -> "$accum\n\t$next" } or one of the many utils to do this.
reportSemanticError("unable to do stuff,$footer$nlsvars)
or
val suggested = avai//...
reportSemanticError(stringBuilder{
append("unable to do stuff")
appendIf(suggested != null) { "did you mean $suggested?" }
append("available variables:")
appendFold(availableVars) { "\n\t$it" }
})