• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

forst-lang / forst / 16034193780
40%
main: 41%

Build:
Build:
LAST BUILD BRANCH: generator-ts
DEFAULT BRANCH: main
Ran 02 Jul 2025 07:37PM UTC
Jobs 1
Files 108
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Jul 2025 07:37PM UTC coverage: 37.619% (+0.3%) from 37.308%
16034193780

Pull #17

github

haveyaseen
fix(typechecker): implement proper nested field path traversal for shape guards

The typechecker was failing to handle nested field access with dot notation (e.g., op.input.name) in shape guards and other contexts. The root cause was that field lookup functions were not properly handling multi-segment field names and were incorrectly recursing into nested shapes for single-segment lookups.

This commit adds new path-aware field lookup functions (lookupFieldPath, lookupFieldPathOnShape, lookupFieldPathOnMergedFields) that properly handle dot notation by splitting field names and recursively traversing the path. The existing field lookup functions have been updated to use these new functions where appropriate, ensuring consistent behavior across type definitions, assertions, and variable lookups.

The fix specifically addresses the bug where looking up a field like "input" in a shape containing {input: {name: String}} would incorrectly try to find "input" in the nested shape instead of returning the shape type. For multi-segment paths like "input.name", the new logic properly splits the path and recurses into the nested shape to find "name".

All typechecker tests now pass, confirming that nested field access works correctly for shape guards and other use cases. The shape guard feature can now properly handle expressions like op.input.name where op is a shape with nested fields.
Pull Request #17: feat: Shape guards

1757 of 4800 new or added lines in 83 files covered. (36.6%)

89 existing lines in 29 files now uncovered.

3081 of 8190 relevant lines covered (37.62%)

6.35 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
0.0
0.0% forst/internal/ast/tokens.go
1
87.5
forst/internal/parser/context.go
1
72.31
13.97% forst/internal/parser/typedef.go
2
93.85
93.85% forst/internal/parser/assignment.go
2
89.47
-10.53% forst/internal/parser/block.go
2
87.5
forst/internal/parser/test_utils.go
2
0.0
0.0% forst/internal/transformer/go/output.go
3
93.33
forst/cmd/forst/compiler/debug.go
3
14.29
14.29% forst/internal/ast/param.go
3
72.73
-21.98% forst/internal/lexer/lexer.go
3
93.48
forst/internal/parser/parser.go
3
75.0
forst/internal/parser/scope.go
4
38.36
4.07% forst/internal/parser/literal.go
4
86.89
37.91% forst/internal/parser/statement.go
4
63.64
forst/internal/transformer/go/ensure_types.go
5
92.75
forst/cmd/forst/compiler/args.go
5
53.54
-12.58% forst/internal/parser/control_flow.go
5
44.44
forst/internal/transformer/go/ensure_helpers.go
6
0.0
0.0% forst/internal/typechecker/infer_function.go
9
94.97
forst/internal/lexer/lex.go
9
0.0
forst/internal/logger/logger.go
9
76.09
-1.41% forst/internal/parser/assertion.go
9
0.0
-36.99% forst/internal/transformer/go/ensure.go
10
0.0
forst/internal/ast/dereference.go
11
0.0
0.0% forst/internal/ast/shape.go
11
0.0
0.0% forst/internal/ast/typedef.go
11
59.26
forst/internal/parser/scope_stack.go
12
64.58
4.86% forst/internal/parser/ensure.go
13
59.68
59.68% forst/internal/ast/typeguard.go
13
10.34
-0.77% forst/internal/transformer/go/type.go
14
59.59
29.68% forst/internal/parser/type.go
15
72.86
72.86% forst/internal/parser/shape.go
16
0.0
0.0% forst/internal/transformer/go/assertion.go
17
0.0
0.0% forst/internal/ast/assertion.go
18
0.0
0.0% forst/cmd/forst/main.go
19
53.13
-15.63% forst/internal/typechecker/scope_stack.go
20
71.03
17.78% forst/internal/parser/value.go
20
0.0
0.0% forst/internal/transformer/go/function.go
21
75.29
forst/internal/transformer/go/ensure_typeguard.go
21
19.23
forst/internal/typechecker/lookup_function.go
23
38.1
30.25% forst/internal/typechecker/scope.go
23
56.6
forst/internal/typechecker/unify_is.go
26
52.57
forst/cmd/forst/compiler/compiler.go
27
9.09
9.09% forst/internal/ast/type.go
28
58.11
-20.02% forst/internal/parser/typeguard.go
30
37.5
forst/internal/typechecker/unify_operators.go
31
0.0
0.0% forst/internal/typechecker/builtins.go
33
0.0
0.0% forst/internal/transformer/go/typedef_expr.go
33
20.0
20.0% forst/internal/typechecker/go_builtins.go
33
38.16
38.16% forst/internal/typechecker/infer_shape.go
33
53.77
43.6% forst/internal/typechecker/lookup.go
37
63.76
7.76% forst/internal/typechecker/typechecker.go
50
36.89
-5.97% forst/internal/typechecker/register.go
51
49.0
forst/internal/transformer/go/ensure_constraint.go
52
6.19
-0.48% forst/internal/transformer/go/typedef.go
55
7.96
forst/internal/transformer/go/transformer.go
56
0.0
0.0% forst/internal/transformer/go/shape.go
58
0.0
0.0% forst/internal/transformer/go/statement.go
62
44.26
-23.53% forst/internal/parser/function.go
64
0.0
0.0% forst/internal/typechecker/infer_assignment.go
65
39.85
-30.82% forst/internal/parser/expression.go
68
19.02
-9.37% forst/internal/typechecker/infer.go
84
39.13
forst/internal/typechecker/collect.go
86
55.83
-30.66% forst/internal/transformer/go/typeguard.go
88
28.46
forst/internal/typechecker/unify_shape.go
89
14.01
-30.32% forst/internal/transformer/go/expression.go
94
13.27
-10.59% forst/internal/typechecker/infer_expression.go
96
0.0
forst/internal/typechecker/shape.go
110
0.0
forst/internal/typechecker/unify_typeguard.go
154
26.29
26.29% forst/internal/typechecker/infer_assertion.go
231
35.29
forst/internal/typechecker/lookup_field.go
234
29.52
forst/internal/transformer/go/ensure_builtins.go
482
20.59
forst/internal/hasher/hasher.go

