Scripting: improve reporting on cyclic dependency

#KT-48177 fixed
the issue is in fact fixed by the previous commit (report error
on duplicated import) by normalizing import path before processing,
but here we're making error reporting nicer for the case.
This commit is contained in:
Ilya Chernikov
2021-08-17 17:25:47 +02:00
committed by TeamCityServer
parent c204d7a86f
commit e60e80f19a
7 changed files with 86 additions and 51 deletions
@@ -147,6 +147,17 @@ inline fun<T, R> Iterable<T>.mapSuccess(body: (T) -> ResultWithDiagnostics<R>):
results.add(r)
}
/**
* maps transformation ([body]) over iterable merging diagnostics
* return failure with merged diagnostics after first failed transformation
* and success with merged diagnostics and list of not null results if all transformations succeeded
*/
inline fun<T, R> Iterable<T>.mapNotNullSuccess(body: (T) -> ResultWithDiagnostics<R?>): ResultWithDiagnostics<List<R>> =
mapSuccessImpl(body) { results, r ->
if (r != null)
results.add(r)
}
/**
* maps transformation ([body]) over iterable merging diagnostics and flatten the results
* return failure with merged diagnostics after first failed transformation