From 1f9e0204a8d64aa3fb8018e98525739ed04a4111 Mon Sep 17 00:00:00 2001 From: Yongwook Choi Date: Thu, 6 Jul 2023 16:51:16 +0900 Subject: [PATCH 1/2] Fix `lookupStr` not to lookup when `str` is Bottom --- src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala b/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala index 905e29cdc1..6cc8c359b7 100644 --- a/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala +++ b/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala @@ -340,8 +340,9 @@ object TypeDomain extends state.Domain { // string lookup private def lookupStr(str: BSet[String], prop: ValueTy): ValueTy = var res = ValueTy() + if (str.isBottom) return res if (prop.str contains "length") res ||= MathT - if (!str.isBottom && !prop.math.isBottom) res ||= CodeUnitT + if (!prop.math.isBottom) res ||= CodeUnitT // TODO if (!str.isBottom) // boundCheck( // prop, From 22bb76410cd94968e4eff808bcfb2f0216f60889 Mon Sep 17 00:00:00 2001 From: Jihyeok Park Date: Mon, 17 Jul 2023 13:47:46 +0900 Subject: [PATCH 2/2] Refactor code / Remove resolved cases in tycheck-ignore.json --- .../d711ba960cd12b76/tycheck-ignore.json | 3 --- .../analyzer/domain/state/TypeDomain.scala | 24 ++++++++++--------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/resources/manuals/d711ba960cd12b76/tycheck-ignore.json b/src/main/resources/manuals/d711ba960cd12b76/tycheck-ignore.json index 7d67913203..13da68e938 100644 --- a/src/main/resources/manuals/d711ba960cd12b76/tycheck-ignore.json +++ b/src/main/resources/manuals/d711ba960cd12b76/tycheck-ignore.json @@ -29,8 +29,6 @@ "GetGlobalObject", "GetMethod", "GetPromiseResolve", - "GetPrototypeFromConstructor", - "GetSubstitution", "GetThisValue", "GetValue", "InnerModuleEvaluation", @@ -50,7 +48,6 @@ "PerformEval", "ProxyCreate", "SerializeJSONObject", - "SetDefaultGlobalBindings", "SetFunctionLength", "SortIndexedProperties", "SourceTextModuleRecord.ResolveExport", diff --git a/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala b/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala index 6cc8c359b7..de54c25495 100644 --- a/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala +++ b/src/main/scala/esmeta/analyzer/domain/state/TypeDomain.scala @@ -339,17 +339,19 @@ object TypeDomain extends state.Domain { // string lookup private def lookupStr(str: BSet[String], prop: ValueTy): ValueTy = - var res = ValueTy() - if (str.isBottom) return res - if (prop.str contains "length") res ||= MathT - if (!prop.math.isBottom) res ||= CodeUnitT - // TODO if (!str.isBottom) - // boundCheck( - // prop, - // MathT || StrT("length"), - // t => s"invalid access: $t of ${PureValueTy(str = str)}", - // ) - res + if (str.isBottom) ValueTy.Bot + else { + var res = ValueTy.Bot + if (prop.str contains "length") res ||= MathT + if (!prop.math.isBottom) res ||= CodeUnitT + // TODO if (!str.isBottom) + // boundCheck( + // prop, + // MathT || StrT("length"), + // t => s"invalid access: $t of ${PureValueTy(str = str)}", + // ) + res + } // named record lookup private def lookupName(obj: NameTy, prop: ValueTy): ValueTy =