Uncovered Existing Lines

Lines Coverage ∆ File
1
0.0
0.0% forst/cmd/forst/main.go
1
64.58
4.86% forst/internal/parser/ensure.go
1
39.85
-30.82% forst/internal/parser/expression.go
1
86.89
37.91% forst/internal/parser/statement.go
1
72.31
13.97% forst/internal/parser/typedef.go
1
71.03
17.78% forst/internal/parser/value.go
1
0.0
0.0% forst/internal/transformer/go/output.go
1
0.0
0.0% forst/internal/transformer/go/statement.go
1
0.0
0.0% forst/internal/transformer/go/typedef_expr.go
1
6.19
-0.48% forst/internal/transformer/go/typedef.go
1
55.83
-30.66% forst/internal/transformer/go/typeguard.go
1
0.0
0.0% forst/internal/typechecker/builtins.go
1
0.0
0.0% forst/internal/typechecker/infer_assignment.go
1
38.16
38.16% forst/internal/typechecker/infer_shape.go
2
76.09
-1.41% forst/internal/parser/assertion.go
2
93.85
93.85% forst/internal/parser/assignment.go
2
38.36
4.07% forst/internal/parser/literal.go
2
58.11
-20.02% forst/internal/parser/typeguard.go
2
0.0
-36.99% forst/internal/transformer/go/ensure.go
2
26.29
26.29% forst/internal/typechecker/infer_assertion.go
2
19.02
-9.37% forst/internal/typechecker/infer.go
2
53.13
-15.63% forst/internal/typechecker/scope_stack.go
2
63.76
7.76% forst/internal/typechecker/typechecker.go
5
53.54
-12.58% forst/internal/parser/control_flow.go
7
44.26
-23.53% forst/internal/parser/function.go
7
0.0
-18.42% forst/internal/typechecker/utils.go
12
13.27
-10.59% forst/internal/typechecker/infer_expression.go
12
36.89
-5.97% forst/internal/typechecker/register.go
14
14.01
-30.32% forst/internal/transformer/go/expression.go
Jobs
ID Job ID Ran Files Coverage
1 16034193780.1 02 Jul 2025 07:37PM UTC 108
37.62
GitHub Action Run
Source Files on build 16034193780
  • Tree
  • List 108
  • Changed 53
  • Source Changed 0
  • Coverage Changed 53
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #17
  • PR Base - main (#15450694797)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc