You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
STYLE038 measures a function across files when a macro replaces its body with a qmacro_block from the macro's file (3-line function reported as 100 lines) #14
STYLE038 (function length) measures a function as fn.body.at.last_line - fn.at.line + 1. When a function annotation replaces func.body with a block built by qmacro_block in the macro's own file, fn.body.at points into that file, and the lint subtracts a line number of one file from a line number of another: a three-line function in the user's file is reported as 100 lines long because the macro's quasi-block sits at line 101 of the macro file. Setting the generated block's at (and its statements') to func.at in the macro restores the measurement, so the rule is workable, but the number it reports is meaningless whenever a macro splices foreign line info into a body, and the lint fires on the user's code for something the macro did.
Repro
wrap_macro.das (lines 6 to 95 are ninety // padding comment lines, so that the quasi-block lands past line 80 of this file):
style warning: STYLE038: function 'answer' is 100 lines long (max 80); split it into smaller functions at wrap_use.das:5:4
> def answer : int {
Expected: no STYLE038 for a three-line function. The computation in daslib/style_lint.das (st038_check_length: let nlines = int(body_at.last_line) - int(at.line) + 1) could skip or clamp the measurement when body_at.fileInfo is not at.fileInfo, or measure from the function's own at.last_line, so that a macro's splice never changes the length of the user's function.
Fixed upstream: GaijinEntertainment#4238 is closed and the fix is in master abf1d40e35 (0.6.5). Verified by running this issue's repro on a build of that commit.
Activity
lookibed commentedon Nov 9, 2026
Re-checked by the owner from this issue's reproducer on daScript abf1d40 (0.6.5): fixed upstream (GaijinEntertainment/daScript 2131620 GaijinEntertainment#4472 dasLLVM, 1404d5a GaijinEntertainment#4480 optimizer, f386f92 GaijinEntertainment#4482 cache and tools). The c2das-re probes were re-pinned in the repin PRs (lookibed/c2das-re#142-GaijinEntertainment#147; ruling 38 addendum 4).
lookibed commentedon Nov 9, 2026
Fixed upstream: GaijinEntertainment#4238 is closed and the fix is in master
abf1d40e35(0.6.5). Verified by running this issue's repro on a build of that commit.