From a0224f60e6758c53baae471cf6c77dab62ad1652 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 29 Aug 2024 21:04:33 +0200 Subject: [PATCH] wasm gc: fix infinite loop in type inference --- .../backend/wasm/gc/PreciseValueType.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/src/main/java/org/teavm/backend/wasm/gc/PreciseValueType.java b/core/src/main/java/org/teavm/backend/wasm/gc/PreciseValueType.java index d590e534a..092d17cb6 100644 --- a/core/src/main/java/org/teavm/backend/wasm/gc/PreciseValueType.java +++ b/core/src/main/java/org/teavm/backend/wasm/gc/PreciseValueType.java @@ -15,6 +15,7 @@ */ package org.teavm.backend.wasm.gc; +import java.util.Objects; import org.teavm.model.ValueType; public class PreciseValueType { @@ -25,4 +26,22 @@ public class PreciseValueType { this.valueType = valueType; this.isArrayUnwrap = isArrayUnwrap; } + + @Override + public final boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof PreciseValueType)) { + return false; + } + + var that = (PreciseValueType) o; + return isArrayUnwrap == that.isArrayUnwrap && valueType.equals(that.valueType); + } + + @Override + public int hashCode() { + return Objects.hash(valueType, isArrayUnwrap); + } }