Răsfoiți Sursa

Fixed incorrectly allowed type mismatch on payload enum case

Brian Fiete 4 ani în urmă
părinte
comite
49c2a69a45
1 a modificat fișierele cu 6 adăugiri și 3 ștergeri
  1. 6 3
      IDEHelper/Compiler/BfStmtEvaluator.cpp

+ 6 - 3
IDEHelper/Compiler/BfStmtEvaluator.cpp

@@ -4464,9 +4464,12 @@ void BfModule::Visit(BfSwitchStatement* switchStmt)
 						}
 					}
 
-					constantInt = mBfIRBuilder->GetConstant(caseValue.mValue);
-					if ((constantInt != NULL) && (!mBfIRBuilder->IsInt(constantInt->mTypeCode)))
-						constantInt = NULL;
+					if (caseValue.mType == switchValue.mType)
+					{
+						constantInt = mBfIRBuilder->GetConstant(caseValue.mValue);
+						if ((constantInt != NULL) && (!mBfIRBuilder->IsInt(constantInt->mTypeCode)))
+							constantInt = NULL;
+					}
 				}
 			}