This commit is contained in:
nub31
2025-06-15 02:21:11 +02:00
parent 3f7499d2b9
commit 5fffd07077
4 changed files with 35 additions and 90 deletions

View File

@@ -359,7 +359,7 @@ public static class TypeChecker
{
LiteralKind.Integer => NubPrimitiveType.I64,
LiteralKind.Float => NubPrimitiveType.F64,
LiteralKind.String => new NubArrayType(NubPrimitiveType.U8),
LiteralKind.String => new NubCStringType(),
LiteralKind.Bool => NubPrimitiveType.Bool,
_ => throw new ArgumentOutOfRangeException()
};
@@ -563,18 +563,13 @@ public static class TypeChecker
switch (expressionType)
{
case NubArrayType arrayType:
case NubArrayType:
{
if (memberAccess.Member == "count")
{
return NubPrimitiveType.I64;
}
if (arrayType.ElementType is NubPrimitiveType { Kind: PrimitiveTypeKind.U8 } && memberAccess.Member == "cstring")
{
return new NubCStringType();
}
break;
}
case NubStructType structType: