From 42210a473b3e30cb66e673c5aaaf0f9f76fc8ba6 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Thu, 14 Mar 2024 12:47:56 +0100 Subject: [PATCH 1/2] Remove float analysis from sem/guards --- compiler/sem/guards.nim | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/compiler/sem/guards.nim b/compiler/sem/guards.nim index 2d3f31f6652..a3fefb188dc 100644 --- a/compiler/sem/guards.nim +++ b/compiler/sem/guards.nim @@ -39,14 +39,22 @@ from compiler/ast/reports_sem import reportAst, from compiler/ast/report_enums import ReportKind const - someEq = {mEqI, mEqF64, mEqEnum, mEqCh, mEqB, mEqRef, mEqProc, + # Float operations are not analysed as + # it is currently unclear wether they + # can be analysed in a sound manner + # with the approach used here + someEq = {mEqI, mEqEnum, mEqCh, mEqB, mEqRef, mEqProc, mEqStr, mEqSet, mEqCString} + # `mEqF64` excluded here as it lacks the + # substition and reflexivity property # set excluded here as the semantics are vastly different: - someLe = {mLeI, mLeF64, mLeU, mLeEnum, + someLe = {mLeI, mLeU, mLeEnum, mLeCh, mLeB, mLePtr, mLeStr} + # `mLeF64` excluded here since it's not a total order someLt = {mLtI, mLtF64, mLtU, mLtEnum, mLtCh, mLtB, mLtPtr, mLtStr} + # `mLtF64` excluded here since it's not a strict total order someLen = {mLengthOpenArray, mLengthStr, mLengthArray, mLengthSeq} @@ -55,10 +63,14 @@ const someHigh = {mHigh} # we don't list unsigned here because wrap around semantics suck for # proving anything: - someAdd = {mAddI, mAddF64, mSucc} - someSub = {mSubI, mSubF64, mPred} - someMul = {mMulI, mMulF64} - someDiv = {mDivI, mDivF64} + someAdd = {mAddI, mSucc} + # No `mAddF64` since float ops aren't analysed + someSub = {mSubI, mPred} + # No `mSubF64` since float ops aren't analysed + someMul = {mMulI} + # No `mMulF64` since float ops aren't analysed + someDiv = {mDivI} + # No `mDivF64` since float ops aren't analysed someMax = {mMaxI} someMin = {mMinI} someBinaryOp = someAdd+someSub+someMul+someMax+someMin From 96fcfdaa43bfc7468865e845d404c8fd295c7f99 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Thu, 14 Mar 2024 14:34:45 +0100 Subject: [PATCH 2/2] Fix typo in compiler/sem/guards.nim Co-authored-by: Saem Ghani --- compiler/sem/guards.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/sem/guards.nim b/compiler/sem/guards.nim index a3fefb188dc..bca5b672e4d 100644 --- a/compiler/sem/guards.nim +++ b/compiler/sem/guards.nim @@ -40,7 +40,7 @@ from compiler/ast/report_enums import ReportKind const # Float operations are not analysed as - # it is currently unclear wether they + # it is currently unclear whether they # can be analysed in a sound manner # with the approach used here someEq = {mEqI, mEqEnum, mEqCh, mEqB, mEqRef, mEqProc,