diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 423e6f12..16b1a132 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -5410,7 +5410,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance* return result; } else - { + { auto val = mModule->GetDefaultTypedValue(returnType, true, (GetStructRetIdx(methodInstance) != -1) ? BfDefaultValueKind_Addr : BfDefaultValueKind_Value); if (val.mKind == BfTypedValueKind_Addr) val.mKind = BfTypedValueKind_RestrictedTempAddr; diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 78a5e0e8..86c767d4 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -21850,11 +21850,6 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool { BP_ZONE("BfModule::BfMethodDeclaration"); - if (mCurTypeInstance->IsFunctionFromTypeRef()) - { - NOP; - } - // We could trigger a DoMethodDeclaration from a const resolver or other location, so we reset it here // to effectively make mIgnoreWrites method-scoped SetAndRestoreValue prevIgnoreWrites(mBfIRBuilder->mIgnoreWrites, mWantsIRIgnoreWrites || mCurMethodInstance->mIsUnspecialized || mCurTypeInstance->mResolvingVarField); @@ -22187,6 +22182,13 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool if (resolvedReturnType == NULL) resolvedReturnType = GetPrimitiveType(BfTypeCode_Var); + + if ((methodDef->mIsReadOnly) && (!resolvedReturnType->IsRef())) + { + if (auto methodDeclaration = BfNodeDynCast(methodInstance->mMethodDef->mMethodDeclaration)) + if (methodDeclaration->mReadOnlySpecifier != NULL) + Fail("Readonly specifier is only valid on 'ref' return types", methodDeclaration->mReadOnlySpecifier); + } } else {