mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed some invalid error squiggles with undef-sized arrays
This commit is contained in:
parent
e0103b7dd7
commit
319f071eae
3 changed files with 7 additions and 4 deletions
|
@ -16755,7 +16755,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
|||
mCompiler->mResolvePassData->mSourceClassifier->SetElementType(fieldDef->mInitializer, BfSourceElementType_Normal);
|
||||
mCompiler->mResolvePassData->mSourceClassifier->VisitChild(fieldDef->mInitializer);
|
||||
|
||||
auto wantType = ResolveTypeRef(fieldDef->mTypeRef);
|
||||
auto wantType = ResolveTypeRef(fieldDef->mTypeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_AllowInferredSizedArray);
|
||||
if ((wantType != NULL) &&
|
||||
((wantType->IsVar()) || (wantType->IsLet()) || (wantType->IsRef())))
|
||||
wantType = NULL;
|
||||
|
|
|
@ -3729,8 +3729,11 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
|||
// For 'let', make read-only
|
||||
}
|
||||
else
|
||||
{
|
||||
resolvedFieldType = ResolveTypeRef(field->mTypeRef, BfPopulateType_Declaration, (BfResolveTypeRefFlags)(BfResolveTypeRefFlag_NoResolveGenericParam | BfResolveTypeRefFlag_AllowInferredSizedArray));
|
||||
{
|
||||
BfResolveTypeRefFlags resolveFlags = BfResolveTypeRefFlag_NoResolveGenericParam;
|
||||
if (field->mInitializer != NULL)
|
||||
resolveFlags = (BfResolveTypeRefFlags)(resolveFlags | BfResolveTypeRefFlag_AllowInferredSizedArray);
|
||||
resolvedFieldType = ResolveTypeRef(field->mTypeRef, BfPopulateType_Declaration, resolveFlags);
|
||||
if (resolvedFieldType == NULL)
|
||||
{
|
||||
// Failed, just put in placeholder 'var'
|
||||
|
|
|
@ -3278,7 +3278,7 @@ int BfResolvedTypeSet::DoHash(BfTypeReference* typeRef, LookupContext* ctx, BfHa
|
|||
else if (constant->mConstType == BfConstType_Undef)
|
||||
{
|
||||
elementCount = -1; // Marker for undef
|
||||
if ((ctx->mResolveFlags & BfResolveTypeRefFlag_AllowInferredSizedArray) == 0)
|
||||
if ((arrayType->IsInferredSize()) && ((ctx->mResolveFlags & BfResolveTypeRefFlag_AllowInferredSizedArray) == 0))
|
||||
{
|
||||
ctx->mModule->Fail("Invalid use of inferred-sized array", sizeExpr);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue