FIR IDE: add more info to CCE in symbol builder
This commit is contained in:
+6
-5
@@ -223,7 +223,7 @@ internal class KtSymbolByFirBuilder private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BuilderCache<From, To> private constructor(
|
private class BuilderCache<From, To: Any> private constructor(
|
||||||
private val cache: ConcurrentMap<From, To>,
|
private val cache: ConcurrentMap<From, To>,
|
||||||
private val isReadOnly: Boolean
|
private val isReadOnly: Boolean
|
||||||
) {
|
) {
|
||||||
@@ -235,10 +235,11 @@ private class BuilderCache<From, To> private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline fun <reified S : To> cache(key: From, calculation: () -> S): S {
|
inline fun <reified S : To> cache(key: From, calculation: () -> S): S {
|
||||||
if (isReadOnly) {
|
val value = if (isReadOnly) {
|
||||||
return (cache[key] ?: calculation()) as S
|
cache[key] ?: calculation()
|
||||||
}
|
} else cache.getOrPut(key, calculation)
|
||||||
return cache.getOrPut(key, calculation) as S
|
return value as? S
|
||||||
|
?: error("Cannot cast ${value::class} to ${S::class}\n${DebugSymbolRenderer.render(value as KtSymbol)}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user