diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index be09df25..4d7c9c01 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -7918,15 +7918,19 @@ BfTypedValue BfModule::TryLookupGenericConstVaue(BfIdentifierNode* identifierNod { BfConstExprValueType* constExprValueType = (BfConstExprValueType*)genericParamResult; + auto constType = genericTypeConstraint; + if (constType == NULL) + constType = GetPrimitiveType(BfTypeCode_IntPtr); + BfExprEvaluator exprEvaluator(this); - exprEvaluator.mExpectingType = genericTypeConstraint; + exprEvaluator.mExpectingType = constType; exprEvaluator.GetLiteral(identifierNode, constExprValueType->mValue); if (exprEvaluator.mResult) { - auto castedVal = CastToValue(identifierNode, exprEvaluator.mResult, genericTypeConstraint, (BfCastFlags)(BfCastFlags_Explicit | BfCastFlags_SilentFail)); + auto castedVal = CastToValue(identifierNode, exprEvaluator.mResult, constType, (BfCastFlags)(BfCastFlags_Explicit | BfCastFlags_SilentFail)); if (castedVal) - return BfTypedValue(castedVal, genericTypeConstraint); + return BfTypedValue(castedVal, constType); } return exprEvaluator.mResult;