[FIR] Fix equality for cfg nodes

This commit is contained in:
Dmitriy Novozhilov
2020-03-30 15:50:16 +03:00
parent b90c8eb8ed
commit 9bdd5e47ac
2 changed files with 3 additions and 2 deletions
@@ -102,7 +102,7 @@ sealed class CFGNode<out E : FirElement>(val owner: ControlFlowGraph, val level:
final override fun equals(other: Any?): Boolean {
if (other !is CFGNode<*>) return false
return this.id == other.id
return this === other
}
final override fun hashCode(): Int {
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
import org.jetbrains.kotlin.fir.types.isNothing
import kotlin.random.Random
class ControlFlowGraphBuilder {
private val graphs: Stack<ControlFlowGraph> = stackOf(ControlFlowGraph(null, "<TOP_LEVEL_GRAPH>", ControlFlowGraph.Kind.TopLevel))
@@ -60,7 +61,7 @@ class ControlFlowGraphBuilder {
var levelCounter: Int = 0
private set
private var idCounter: Int = 0
private var idCounter: Int = Random.nextInt()
private val shouldPassFlowFromInplaceLambda: Stack<Boolean> = stackOf(true)
fun createId(): Int = idCounter++