From 7af66a2028e0fd53210ddd96c2330439c598840d Mon Sep 17 00:00:00 2001 From: Victor Lanvin Date: Fri, 13 Sep 2024 05:29:45 -0700 Subject: [PATCH] Remove unsound IllegalStateExceptions in Narrow Summary: These `IllegalStateException`s are actually unsound in presence of `eqwalizer:dynamic/1`, because it can produce types `t` such that `t <: map()` but some children of `t` are not maps. Reviewed By: ilya-klyuchnikov Differential Revision: D62582334 fbshipit-source-id: fd119d239e88e6a41b3732c20e7db4b892747b5a --- .../src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala b/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala index 485cda8..47c68cf 100644 --- a/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala +++ b/eqwalizer/src/main/scala/com/whatsapp/eqwalizer/tc/Narrow.scala @@ -477,7 +477,7 @@ class Narrow(pipelineContext: PipelineContext) { case NoneType => NoneType case _ => - throw new IllegalStateException() + NoneType } def setAllFieldsOptional(mapT: Type, newValTy: Option[Type] = None): Type = @@ -502,7 +502,7 @@ class Narrow(pipelineContext: PipelineContext) { case NoneType => NoneType case _ => - throw new IllegalStateException() + NoneType } def getRecordField(recDecl: RecDeclTyped, recTy: Type, fieldName: String): Type = {