fix(compiler): allow integer coercion in range bounds; use for loops in boko-framework

- sema: range bounds now accept compatible integer types (e.g. int..uint)
  instead of requiring exact type equality.
- hir_lower: derive loop variable type from the common range type.
- boko-framework: replace manual while loops with for loops in Query_Parse,
  Request_Parse, Path_Match and App_Run.
This commit is contained in:
2026-06-17 12:08:36 +03:00
parent 9c632ce389
commit 94e6806dda
3 changed files with 24 additions and 16 deletions
+9 -2
View File
@@ -1007,9 +1007,16 @@ proc checkExpr(sema: var Sema, expr: Expr, scope: Scope): Type =
of ekRange:
let lo = sema.checkExpr(expr.exprRangeLo, scope)
let hi = sema.checkExpr(expr.exprRangeHi, scope)
if lo != hi:
var rangeType: Type = lo
if lo == hi:
rangeType = lo
elif lo.isAssignableTo(hi):
rangeType = hi
elif hi.isAssignableTo(lo):
rangeType = lo
else:
sema.emitError(expr.loc, "range bounds must have same type")
return makeRange(lo)
return makeRange(rangeType)
of ekCall:
if expr.exprCallCallee == nil:
sema.emitError(expr.loc, "internal error: nil callee in call expression")