@azx-pbc/axiom-compiler 0.0.0-stage → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +415 -2
- package/dist/article.d.ts +12 -0
- package/dist/article.d.ts.map +1 -0
- package/dist/article.js +16 -0
- package/dist/article.js.map +1 -0
- package/dist/cli/args.d.ts +101 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +158 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/check.d.ts +2 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +33 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/compile.d.ts +2 -0
- package/dist/cli/compile.d.ts.map +1 -0
- package/dist/cli/compile.js +43 -0
- package/dist/cli/compile.js.map +1 -0
- package/dist/cli/count.d.ts +15 -0
- package/dist/cli/count.d.ts.map +1 -0
- package/dist/cli/count.js +21 -0
- package/dist/cli/count.js.map +1 -0
- package/dist/cli/dataset.d.ts +28 -0
- package/dist/cli/dataset.d.ts.map +1 -0
- package/dist/cli/dataset.js +115 -0
- package/dist/cli/dataset.js.map +1 -0
- package/dist/cli/diff.d.ts +2 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +297 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/explain.d.ts +2 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +95 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/fields.d.ts +11 -0
- package/dist/cli/fields.d.ts.map +1 -0
- package/dist/cli/fields.js +13 -0
- package/dist/cli/fields.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +40 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/read.d.ts +56 -0
- package/dist/cli/read.d.ts.map +1 -0
- package/dist/cli/read.js +179 -0
- package/dist/cli/read.js.map +1 -0
- package/dist/cli/render.d.ts +58 -0
- package/dist/cli/render.d.ts.map +1 -0
- package/dist/cli/render.js +422 -0
- package/dist/cli/render.js.map +1 -0
- package/dist/cli/schema.d.ts +28 -0
- package/dist/cli/schema.d.ts.map +1 -0
- package/dist/cli/schema.js +46 -0
- package/dist/cli/schema.js.map +1 -0
- package/dist/cli/suite-report.d.ts +18 -0
- package/dist/cli/suite-report.d.ts.map +1 -0
- package/dist/cli/suite-report.js +58 -0
- package/dist/cli/suite-report.js.map +1 -0
- package/dist/cli/suites.d.ts +25 -0
- package/dist/cli/suites.d.ts.map +1 -0
- package/dist/cli/suites.js +67 -0
- package/dist/cli/suites.js.map +1 -0
- package/dist/cli/terminal.d.ts +45 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +119 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/test.d.ts +12 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +199 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/usage.d.ts +15 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +95 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +51 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile/artifact-members.d.ts +57 -0
- package/dist/compile/artifact-members.d.ts.map +1 -0
- package/dist/compile/artifact-members.js +130 -0
- package/dist/compile/artifact-members.js.map +1 -0
- package/dist/compile/artifact.d.ts +20 -0
- package/dist/compile/artifact.d.ts.map +1 -0
- package/dist/compile/artifact.js +87 -0
- package/dist/compile/artifact.js.map +1 -0
- package/dist/compile/compilation.d.ts +46 -0
- package/dist/compile/compilation.d.ts.map +1 -0
- package/dist/compile/compilation.js +4 -0
- package/dist/compile/compilation.js.map +1 -0
- package/dist/compile/computed.d.ts +22 -0
- package/dist/compile/computed.d.ts.map +1 -0
- package/dist/compile/computed.js +245 -0
- package/dist/compile/computed.js.map +1 -0
- package/dist/compile/condition-warnings.d.ts +12 -0
- package/dist/compile/condition-warnings.d.ts.map +1 -0
- package/dist/compile/condition-warnings.js +26 -0
- package/dist/compile/condition-warnings.js.map +1 -0
- package/dist/compile/conditions.d.ts +18 -0
- package/dist/compile/conditions.d.ts.map +1 -0
- package/dist/compile/conditions.js +22 -0
- package/dist/compile/conditions.js.map +1 -0
- package/dist/compile/cross-checks.d.ts +67 -0
- package/dist/compile/cross-checks.d.ts.map +1 -0
- package/dist/compile/cross-checks.js +238 -0
- package/dist/compile/cross-checks.js.map +1 -0
- package/dist/compile/datasets.d.ts +52 -0
- package/dist/compile/datasets.d.ts.map +1 -0
- package/dist/compile/datasets.js +183 -0
- package/dist/compile/datasets.js.map +1 -0
- package/dist/compile/dead-weight.d.ts +26 -0
- package/dist/compile/dead-weight.d.ts.map +1 -0
- package/dist/compile/dead-weight.js +244 -0
- package/dist/compile/dead-weight.js.map +1 -0
- package/dist/compile/declaration-rules.d.ts +54 -0
- package/dist/compile/declaration-rules.d.ts.map +1 -0
- package/dist/compile/declaration-rules.js +510 -0
- package/dist/compile/declaration-rules.js.map +1 -0
- package/dist/compile/declarations.d.ts +44 -0
- package/dist/compile/declarations.d.ts.map +1 -0
- package/dist/compile/declarations.js +160 -0
- package/dist/compile/declarations.js.map +1 -0
- package/dist/compile/document.d.ts +4 -0
- package/dist/compile/document.d.ts.map +1 -0
- package/dist/compile/document.js +13 -0
- package/dist/compile/document.js.map +1 -0
- package/dist/compile/expression.d.ts +38 -0
- package/dist/compile/expression.d.ts.map +1 -0
- package/dist/compile/expression.js +288 -0
- package/dist/compile/expression.js.map +1 -0
- package/dist/compile/hashes.d.ts +26 -0
- package/dist/compile/hashes.d.ts.map +1 -0
- package/dist/compile/hashes.js +96 -0
- package/dist/compile/hashes.js.map +1 -0
- package/dist/compile/item-targets.d.ts +12 -0
- package/dist/compile/item-targets.d.ts.map +1 -0
- package/dist/compile/item-targets.js +287 -0
- package/dist/compile/item-targets.js.map +1 -0
- package/dist/compile/messages.d.ts +8 -0
- package/dist/compile/messages.d.ts.map +1 -0
- package/dist/compile/messages.js +62 -0
- package/dist/compile/messages.js.map +1 -0
- package/dist/compile/option-availability.d.ts +51 -0
- package/dist/compile/option-availability.d.ts.map +1 -0
- package/dist/compile/option-availability.js +171 -0
- package/dist/compile/option-availability.js.map +1 -0
- package/dist/compile/option-codes.d.ts +27 -0
- package/dist/compile/option-codes.d.ts.map +1 -0
- package/dist/compile/option-codes.js +212 -0
- package/dist/compile/option-codes.js.map +1 -0
- package/dist/compile/references.d.ts +14 -0
- package/dist/compile/references.d.ts.map +1 -0
- package/dist/compile/references.js +126 -0
- package/dist/compile/references.js.map +1 -0
- package/dist/compile/rows-from.d.ts +27 -0
- package/dist/compile/rows-from.d.ts.map +1 -0
- package/dist/compile/rows-from.js +164 -0
- package/dist/compile/rows-from.js.map +1 -0
- package/dist/compile/rules.d.ts +58 -0
- package/dist/compile/rules.d.ts.map +1 -0
- package/dist/compile/rules.js +327 -0
- package/dist/compile/rules.js.map +1 -0
- package/dist/compile/suggestions.d.ts +52 -0
- package/dist/compile/suggestions.d.ts.map +1 -0
- package/dist/compile/suggestions.js +633 -0
- package/dist/compile/suggestions.js.map +1 -0
- package/dist/compile/targets.d.ts +22 -0
- package/dist/compile/targets.d.ts.map +1 -0
- package/dist/compile/targets.js +125 -0
- package/dist/compile/targets.js.map +1 -0
- package/dist/compile/types.d.ts +84 -0
- package/dist/compile/types.d.ts.map +1 -0
- package/dist/compile/types.js +2 -0
- package/dist/compile/types.js.map +1 -0
- package/dist/compile/warning.d.ts +45 -0
- package/dist/compile/warning.d.ts.map +1 -0
- package/dist/compile/warning.js +2 -0
- package/dist/compile/warning.js.map +1 -0
- package/dist/compile-yaml.d.ts +23 -0
- package/dist/compile-yaml.d.ts.map +1 -0
- package/dist/compile-yaml.js +30 -0
- package/dist/compile-yaml.js.map +1 -0
- package/dist/compile.d.ts +78 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +372 -0
- package/dist/compile.js.map +1 -0
- package/dist/csv/limits.d.ts +43 -0
- package/dist/csv/limits.d.ts.map +1 -0
- package/dist/csv/limits.js +51 -0
- package/dist/csv/limits.js.map +1 -0
- package/dist/csv/scalar.d.ts +33 -0
- package/dist/csv/scalar.d.ts.map +1 -0
- package/dist/csv/scalar.js +77 -0
- package/dist/csv/scalar.js.map +1 -0
- package/dist/datasets/csv.d.ts +46 -0
- package/dist/datasets/csv.d.ts.map +1 -0
- package/dist/datasets/csv.js +293 -0
- package/dist/datasets/csv.js.map +1 -0
- package/dist/datasets/declaration.d.ts +16 -0
- package/dist/datasets/declaration.d.ts.map +1 -0
- package/dist/datasets/declaration.js +104 -0
- package/dist/datasets/declaration.js.map +1 -0
- package/dist/datasets/diagnostics.d.ts +65 -0
- package/dist/datasets/diagnostics.d.ts.map +1 -0
- package/dist/datasets/diagnostics.js +2 -0
- package/dist/datasets/diagnostics.js.map +1 -0
- package/dist/datasets/diff.d.ts +46 -0
- package/dist/datasets/diff.d.ts.map +1 -0
- package/dist/datasets/diff.js +84 -0
- package/dist/datasets/diff.js.map +1 -0
- package/dist/datasets/document.d.ts +12 -0
- package/dist/datasets/document.d.ts.map +1 -0
- package/dist/datasets/document.js +382 -0
- package/dist/datasets/document.js.map +1 -0
- package/dist/datasets/index.d.ts +43 -0
- package/dist/datasets/index.d.ts.map +1 -0
- package/dist/datasets/index.js +68 -0
- package/dist/datasets/index.js.map +1 -0
- package/dist/datasets/repair.d.ts +26 -0
- package/dist/datasets/repair.d.ts.map +1 -0
- package/dist/datasets/repair.js +60 -0
- package/dist/datasets/repair.js.map +1 -0
- package/dist/document-path.d.ts +62 -0
- package/dist/document-path.d.ts.map +1 -0
- package/dist/document-path.js +200 -0
- package/dist/document-path.js.map +1 -0
- package/dist/expr/boundary.d.ts +8 -0
- package/dist/expr/boundary.d.ts.map +1 -0
- package/dist/expr/boundary.js +243 -0
- package/dist/expr/boundary.js.map +1 -0
- package/dist/expr/compile-expr.d.ts +35 -0
- package/dist/expr/compile-expr.d.ts.map +1 -0
- package/dist/expr/compile-expr.js +66 -0
- package/dist/expr/compile-expr.js.map +1 -0
- package/dist/expr/deprecation.d.ts +23 -0
- package/dist/expr/deprecation.d.ts.map +1 -0
- package/dist/expr/deprecation.js +28 -0
- package/dist/expr/deprecation.js.map +1 -0
- package/dist/expr/diagnostics.d.ts +31 -0
- package/dist/expr/diagnostics.d.ts.map +1 -0
- package/dist/expr/diagnostics.js +34 -0
- package/dist/expr/diagnostics.js.map +1 -0
- package/dist/expr/lexer.d.ts +49 -0
- package/dist/expr/lexer.d.ts.map +1 -0
- package/dist/expr/lexer.js +277 -0
- package/dist/expr/lexer.js.map +1 -0
- package/dist/expr/lint-warnings.d.ts +11 -0
- package/dist/expr/lint-warnings.d.ts.map +1 -0
- package/dist/expr/lint-warnings.js +20 -0
- package/dist/expr/lint-warnings.js.map +1 -0
- package/dist/expr/lint.d.ts +41 -0
- package/dist/expr/lint.d.ts.map +1 -0
- package/dist/expr/lint.js +1034 -0
- package/dist/expr/lint.js.map +1 -0
- package/dist/expr/parse/aggregates.d.ts +13 -0
- package/dist/expr/parse/aggregates.d.ts.map +1 -0
- package/dist/expr/parse/aggregates.js +48 -0
- package/dist/expr/parse/aggregates.js.map +1 -0
- package/dist/expr/parse/budget.d.ts +11 -0
- package/dist/expr/parse/budget.d.ts.map +1 -0
- package/dist/expr/parse/budget.js +57 -0
- package/dist/expr/parse/budget.js.map +1 -0
- package/dist/expr/parse/grammar.d.ts +9 -0
- package/dist/expr/parse/grammar.d.ts.map +1 -0
- package/dist/expr/parse/grammar.js +699 -0
- package/dist/expr/parse/grammar.js.map +1 -0
- package/dist/expr/parse/literals.d.ts +20 -0
- package/dist/expr/parse/literals.d.ts.map +1 -0
- package/dist/expr/parse/literals.js +132 -0
- package/dist/expr/parse/literals.js.map +1 -0
- package/dist/expr/parse/stream.d.ts +60 -0
- package/dist/expr/parse/stream.d.ts.map +1 -0
- package/dist/expr/parse/stream.js +151 -0
- package/dist/expr/parse/stream.js.map +1 -0
- package/dist/expr/parser.d.ts +45 -0
- package/dist/expr/parser.d.ts.map +1 -0
- package/dist/expr/parser.js +110 -0
- package/dist/expr/parser.js.map +1 -0
- package/dist/expr/print/spell.d.ts +78 -0
- package/dist/expr/print/spell.d.ts.map +1 -0
- package/dist/expr/print/spell.js +592 -0
- package/dist/expr/print/spell.js.map +1 -0
- package/dist/expr/print.d.ts +20 -0
- package/dist/expr/print.d.ts.map +1 -0
- package/dist/expr/print.js +102 -0
- package/dist/expr/print.js.map +1 -0
- package/dist/expr/suggest.d.ts +26 -0
- package/dist/expr/suggest.d.ts.map +1 -0
- package/dist/expr/suggest.js +77 -0
- package/dist/expr/suggest.js.map +1 -0
- package/dist/expr/typecheck/aggregates.d.ts +8 -0
- package/dist/expr/typecheck/aggregates.d.ts.map +1 -0
- package/dist/expr/typecheck/aggregates.js +334 -0
- package/dist/expr/typecheck/aggregates.js.map +1 -0
- package/dist/expr/typecheck/arithmetic.d.ts +6 -0
- package/dist/expr/typecheck/arithmetic.d.ts.map +1 -0
- package/dist/expr/typecheck/arithmetic.js +258 -0
- package/dist/expr/typecheck/arithmetic.js.map +1 -0
- package/dist/expr/typecheck/arity.d.ts +38 -0
- package/dist/expr/typecheck/arity.d.ts.map +1 -0
- package/dist/expr/typecheck/arity.js +173 -0
- package/dist/expr/typecheck/arity.js.map +1 -0
- package/dist/expr/typecheck/calls.d.ts +6 -0
- package/dist/expr/typecheck/calls.d.ts.map +1 -0
- package/dist/expr/typecheck/calls.js +137 -0
- package/dist/expr/typecheck/calls.js.map +1 -0
- package/dist/expr/typecheck/comparison.d.ts +13 -0
- package/dist/expr/typecheck/comparison.d.ts.map +1 -0
- package/dist/expr/typecheck/comparison.js +200 -0
- package/dist/expr/typecheck/comparison.js.map +1 -0
- package/dist/expr/typecheck/compound.d.ts +24 -0
- package/dist/expr/typecheck/compound.d.ts.map +1 -0
- package/dist/expr/typecheck/compound.js +175 -0
- package/dist/expr/typecheck/compound.js.map +1 -0
- package/dist/expr/typecheck/context.d.ts +44 -0
- package/dist/expr/typecheck/context.d.ts.map +1 -0
- package/dist/expr/typecheck/context.js +2 -0
- package/dist/expr/typecheck/context.js.map +1 -0
- package/dist/expr/typecheck/datasets.d.ts +17 -0
- package/dist/expr/typecheck/datasets.d.ts.map +1 -0
- package/dist/expr/typecheck/datasets.js +136 -0
- package/dist/expr/typecheck/datasets.js.map +1 -0
- package/dist/expr/typecheck/digest.d.ts +7 -0
- package/dist/expr/typecheck/digest.d.ts.map +1 -0
- package/dist/expr/typecheck/digest.js +44 -0
- package/dist/expr/typecheck/digest.js.map +1 -0
- package/dist/expr/typecheck/fold.d.ts +41 -0
- package/dist/expr/typecheck/fold.d.ts.map +1 -0
- package/dist/expr/typecheck/fold.js +71 -0
- package/dist/expr/typecheck/fold.js.map +1 -0
- package/dist/expr/typecheck/gate-folds.d.ts +22 -0
- package/dist/expr/typecheck/gate-folds.d.ts.map +1 -0
- package/dist/expr/typecheck/gate-folds.js +40 -0
- package/dist/expr/typecheck/gate-folds.js.map +1 -0
- package/dist/expr/typecheck/guards.d.ts +6 -0
- package/dist/expr/typecheck/guards.d.ts.map +1 -0
- package/dist/expr/typecheck/guards.js +38 -0
- package/dist/expr/typecheck/guards.js.map +1 -0
- package/dist/expr/typecheck/member.d.ts +17 -0
- package/dist/expr/typecheck/member.d.ts.map +1 -0
- package/dist/expr/typecheck/member.js +46 -0
- package/dist/expr/typecheck/member.js.map +1 -0
- package/dist/expr/typecheck/money.d.ts +8 -0
- package/dist/expr/typecheck/money.d.ts.map +1 -0
- package/dist/expr/typecheck/money.js +49 -0
- package/dist/expr/typecheck/money.js.map +1 -0
- package/dist/expr/typecheck/numeric.d.ts +8 -0
- package/dist/expr/typecheck/numeric.d.ts.map +1 -0
- package/dist/expr/typecheck/numeric.js +84 -0
- package/dist/expr/typecheck/numeric.js.map +1 -0
- package/dist/expr/typecheck/operands.d.ts +27 -0
- package/dist/expr/typecheck/operands.d.ts.map +1 -0
- package/dist/expr/typecheck/operands.js +106 -0
- package/dist/expr/typecheck/operands.js.map +1 -0
- package/dist/expr/typecheck/paths.d.ts +21 -0
- package/dist/expr/typecheck/paths.d.ts.map +1 -0
- package/dist/expr/typecheck/paths.js +321 -0
- package/dist/expr/typecheck/paths.js.map +1 -0
- package/dist/expr/typecheck/records.d.ts +24 -0
- package/dist/expr/typecheck/records.d.ts.map +1 -0
- package/dist/expr/typecheck/records.js +53 -0
- package/dist/expr/typecheck/records.js.map +1 -0
- package/dist/expr/typecheck/sequences.d.ts +15 -0
- package/dist/expr/typecheck/sequences.d.ts.map +1 -0
- package/dist/expr/typecheck/sequences.js +55 -0
- package/dist/expr/typecheck/sequences.js.map +1 -0
- package/dist/expr/typecheck/strings.d.ts +8 -0
- package/dist/expr/typecheck/strings.d.ts.map +1 -0
- package/dist/expr/typecheck/strings.js +188 -0
- package/dist/expr/typecheck/strings.js.map +1 -0
- package/dist/expr/typecheck/temporal.d.ts +7 -0
- package/dist/expr/typecheck/temporal.d.ts.map +1 -0
- package/dist/expr/typecheck/temporal.js +80 -0
- package/dist/expr/typecheck/temporal.js.map +1 -0
- package/dist/expr/typecheck/types.d.ts +163 -0
- package/dist/expr/typecheck/types.d.ts.map +1 -0
- package/dist/expr/typecheck/types.js +404 -0
- package/dist/expr/typecheck/types.js.map +1 -0
- package/dist/expr/typecheck.d.ts +75 -0
- package/dist/expr/typecheck.d.ts.map +1 -0
- package/dist/expr/typecheck.js +242 -0
- package/dist/expr/typecheck.js.map +1 -0
- package/dist/expr/undecided.d.ts +13 -0
- package/dist/expr/undecided.d.ts.map +1 -0
- package/dist/expr/undecided.js +58 -0
- package/dist/expr/undecided.js.map +1 -0
- package/dist/expr/values/code-points.d.ts +13 -0
- package/dist/expr/values/code-points.d.ts.map +1 -0
- package/dist/expr/values/code-points.js +25 -0
- package/dist/expr/values/code-points.js.map +1 -0
- package/dist/expr/values/inline.d.ts +77 -0
- package/dist/expr/values/inline.d.ts.map +1 -0
- package/dist/expr/values/inline.js +404 -0
- package/dist/expr/values/inline.js.map +1 -0
- package/dist/expr/values/interval.d.ts +19 -0
- package/dist/expr/values/interval.d.ts.map +1 -0
- package/dist/expr/values/interval.js +1180 -0
- package/dist/expr/values/interval.js.map +1 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/document.d.ts +58 -0
- package/dist/ingest/document.d.ts.map +1 -0
- package/dist/ingest/document.js +83 -0
- package/dist/ingest/document.js.map +1 -0
- package/dist/ingest/yaml-document.d.ts +15 -0
- package/dist/ingest/yaml-document.d.ts.map +1 -0
- package/dist/ingest/yaml-document.js +42 -0
- package/dist/ingest/yaml-document.js.map +1 -0
- package/dist/ingest/yaml.d.ts +51 -0
- package/dist/ingest/yaml.d.ts.map +1 -0
- package/dist/ingest/yaml.js +340 -0
- package/dist/ingest/yaml.js.map +1 -0
- package/dist/layout/compile.d.ts +6 -0
- package/dist/layout/compile.d.ts.map +1 -0
- package/dist/layout/compile.js +224 -0
- package/dist/layout/compile.js.map +1 -0
- package/dist/layout/context.d.ts +12 -0
- package/dist/layout/context.d.ts.map +1 -0
- package/dist/layout/context.js +26 -0
- package/dist/layout/context.js.map +1 -0
- package/dist/layout/grammar.d.ts +34 -0
- package/dist/layout/grammar.d.ts.map +1 -0
- package/dist/layout/grammar.js +171 -0
- package/dist/layout/grammar.js.map +1 -0
- package/dist/layout/read.d.ts +54 -0
- package/dist/layout/read.d.ts.map +1 -0
- package/dist/layout/read.js +101 -0
- package/dist/layout/read.js.map +1 -0
- package/dist/layout/shape.d.ts +34 -0
- package/dist/layout/shape.d.ts.map +1 -0
- package/dist/layout/shape.js +149 -0
- package/dist/layout/shape.js.map +1 -0
- package/dist/messages/compile.d.ts +47 -0
- package/dist/messages/compile.d.ts.map +1 -0
- package/dist/messages/compile.js +202 -0
- package/dist/messages/compile.js.map +1 -0
- package/dist/messages/locale.d.ts +18 -0
- package/dist/messages/locale.d.ts.map +1 -0
- package/dist/messages/locale.js +33 -0
- package/dist/messages/locale.js.map +1 -0
- package/dist/messages/slots.d.ts +54 -0
- package/dist/messages/slots.d.ts.map +1 -0
- package/dist/messages/slots.js +137 -0
- package/dist/messages/slots.js.map +1 -0
- package/dist/overlay/compile-overlay.d.ts +29 -0
- package/dist/overlay/compile-overlay.d.ts.map +1 -0
- package/dist/overlay/compile-overlay.js +120 -0
- package/dist/overlay/compile-overlay.js.map +1 -0
- package/dist/overlay/compose.d.ts +26 -0
- package/dist/overlay/compose.d.ts.map +1 -0
- package/dist/overlay/compose.js +674 -0
- package/dist/overlay/compose.js.map +1 -0
- package/dist/overlay/types.d.ts +41 -0
- package/dist/overlay/types.d.ts.map +1 -0
- package/dist/overlay/types.js +2 -0
- package/dist/overlay/types.js.map +1 -0
- package/dist/publish/classify.d.ts +50 -0
- package/dist/publish/classify.d.ts.map +1 -0
- package/dist/publish/classify.js +85 -0
- package/dist/publish/classify.js.map +1 -0
- package/dist/publish/environment.d.ts +15 -0
- package/dist/publish/environment.d.ts.map +1 -0
- package/dist/publish/environment.js +2 -0
- package/dist/publish/environment.js.map +1 -0
- package/dist/publish/migrations.d.ts +108 -0
- package/dist/publish/migrations.d.ts.map +1 -0
- package/dist/publish/migrations.js +166 -0
- package/dist/publish/migrations.js.map +1 -0
- package/dist/publish/observation.d.ts +29 -0
- package/dist/publish/observation.d.ts.map +1 -0
- package/dist/publish/observation.js +43 -0
- package/dist/publish/observation.js.map +1 -0
- package/dist/publish/readiness.d.ts +197 -0
- package/dist/publish/readiness.d.ts.map +1 -0
- package/dist/publish/readiness.js +239 -0
- package/dist/publish/readiness.js.map +1 -0
- package/dist/publish/vectors.d.ts +50 -0
- package/dist/publish/vectors.d.ts.map +1 -0
- package/dist/publish/vectors.js +306 -0
- package/dist/publish/vectors.js.map +1 -0
- package/dist/publish/verify.d.ts +146 -0
- package/dist/publish/verify.d.ts.map +1 -0
- package/dist/publish/verify.js +548 -0
- package/dist/publish/verify.js.map +1 -0
- package/dist/scenarios/branch.d.ts +36 -0
- package/dist/scenarios/branch.d.ts.map +1 -0
- package/dist/scenarios/branch.js +30 -0
- package/dist/scenarios/branch.js.map +1 -0
- package/dist/scenarios/capture.d.ts +89 -0
- package/dist/scenarios/capture.d.ts.map +1 -0
- package/dist/scenarios/capture.js +443 -0
- package/dist/scenarios/capture.js.map +1 -0
- package/dist/scenarios/classifier.d.ts +20 -0
- package/dist/scenarios/classifier.d.ts.map +1 -0
- package/dist/scenarios/classifier.js +88 -0
- package/dist/scenarios/classifier.js.map +1 -0
- package/dist/scenarios/credit.d.ts +33 -0
- package/dist/scenarios/credit.d.ts.map +1 -0
- package/dist/scenarios/credit.js +330 -0
- package/dist/scenarios/credit.js.map +1 -0
- package/dist/scenarios/csv.d.ts +34 -0
- package/dist/scenarios/csv.d.ts.map +1 -0
- package/dist/scenarios/csv.js +1047 -0
- package/dist/scenarios/csv.js.map +1 -0
- package/dist/scenarios/data-identity.d.ts +39 -0
- package/dist/scenarios/data-identity.d.ts.map +1 -0
- package/dist/scenarios/data-identity.js +28 -0
- package/dist/scenarios/data-identity.js.map +1 -0
- package/dist/scenarios/document.d.ts +148 -0
- package/dist/scenarios/document.d.ts.map +1 -0
- package/dist/scenarios/document.js +513 -0
- package/dist/scenarios/document.js.map +1 -0
- package/dist/scenarios/environment.d.ts +64 -0
- package/dist/scenarios/environment.d.ts.map +1 -0
- package/dist/scenarios/environment.js +106 -0
- package/dist/scenarios/environment.js.map +1 -0
- package/dist/scenarios/evidence.d.ts +128 -0
- package/dist/scenarios/evidence.d.ts.map +1 -0
- package/dist/scenarios/evidence.js +179 -0
- package/dist/scenarios/evidence.js.map +1 -0
- package/dist/scenarios/expectations.d.ts +63 -0
- package/dist/scenarios/expectations.d.ts.map +1 -0
- package/dist/scenarios/expectations.js +490 -0
- package/dist/scenarios/expectations.js.map +1 -0
- package/dist/scenarios/references.d.ts +15 -0
- package/dist/scenarios/references.d.ts.map +1 -0
- package/dist/scenarios/references.js +239 -0
- package/dist/scenarios/references.js.map +1 -0
- package/dist/scenarios/report.d.ts +216 -0
- package/dist/scenarios/report.d.ts.map +1 -0
- package/dist/scenarios/report.js +54 -0
- package/dist/scenarios/report.js.map +1 -0
- package/dist/scenarios/runner.d.ts +55 -0
- package/dist/scenarios/runner.d.ts.map +1 -0
- package/dist/scenarios/runner.js +205 -0
- package/dist/scenarios/runner.js.map +1 -0
- package/dist/scenarios/vocabulary.d.ts +19 -0
- package/dist/scenarios/vocabulary.d.ts.map +1 -0
- package/dist/scenarios/vocabulary.js +56 -0
- package/dist/scenarios/vocabulary.js.map +1 -0
- package/dist/schema/catalogue.d.ts +54 -0
- package/dist/schema/catalogue.d.ts.map +1 -0
- package/dist/schema/catalogue.js +221 -0
- package/dist/schema/catalogue.js.map +1 -0
- package/dist/schema/check.d.ts +22 -0
- package/dist/schema/check.d.ts.map +1 -0
- package/dist/schema/check.js +30 -0
- package/dist/schema/check.js.map +1 -0
- package/dist/schema/closed.d.ts +19 -0
- package/dist/schema/closed.d.ts.map +1 -0
- package/dist/schema/closed.js +33 -0
- package/dist/schema/closed.js.map +1 -0
- package/dist/schema/collapse.d.ts +27 -0
- package/dist/schema/collapse.d.ts.map +1 -0
- package/dist/schema/collapse.js +143 -0
- package/dist/schema/collapse.js.map +1 -0
- package/dist/schema/controls.d.ts +46 -0
- package/dist/schema/controls.d.ts.map +1 -0
- package/dist/schema/controls.js +75 -0
- package/dist/schema/controls.js.map +1 -0
- package/dist/schema/dataset-declaration.d.ts +11 -0
- package/dist/schema/dataset-declaration.d.ts.map +1 -0
- package/dist/schema/dataset-declaration.js +11 -0
- package/dist/schema/dataset-declaration.js.map +1 -0
- package/dist/schema/declaration-warnings.d.ts +14 -0
- package/dist/schema/declaration-warnings.d.ts.map +1 -0
- package/dist/schema/declaration-warnings.js +77 -0
- package/dist/schema/declaration-warnings.js.map +1 -0
- package/dist/schema/declarations.d.ts +41 -0
- package/dist/schema/declarations.d.ts.map +1 -0
- package/dist/schema/declarations.js +1299 -0
- package/dist/schema/declarations.js.map +1 -0
- package/dist/schema/diagnostic.d.ts +118 -0
- package/dist/schema/diagnostic.d.ts.map +1 -0
- package/dist/schema/diagnostic.js +39 -0
- package/dist/schema/diagnostic.js.map +1 -0
- package/dist/schema/document.d.ts +93 -0
- package/dist/schema/document.d.ts.map +1 -0
- package/dist/schema/document.js +507 -0
- package/dist/schema/document.js.map +1 -0
- package/dist/schema/fields.d.ts +11 -0
- package/dist/schema/fields.d.ts.map +1 -0
- package/dist/schema/fields.js +265 -0
- package/dist/schema/fields.js.map +1 -0
- package/dist/schema/gates.d.ts +4 -0
- package/dist/schema/gates.d.ts.map +1 -0
- package/dist/schema/gates.js +68 -0
- package/dist/schema/gates.js.map +1 -0
- package/dist/schema/located.d.ts +27 -0
- package/dist/schema/located.d.ts.map +1 -0
- package/dist/schema/located.js +56 -0
- package/dist/schema/located.js.map +1 -0
- package/dist/schema/measurement.d.ts +9 -0
- package/dist/schema/measurement.d.ts.map +1 -0
- package/dist/schema/measurement.js +38 -0
- package/dist/schema/measurement.js.map +1 -0
- package/dist/schema/member-wording.d.ts +35 -0
- package/dist/schema/member-wording.d.ts.map +1 -0
- package/dist/schema/member-wording.js +286 -0
- package/dist/schema/member-wording.js.map +1 -0
- package/dist/schema/metaschema.d.ts +20 -0
- package/dist/schema/metaschema.d.ts.map +1 -0
- package/dist/schema/metaschema.js +476 -0
- package/dist/schema/metaschema.js.map +1 -0
- package/dist/schema/pointer.d.ts +31 -0
- package/dist/schema/pointer.d.ts.map +1 -0
- package/dist/schema/pointer.js +73 -0
- package/dist/schema/pointer.js.map +1 -0
- package/dist/schema/primary.d.ts +29 -0
- package/dist/schema/primary.d.ts.map +1 -0
- package/dist/schema/primary.js +48 -0
- package/dist/schema/primary.js.map +1 -0
- package/dist/schema/publish-vector.d.ts +17 -0
- package/dist/schema/publish-vector.d.ts.map +1 -0
- package/dist/schema/publish-vector.js +34 -0
- package/dist/schema/publish-vector.js.map +1 -0
- package/dist/schema/repair.d.ts +34 -0
- package/dist/schema/repair.d.ts.map +1 -0
- package/dist/schema/repair.js +163 -0
- package/dist/schema/repair.js.map +1 -0
- package/dist/schema/schema-v1.generated.d.ts +14 -0
- package/dist/schema/schema-v1.generated.d.ts.map +1 -0
- package/dist/schema/schema-v1.generated.js +7089 -0
- package/dist/schema/schema-v1.generated.js.map +1 -0
- package/dist/schema/screens.d.ts +4 -0
- package/dist/schema/screens.d.ts.map +1 -0
- package/dist/schema/screens.js +28 -0
- package/dist/schema/screens.js.map +1 -0
- package/dist/schema/test-values.d.ts +12 -0
- package/dist/schema/test-values.d.ts.map +1 -0
- package/dist/schema/test-values.js +97 -0
- package/dist/schema/test-values.js.map +1 -0
- package/dist/schema/unions.d.ts +46 -0
- package/dist/schema/unions.d.ts.map +1 -0
- package/dist/schema/unions.js +131 -0
- package/dist/schema/unions.js.map +1 -0
- package/dist/schema/validate-yaml.d.ts +14 -0
- package/dist/schema/validate-yaml.d.ts.map +1 -0
- package/dist/schema/validate-yaml.js +17 -0
- package/dist/schema/validate-yaml.js.map +1 -0
- package/dist/schema/validate.d.ts +46 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +186 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/testing.d.ts +21 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +28 -0
- package/dist/testing.js.map +1 -0
- package/dist/vocabulary.d.ts +6 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +26 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +66 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compound.js","sourceRoot":"","sources":["../../../src/expr/typecheck/compound.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAA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,CAAC;QACT,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;AACH,CAAC","sourcesContent":["import type {\n AndNode,\n CoalesceNode,\n ComprehensionNode,\n ExprNode,\n IfNode,\n ListNode,\n NotNode,\n OrNode,\n} from '@azx-pbc/axiom-runtime';\nimport { ExpressionCompileError } from '../diagnostics.js';\nimport { spellSource } from '../print/spell.js';\nimport type { CheckContext } from './context.js';\nimport type { StaticType } from './types.js';\nimport {\n isBoolean,\n isNullable,\n isPrimitive,\n primitiveType,\n typeName,\n unify,\n withNullability,\n} from './types.js';\n\n/**\n * The opening each connective refusal states, shared with the parent that can name a repair.\n *\n * `coalesceType` catches a failing `or` operand to explain the precedence reading `a ?? b or c`\n * almost certainly meant, so the two modules name one sentence rather than matching prose.\n */\nfunction connectiveRefusal(kind: 'and' | 'or'): string {\n return `\\`${kind}\\` requires boolean operands`;\n}\nconst OR_OPERAND_REFUSAL: string = connectiveRefusal('or');\nexport const NOT_OPERAND_REFUSAL: string = '`not` requires a boolean operand';\n\n/** A list literal: every member unifies to one element type. */\nexport function listType(ctx: CheckContext, node: ListNode): StaticType {\n let element: StaticType | undefined;\n for (const item of node.items) {\n const type = ctx.check(item);\n const unified = element === undefined ? type : unify(element, type);\n if (unified === undefined) {\n throw ctx.mismatch(\n item,\n `a list literal holds one element type, but this element is ${typeName(type)} beside ${typeName(element ?? type)}`,\n );\n }\n element = unified;\n }\n return { kind: 'list', element, open: false };\n}\n\n/** `and`/`or`: every operand is boolean. */\nexport function logicalType(ctx: CheckContext, node: AndNode | OrNode): StaticType {\n for (const arg of node.args) {\n const type = ctx.check(arg);\n if (!isBoolean(type)) {\n throw ctx.mismatch(arg, `${connectiveRefusal(node.kind)}, got ${typeName(type)}`);\n }\n }\n return primitiveType('boolean');\n}\n\n/** `not`: one boolean operand. */\nexport function notType(ctx: CheckContext, node: NotNode): StaticType {\n const [arg] = node.args;\n if (arg === undefined) throw ctx.mismatch(node, '`not` requires one operand');\n const type = ctx.check(arg);\n if (!isBoolean(type)) {\n throw ctx.mismatch(arg, `${NOT_OPERAND_REFUSAL}, got ${typeName(type)}`);\n }\n return primitiveType('boolean');\n}\n\n/** `if(condition, then, else)`: a boolean condition and two branches of one type. */\nexport function conditionalType(ctx: CheckContext, node: IfNode): StaticType {\n const [conditionNode, thenNode, elseNode] = node.args;\n if (conditionNode === undefined || thenNode === undefined || elseNode === undefined) {\n throw ctx.mismatch(node, '`if` requires three operands');\n }\n const condition = ctx.check(conditionNode);\n if (!isBoolean(condition)) {\n throw ctx.mismatch(\n conditionNode,\n `\\`if\\` requires a boolean condition, got ${typeName(condition)}`,\n );\n }\n const thenType = ctx.check(thenNode);\n const elseType = ctx.check(elseNode);\n const unified = unify(thenType, elseType);\n if (unified === undefined) {\n throw ctx.mismatch(\n node,\n `\\`if\\` branches must share one type, got ${typeName(thenType)} and ${typeName(elseType)}`,\n );\n }\n return unified;\n}\n\n/**\n * `??`: every operand unifies to one type, and an empty operand list is `null`.\n *\n * The result can be `null` only when the last operand can: every earlier operand is\n * returned when it is not `null`, and the last one is returned as it stands (`EXPR-9.1.3`).\n * So `parse_integer(s) ?? 0` is `integer`, while `parse_integer(s) ?? null` is\n * `integer | null`.\n */\nexport function coalesceType(ctx: CheckContext, node: CoalesceNode): StaticType {\n let result: StaticType | undefined;\n let nullable = false;\n for (const [index, arg] of node.args.entries()) {\n let type: StaticType;\n try {\n type = ctx.check(arg);\n } catch (error) {\n const repaired = precedenceRepair(ctx, node, arg, index, error);\n if (repaired !== undefined) throw repaired;\n throw error;\n }\n nullable = isPrimitive(type, 'null') || isNullable(type);\n if (result === undefined) {\n result = type;\n continue;\n }\n const unified = unify(result, type);\n if (unified === undefined) {\n throw ctx.mismatch(\n arg,\n `\\`??\\` operands must share one type, got ${typeName(result)} and ${typeName(type)}`,\n );\n }\n result = unified;\n }\n return result === undefined ? primitiveType('null') : withNullability(result, nullable);\n}\n\n/**\n * The refusal for a fallback that was meant to bind tighter than it does.\n *\n * `f_a ?? 0 or f_b == 1` parses as `f_a ?? (0 or f_b == 1)`, because `??` is the lowest rung, so\n * the `or` receives an integer and is refused. The type diagnosis is right; what it cannot say is\n * that the author's reading was `(f_a ?? 0) or ...`. That repair is only offered when the failing\n * operand is the `or`'s first — the one the coalesce swallowed — and every part spells, because\n * any other shape would move an operand the author did not.\n */\nfunction precedenceRepair(\n ctx: CheckContext,\n node: CoalesceNode,\n arg: ExprNode,\n index: number,\n error: unknown,\n): ExpressionCompileError | undefined {\n if (!(error instanceof ExpressionCompileError)) return undefined;\n if (error.diagnostic.code !== 'TYPE_MISMATCH') return undefined;\n if (arg.kind !== 'or' || index !== node.args.length - 1) return undefined;\n if (!error.diagnostic.detail.startsWith(OR_OPERAND_REFUSAL)) return undefined;\n const [first, ...rest] = arg.args;\n if (first === undefined || error.diagnostic.offset !== ctx.offsetOf(first)) return undefined;\n const prefix: string[] = [];\n for (const operand of [...node.args.slice(0, -1), first]) {\n const source = spellSource(operand);\n if (source === undefined) return undefined;\n prefix.push(source);\n }\n const tail: string[] = [];\n for (const operand of rest) {\n const source = spellSource(operand);\n if (source === undefined) return undefined;\n tail.push(source);\n }\n const repair = `(${prefix.join(' ?? ')}) or ${tail.join(' or ')}`;\n return ctx.mismatch(\n first,\n `${error.diagnostic.detail}; parenthesise the fallback: \\`${repair}\\``,\n );\n}\n\n/** A comprehension: its source is a list, and its binder is the element in the body's scope. */\nexport function comprehensionType(ctx: CheckContext, node: ComprehensionNode): StaticType {\n const source = ctx.check(node.source);\n if (source.kind !== 'list' || source.element === undefined) {\n throw ctx.mismatch(node.source, `a comprehension iterates a list, got ${typeName(source)}`);\n }\n const element = source.element;\n const previous = ctx.bindings();\n const binders = new Map(previous);\n for (const [name, type] of [\n ['$it', element],\n ['$prev', element],\n ['$next', element],\n ['$i', primitiveType('integer')],\n [node.binder.name, element],\n ] as const) {\n binders.set(name, type);\n }\n ctx.replaceBindings(binders);\n try {\n if (node.predicate !== undefined) {\n const predicate = ctx.check(node.predicate);\n if (!isBoolean(predicate)) {\n throw ctx.mismatch(\n node.predicate,\n `a comprehension predicate must be boolean, got ${typeName(predicate)}`,\n );\n }\n }\n if (node.valueExpr !== undefined) {\n return { kind: 'list', element: ctx.check(node.valueExpr), open: false };\n }\n return { kind: 'list', element: primitiveType('boolean'), open: false };\n } finally {\n ctx.replaceBindings(previous);\n }\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CompiledField, ContextRoot, DatasetDeclaration, ExprNode } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { ExpressionCompileError } from '../diagnostics.js';
|
|
3
|
+
import type { UndecidedFold } from './fold.js';
|
|
4
|
+
import type { StaticType } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The declarations and state one type-checking pass holds, as every operator family reads it.
|
|
7
|
+
*
|
|
8
|
+
* The checker owns the declarations, the implicit binders and the source offsets; a family
|
|
9
|
+
* reads a declaration, recurses into an operand and raises a refusal through this surface
|
|
10
|
+
* rather than reaching into the walk.
|
|
11
|
+
*/
|
|
12
|
+
export interface CheckContext {
|
|
13
|
+
readonly fields: ReadonlyMap<string, CompiledField>;
|
|
14
|
+
readonly contextRoots: ReadonlyMap<string, ContextRoot>;
|
|
15
|
+
readonly datasets: ReadonlyMap<string, DatasetDeclaration>;
|
|
16
|
+
/** The implicit binders in scope (`$it`, `$prev`, `$next`, `$i`, comprehension binders). */
|
|
17
|
+
bindings(): ReadonlyMap<string, StaticType>;
|
|
18
|
+
replaceBindings(bindings: ReadonlyMap<string, StaticType>): void;
|
|
19
|
+
check(node: ExprNode): StaticType;
|
|
20
|
+
offsetOf(node: ExprNode): number;
|
|
21
|
+
mismatch(node: ExprNode, detail: string): ExpressionCompileError;
|
|
22
|
+
/**
|
|
23
|
+
* The declaration a path names, when it names a declared field.
|
|
24
|
+
*
|
|
25
|
+
* A context root, a rule's implicit binder or a member a value carries intrinsically states no
|
|
26
|
+
* field declaration here; the checker answers `undefined` rather than inventing one, so a
|
|
27
|
+
* cardinality proof is only made from a declaration the document actually states.
|
|
28
|
+
*/
|
|
29
|
+
fieldAtPath(path: string): CompiledField | undefined;
|
|
30
|
+
/** Record a fold that compiles but decides nothing when its list is empty. */
|
|
31
|
+
reportUndecidedFold(finding: UndecidedFold): void;
|
|
32
|
+
/**
|
|
33
|
+
* Whether this build admits `matches`. A false value refuses every call rather than only the
|
|
34
|
+
* literal-pattern forms, because the operator itself is what the build disables.
|
|
35
|
+
*/
|
|
36
|
+
readonly allowRegex: boolean;
|
|
37
|
+
/** Whether this `pow` node was the authored `**`/`^` spelling. */
|
|
38
|
+
isPowerOperator(node: ExprNode): boolean;
|
|
39
|
+
/** Whether this `member` call was parsed from postfix `.length` syntax. */
|
|
40
|
+
isLengthProperty(node: ExprNode): boolean;
|
|
41
|
+
/** Whether this node came from an inlined computed definition rather than the current slot. */
|
|
42
|
+
isInlinedNode(node: ExprNode): boolean;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/expr/typecheck/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,QAAQ,EACT,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpD,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC3D,4FAA4F;IAC5F,QAAQ,IAAI,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC5C,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;IACjE,KAAK,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,sBAAsB,CAAC;IACjE;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IACrD,8EAA8E;IAC9E,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,kEAAkE;IAClE,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzC,2EAA2E;IAC3E,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1C,+FAA+F;IAC/F,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/expr/typecheck/context.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n CompiledField,\n ContextRoot,\n DatasetDeclaration,\n ExprNode,\n} from '@azx-pbc/axiom-runtime';\nimport type { ExpressionCompileError } from '../diagnostics.js';\nimport type { UndecidedFold } from './fold.js';\nimport type { StaticType } from './types.js';\n\n/**\n * The declarations and state one type-checking pass holds, as every operator family reads it.\n *\n * The checker owns the declarations, the implicit binders and the source offsets; a family\n * reads a declaration, recurses into an operand and raises a refusal through this surface\n * rather than reaching into the walk.\n */\nexport interface CheckContext {\n readonly fields: ReadonlyMap<string, CompiledField>;\n readonly contextRoots: ReadonlyMap<string, ContextRoot>;\n readonly datasets: ReadonlyMap<string, DatasetDeclaration>;\n /** The implicit binders in scope (`$it`, `$prev`, `$next`, `$i`, comprehension binders). */\n bindings(): ReadonlyMap<string, StaticType>;\n replaceBindings(bindings: ReadonlyMap<string, StaticType>): void;\n check(node: ExprNode): StaticType;\n offsetOf(node: ExprNode): number;\n mismatch(node: ExprNode, detail: string): ExpressionCompileError;\n /**\n * The declaration a path names, when it names a declared field.\n *\n * A context root, a rule's implicit binder or a member a value carries intrinsically states no\n * field declaration here; the checker answers `undefined` rather than inventing one, so a\n * cardinality proof is only made from a declaration the document actually states.\n */\n fieldAtPath(path: string): CompiledField | undefined;\n /** Record a fold that compiles but decides nothing when its list is empty. */\n reportUndecidedFold(finding: UndecidedFold): void;\n /**\n * Whether this build admits `matches`. A false value refuses every call rather than only the\n * literal-pattern forms, because the operator itself is what the build disables.\n */\n readonly allowRegex: boolean;\n /** Whether this `pow` node was the authored `**`/`^` spelling. */\n isPowerOperator(node: ExprNode): boolean;\n /** Whether this `member` call was parsed from postfix `.length` syntax. */\n isLengthProperty(node: ExprNode): boolean;\n /** Whether this node came from an inlined computed definition rather than the current slot. */\n isInlinedNode(node: ExprNode): boolean;\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CallNode } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { CheckContext } from './context.js';
|
|
3
|
+
import type { Operands } from './operands.js';
|
|
4
|
+
import type { StaticType } from './types.js';
|
|
5
|
+
/** The dataset built-ins: membership, lookup and decision tables. */
|
|
6
|
+
export type DatasetOperator = 'in_set' | 'lookup' | 'decide_keys';
|
|
7
|
+
/**
|
|
8
|
+
* The domains a set can hold, `spec/metaschema/dataset.v1.json` `$defs/scalarPrimitive`.
|
|
9
|
+
*
|
|
10
|
+
* A `decimal`, `date` or `instant` is a string on the wire, so its declared domain is allowed
|
|
11
|
+
* even though the wire scalar union names no member for it; `media_ref`, `signature_ref`,
|
|
12
|
+
* `duration`, `record`, `array` and `null` are not. The runtime's registry is the only list —
|
|
13
|
+
* the same one the installer and the CSV reader read — so a primitive the metaschema admits is
|
|
14
|
+
* a primitive the checker admits, and no alias restates it here.
|
|
15
|
+
*/
|
|
16
|
+
export declare function datasetType(ctx: CheckContext, op: DatasetOperator, node: CallNode, operands: Operands): StaticType;
|
|
17
|
+
//# sourceMappingURL=datasets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../src/expr/typecheck/datasets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAMT,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,qEAAqE;AACrE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;AAElE;;;;;;;;GAQG;AAEH,wBAAgB,WAAW,CACzB,GAAG,EAAE,YAAY,EACjB,EAAE,EAAE,eAAe,EACnB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,QAAQ,GACjB,UAAU,CAqCZ"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { DATASET_SCALAR_PRIMITIVE_SET, isScalarPrimitive } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { withArticle } from '../../article.js';
|
|
3
|
+
import { ExpressionCompileError } from '../diagnostics.js';
|
|
4
|
+
import { closestNames } from '../suggest.js';
|
|
5
|
+
import { isPrimitive, primitiveType, typeName } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* The domains a set can hold, `spec/metaschema/dataset.v1.json` `$defs/scalarPrimitive`.
|
|
8
|
+
*
|
|
9
|
+
* A `decimal`, `date` or `instant` is a string on the wire, so its declared domain is allowed
|
|
10
|
+
* even though the wire scalar union names no member for it; `media_ref`, `signature_ref`,
|
|
11
|
+
* `duration`, `record`, `array` and `null` are not. The runtime's registry is the only list —
|
|
12
|
+
* the same one the installer and the CSV reader read — so a primitive the metaschema admits is
|
|
13
|
+
* a primitive the checker admits, and no alias restates it here.
|
|
14
|
+
*/
|
|
15
|
+
export function datasetType(ctx, op, node, operands) {
|
|
16
|
+
switch (op) {
|
|
17
|
+
case 'in_set': {
|
|
18
|
+
const table = datasetTable(ctx, op, operands.nodeAt(0), 'set');
|
|
19
|
+
// A set holds dataset scalars (`dataset.v1.jsonscalar`), so a
|
|
20
|
+
// record or a list can never be a member: refusing it here is the typing rule's
|
|
21
|
+
// `table, T -> boolean`, and it keeps a key the report cannot
|
|
22
|
+
// express out of the artifact in the first place.
|
|
23
|
+
const valueType = ctx.check(operands.nodeAt(1));
|
|
24
|
+
if (valueType.kind !== 'primitive' ||
|
|
25
|
+
!isScalarPrimitive(valueType.primitive) ||
|
|
26
|
+
!DATASET_SCALAR_PRIMITIVE_SET.has(valueType.primitive)) {
|
|
27
|
+
throw ctx.mismatch(operands.nodeAt(1), `\`in_set\` tests one dataset scalar against \`${table.tableId}\`, but this operand is ${typeName(valueType)}`);
|
|
28
|
+
}
|
|
29
|
+
// A set carries no date of its own; an explicit one overrides the host's record date
|
|
30
|
+
// for this call, and with neither a data-bound set stays stale.
|
|
31
|
+
asOfType(ctx, table, node, 'optional');
|
|
32
|
+
return primitiveType('boolean');
|
|
33
|
+
}
|
|
34
|
+
case 'lookup': {
|
|
35
|
+
const table = datasetTable(ctx, op, operands.nodeAt(0), 'lookup');
|
|
36
|
+
keyTypes(ctx, table, operands.nodeAt(1), op);
|
|
37
|
+
asOfType(ctx, table, node, 'required');
|
|
38
|
+
return datasetResultType(table);
|
|
39
|
+
}
|
|
40
|
+
case 'decide_keys': {
|
|
41
|
+
const table = datasetTable(ctx, op, operands.nodeAt(0), 'decision_table');
|
|
42
|
+
keyTypes(ctx, table, operands.nodeAt(1), op);
|
|
43
|
+
asOfType(ctx, table, node, 'required');
|
|
44
|
+
return datasetResultType(table);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The declaration a dataset built-in names: the first argument is a table
|
|
50
|
+
* identifier rather than a read, so it resolves against the declared datasets and never
|
|
51
|
+
* against a field of that name.
|
|
52
|
+
*/
|
|
53
|
+
function datasetTable(ctx, op, arg, expected) {
|
|
54
|
+
if (arg.kind !== 'path' || arg.path.includes('.')) {
|
|
55
|
+
throw ctx.mismatch(arg, `\`${op}\` requires a declared table name as its first argument; name it`);
|
|
56
|
+
}
|
|
57
|
+
const table = ctx.datasets.get(arg.path);
|
|
58
|
+
if (table === undefined) {
|
|
59
|
+
throw new ExpressionCompileError('TABLE_NOT_DECLARED', ctx.offsetOf(arg), `\`${op}\` names table \`${arg.path}\`, which the artifact does not declare; declare it in \`datasets\`, or correct the table id`, closestNames(arg.path, [...ctx.datasets.keys()]));
|
|
60
|
+
}
|
|
61
|
+
if (table.kind !== expected) {
|
|
62
|
+
throw ctx.mismatch(arg, `\`${op}\` requires a ${expected} table, but \`${table.tableId}\` is a ${table.kind}`);
|
|
63
|
+
}
|
|
64
|
+
return table;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The `asOf` argument: a date when the call names one, forbidden for a
|
|
68
|
+
* `behavior` table, which pins to the case. A `data` table resolves against a date, so a
|
|
69
|
+
* `lookup` or `decide_keys` must name one; an `in_set` may leave it to the host's record date,
|
|
70
|
+
* which is the one call form whose date the environment may supply.
|
|
71
|
+
*/
|
|
72
|
+
function asOfType(ctx, table, node, requirement) {
|
|
73
|
+
const argument = node.args[2];
|
|
74
|
+
if (table.binding === 'behavior') {
|
|
75
|
+
if (argument !== undefined) {
|
|
76
|
+
throw ctx.mismatch(argument, `\`${table.tableId}\` is behavior-bound; remove the as-of date, because the table pins to the case`);
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (argument === undefined) {
|
|
81
|
+
if (requirement === 'optional')
|
|
82
|
+
return;
|
|
83
|
+
throw ctx.mismatch(node, `\`${table.tableId}\` is data-bound; supply the as-of record date`);
|
|
84
|
+
}
|
|
85
|
+
const type = ctx.check(argument);
|
|
86
|
+
if (!isPrimitive(type, 'date')) {
|
|
87
|
+
throw ctx.mismatch(argument, `an as-of argument must be a date, got ${typeName(type)}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The key vector of `lookup(table, keys)` and `decide_keys(table, keys)`:
|
|
92
|
+
* one key value per key column, in declaration order.
|
|
93
|
+
* A list literal is checked column by column; a computed list is checked when it resolves,
|
|
94
|
+
* because its members carry no declaration here.
|
|
95
|
+
*/
|
|
96
|
+
function keyTypes(ctx, table, node, op) {
|
|
97
|
+
const keyColumns = columnsOf(table, 'key');
|
|
98
|
+
if (node.kind === 'list') {
|
|
99
|
+
if (node.items.length !== keyColumns.length) {
|
|
100
|
+
throw ctx.mismatch(node, `\`${table.tableId}\` takes ${String(keyColumns.length)} key value${keyColumns.length === 1 ? '' : 's'}, found ${String(node.items.length)}`);
|
|
101
|
+
}
|
|
102
|
+
node.items.forEach((item, index) => {
|
|
103
|
+
const column = keyColumns[index];
|
|
104
|
+
if (column === undefined)
|
|
105
|
+
return;
|
|
106
|
+
const type = ctx.check(item);
|
|
107
|
+
if (!isPrimitive(type, column.primitive)) {
|
|
108
|
+
throw ctx.mismatch(item, `key column \`${column.columnId}\` of \`${table.tableId}\` is ${withArticle(column.primitive)}, not ${typeName(type)}`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const type = ctx.check(node);
|
|
114
|
+
if (type.kind !== 'list') {
|
|
115
|
+
throw ctx.mismatch(node, `\`${op}\` requires a list of key values, got ${typeName(type)}`);
|
|
116
|
+
}
|
|
117
|
+
// A composite key is a list of canonical scalars; a record or a nested
|
|
118
|
+
// list can never equal a key entry, so it is refused rather than resolved as a miss.
|
|
119
|
+
if (type.element !== undefined && type.element.kind !== 'primitive') {
|
|
120
|
+
throw ctx.mismatch(node, `\`${op}\` key values are scalars, not ${typeName(type.element)}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** The record a hit returns, or the ordered list a `COLLECT` hit returns. */
|
|
124
|
+
function datasetResultType(table) {
|
|
125
|
+
const fields = columnsOf(table, 'output').map((column) => ({
|
|
126
|
+
fieldId: column.columnId,
|
|
127
|
+
primitive: column.primitive,
|
|
128
|
+
}));
|
|
129
|
+
const record = { kind: 'record', fields, open: false };
|
|
130
|
+
return table.hitPolicy === 'COLLECT' ? { kind: 'list', element: record, open: false } : record;
|
|
131
|
+
}
|
|
132
|
+
/** The declared columns of one role, in declaration order. */
|
|
133
|
+
function columnsOf(table, role) {
|
|
134
|
+
return (table.columns ?? []).filter((column) => column.role === role);
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=datasets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../../src/expr/typecheck/datasets.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAI7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAKlE;;;;;;;;GAQG;AAEH,MAAM,UAAU,WAAW,CACzB,GAAiB,EACjB,EAAmB,EACnB,IAAc,EACd,QAAkB;IAElB,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,QAAQ,EAAE,CAAC;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CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,SAAS,iBAAiB,CAAC,KAAyB;IAClD,MAAM,MAAM,GAA6B,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnF,OAAO,EAAE,MAAM,CAAC,QAAQ;QACxB,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC,CAAC,CAAC;IACJ,MAAM,MAAM,GAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACnE,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AACjG,CAAC;AAED,8DAA8D;AAC9D,SAAS,SAAS,CAChB,KAAyB,EACzB,IAA2B;IAE3B,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import type {\n CallNode,\n CompiledField,\n DatasetColumn,\n DatasetDeclaration,\n ExprNode,\n TableKind,\n} from '@azx-pbc/axiom-runtime';\nimport { DATASET_SCALAR_PRIMITIVE_SET, isScalarPrimitive } from '@azx-pbc/axiom-runtime';\nimport { withArticle } from '../../article.js';\nimport { ExpressionCompileError } from '../diagnostics.js';\nimport { closestNames } from '../suggest.js';\nimport type { CheckContext } from './context.js';\nimport type { Operands } from './operands.js';\nimport type { StaticType } from './types.js';\nimport { isPrimitive, primitiveType, typeName } from './types.js';\n\n/** The dataset built-ins: membership, lookup and decision tables. */\nexport type DatasetOperator = 'in_set' | 'lookup' | 'decide_keys';\n\n/**\n * The domains a set can hold, `spec/metaschema/dataset.v1.json` `$defs/scalarPrimitive`.\n *\n * A `decimal`, `date` or `instant` is a string on the wire, so its declared domain is allowed\n * even though the wire scalar union names no member for it; `media_ref`, `signature_ref`,\n * `duration`, `record`, `array` and `null` are not. The runtime's registry is the only list —\n * the same one the installer and the CSV reader read — so a primitive the metaschema admits is\n * a primitive the checker admits, and no alias restates it here.\n */\n\nexport function datasetType(\n ctx: CheckContext,\n op: DatasetOperator,\n node: CallNode,\n operands: Operands,\n): StaticType {\n switch (op) {\n case 'in_set': {\n const table = datasetTable(ctx, op, operands.nodeAt(0), 'set');\n // A set holds dataset scalars (`dataset.v1.jsonscalar`), so a\n // record or a list can never be a member: refusing it here is the typing rule's\n // `table, T -> boolean`, and it keeps a key the report cannot\n // express out of the artifact in the first place.\n const valueType = ctx.check(operands.nodeAt(1));\n if (\n valueType.kind !== 'primitive' ||\n !isScalarPrimitive(valueType.primitive) ||\n !DATASET_SCALAR_PRIMITIVE_SET.has(valueType.primitive)\n ) {\n throw ctx.mismatch(\n operands.nodeAt(1),\n `\\`in_set\\` tests one dataset scalar against \\`${table.tableId}\\`, but this operand is ${typeName(valueType)}`,\n );\n }\n // A set carries no date of its own; an explicit one overrides the host's record date\n // for this call, and with neither a data-bound set stays stale.\n asOfType(ctx, table, node, 'optional');\n return primitiveType('boolean');\n }\n case 'lookup': {\n const table = datasetTable(ctx, op, operands.nodeAt(0), 'lookup');\n keyTypes(ctx, table, operands.nodeAt(1), op);\n asOfType(ctx, table, node, 'required');\n return datasetResultType(table);\n }\n case 'decide_keys': {\n const table = datasetTable(ctx, op, operands.nodeAt(0), 'decision_table');\n keyTypes(ctx, table, operands.nodeAt(1), op);\n asOfType(ctx, table, node, 'required');\n return datasetResultType(table);\n }\n }\n}\n\n/**\n * The declaration a dataset built-in names: the first argument is a table\n * identifier rather than a read, so it resolves against the declared datasets and never\n * against a field of that name.\n */\nfunction datasetTable(\n ctx: CheckContext,\n op: string,\n arg: ExprNode,\n expected: TableKind,\n): DatasetDeclaration {\n if (arg.kind !== 'path' || arg.path.includes('.')) {\n throw ctx.mismatch(\n arg,\n `\\`${op}\\` requires a declared table name as its first argument; name it`,\n );\n }\n const table = ctx.datasets.get(arg.path);\n if (table === undefined) {\n throw new ExpressionCompileError(\n 'TABLE_NOT_DECLARED',\n ctx.offsetOf(arg),\n `\\`${op}\\` names table \\`${arg.path}\\`, which the artifact does not declare; declare it in \\`datasets\\`, or correct the table id`,\n closestNames(arg.path, [...ctx.datasets.keys()]),\n );\n }\n if (table.kind !== expected) {\n throw ctx.mismatch(\n arg,\n `\\`${op}\\` requires a ${expected} table, but \\`${table.tableId}\\` is a ${table.kind}`,\n );\n }\n return table;\n}\n\n/**\n * The `asOf` argument: a date when the call names one, forbidden for a\n * `behavior` table, which pins to the case. A `data` table resolves against a date, so a\n * `lookup` or `decide_keys` must name one; an `in_set` may leave it to the host's record date,\n * which is the one call form whose date the environment may supply.\n */\nfunction asOfType(\n ctx: CheckContext,\n table: DatasetDeclaration,\n node: CallNode,\n requirement: 'required' | 'optional',\n): void {\n const argument = node.args[2];\n if (table.binding === 'behavior') {\n if (argument !== undefined) {\n throw ctx.mismatch(\n argument,\n `\\`${table.tableId}\\` is behavior-bound; remove the as-of date, because the table pins to the case`,\n );\n }\n return;\n }\n if (argument === undefined) {\n if (requirement === 'optional') return;\n throw ctx.mismatch(node, `\\`${table.tableId}\\` is data-bound; supply the as-of record date`);\n }\n const type = ctx.check(argument);\n if (!isPrimitive(type, 'date')) {\n throw ctx.mismatch(argument, `an as-of argument must be a date, got ${typeName(type)}`);\n }\n}\n\n/**\n * The key vector of `lookup(table, keys)` and `decide_keys(table, keys)`:\n * one key value per key column, in declaration order.\n * A list literal is checked column by column; a computed list is checked when it resolves,\n * because its members carry no declaration here.\n */\nfunction keyTypes(ctx: CheckContext, table: DatasetDeclaration, node: ExprNode, op: string): void {\n const keyColumns = columnsOf(table, 'key');\n if (node.kind === 'list') {\n if (node.items.length !== keyColumns.length) {\n throw ctx.mismatch(\n node,\n `\\`${table.tableId}\\` takes ${String(keyColumns.length)} key value${keyColumns.length === 1 ? '' : 's'}, found ${String(node.items.length)}`,\n );\n }\n node.items.forEach((item, index) => {\n const column = keyColumns[index];\n if (column === undefined) return;\n const type = ctx.check(item);\n if (!isPrimitive(type, column.primitive)) {\n throw ctx.mismatch(\n item,\n `key column \\`${column.columnId}\\` of \\`${table.tableId}\\` is ${withArticle(column.primitive)}, not ${typeName(type)}`,\n );\n }\n });\n return;\n }\n const type = ctx.check(node);\n if (type.kind !== 'list') {\n throw ctx.mismatch(node, `\\`${op}\\` requires a list of key values, got ${typeName(type)}`);\n }\n // A composite key is a list of canonical scalars; a record or a nested\n // list can never equal a key entry, so it is refused rather than resolved as a miss.\n if (type.element !== undefined && type.element.kind !== 'primitive') {\n throw ctx.mismatch(node, `\\`${op}\\` key values are scalars, not ${typeName(type.element)}`);\n }\n}\n\n/** The record a hit returns, or the ordered list a `COLLECT` hit returns. */\nfunction datasetResultType(table: DatasetDeclaration): StaticType {\n const fields: readonly CompiledField[] = columnsOf(table, 'output').map((column) => ({\n fieldId: column.columnId,\n primitive: column.primitive,\n }));\n const record: StaticType = { kind: 'record', fields, open: false };\n return table.hitPolicy === 'COLLECT' ? { kind: 'list', element: record, open: false } : record;\n}\n\n/** The declared columns of one role, in declaration order. */\nfunction columnsOf(\n table: DatasetDeclaration,\n role: DatasetColumn['role'],\n): readonly DatasetColumn[] {\n return (table.columns ?? []).filter((column) => column.role === role);\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CallNode } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { CheckContext } from './context.js';
|
|
3
|
+
import type { Operands } from './operands.js';
|
|
4
|
+
import type { StaticType } from './types.js';
|
|
5
|
+
/** `digest(fields, version)`: the binding a signature covers. */
|
|
6
|
+
export declare function digestType(ctx: CheckContext, node: CallNode, operands: Operands): StaticType;
|
|
7
|
+
//# sourceMappingURL=digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../src/expr/typecheck/digest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,iEAAiE;AACjE,wBAAgB,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAsD5F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isPrimitive, primitiveType } from './types.js';
|
|
2
|
+
/** `digest(fields, version)`: the binding a signature covers. */
|
|
3
|
+
export function digestType(ctx, node, operands) {
|
|
4
|
+
// A covered target is an identity, not a value: the list names the fields whose
|
|
5
|
+
// `(fieldId, rowKey?)` the binding covers, in declared order. Its
|
|
6
|
+
// members are identities of mixed domains, so the list is not one element type.
|
|
7
|
+
const targets = node.args[0];
|
|
8
|
+
if (targets === undefined || targets.kind !== 'list') {
|
|
9
|
+
throw ctx.mismatch(node, '`digest` requires a list literal of the fields it covers; write the list');
|
|
10
|
+
}
|
|
11
|
+
if (targets.items.length === 0) {
|
|
12
|
+
throw ctx.mismatch(node, '`digest` requires at least one covered field; name one');
|
|
13
|
+
}
|
|
14
|
+
for (let index = 0; index < targets.items.length; index += 1) {
|
|
15
|
+
const target = targets.items[index];
|
|
16
|
+
if (target === undefined || target.kind !== 'path') {
|
|
17
|
+
throw ctx.mismatch(target ?? node, '`digest` requires a list literal of the fields it covers; name the fields');
|
|
18
|
+
}
|
|
19
|
+
ctx.check(target);
|
|
20
|
+
// Re-read the element because check-time `.length` lowering can rewrite a string/list
|
|
21
|
+
// `.length` path in place to `len(...)`, which is a computed value rather than a field identity.
|
|
22
|
+
const checked = targets.items[index];
|
|
23
|
+
if (checked === undefined || checked.kind !== 'path') {
|
|
24
|
+
throw ctx.mismatch(checked ?? node, '`digest` requires a list literal of the fields it covers; name the fields');
|
|
25
|
+
}
|
|
26
|
+
// A covered target's identity is the row its scope addresses: `$prev`/`$next`
|
|
27
|
+
// read a neighbour's value and `$i` is a position, so none of them can name the
|
|
28
|
+
// row a binding covers.
|
|
29
|
+
const head = checked.path.split('.')[0];
|
|
30
|
+
if (head === '$prev' || head === '$next' || head === '$i') {
|
|
31
|
+
throw ctx.mismatch(checked, '`digest` covers the row its scope addresses; a neighbour or index binder cannot name one');
|
|
32
|
+
}
|
|
33
|
+
// A covered target is a `fieldId`, which a context root is not; a signature can
|
|
34
|
+
// never declare one, so binding it would produce a digest nothing can verify.
|
|
35
|
+
const segments = checked.path.split('.');
|
|
36
|
+
if (segments[0] === 'context' &&
|
|
37
|
+
(ctx.fields.get('context') === undefined || ctx.contextRoots.has(segments.slice(1).join('.')))) {
|
|
38
|
+
throw ctx.mismatch(checked, '`digest` covers declared fields; a context root is not one');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
operands.requireType(1, (type) => isPrimitive(type, 'integer'), 'an integer schema version');
|
|
42
|
+
return primitiveType('string');
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=digest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.js","sourceRoot":"","sources":["../../../src/expr/typecheck/digest.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAExD,iEAAiE;AACjE,MAAM,UAAU,UAAU,CAAC,GAAiB,EAAE,IAAc,EAAE,QAAkB;IAC9E,gFAAgF;IAChF,kEAAkE;IAClE,gFAAgF;IAChF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CA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AM,GAAG,CAAC,QAAQ,CAChB,OAAO,EACP,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,gFAAgF;QAChF,8EAA8E;QAC9E,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzC,IACE,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS;YACzB,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAC9F,CAAC;YACD,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,4DAA4D,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,2BAA2B,CAAC,CAAC;IAC7F,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import type { CallNode } from '@azx-pbc/axiom-runtime';\nimport type { CheckContext } from './context.js';\nimport type { Operands } from './operands.js';\nimport type { StaticType } from './types.js';\nimport { isPrimitive, primitiveType } from './types.js';\n\n/** `digest(fields, version)`: the binding a signature covers. */\nexport function digestType(ctx: CheckContext, node: CallNode, operands: Operands): StaticType {\n // A covered target is an identity, not a value: the list names the fields whose\n // `(fieldId, rowKey?)` the binding covers, in declared order. Its\n // members are identities of mixed domains, so the list is not one element type.\n const targets = node.args[0];\n if (targets === undefined || targets.kind !== 'list') {\n throw ctx.mismatch(\n node,\n '`digest` requires a list literal of the fields it covers; write the list',\n );\n }\n if (targets.items.length === 0) {\n throw ctx.mismatch(node, '`digest` requires at least one covered field; name one');\n }\n for (let index = 0; index < targets.items.length; index += 1) {\n const target = targets.items[index];\n if (target === undefined || target.kind !== 'path') {\n throw ctx.mismatch(\n target ?? node,\n '`digest` requires a list literal of the fields it covers; name the fields',\n );\n }\n ctx.check(target);\n // Re-read the element because check-time `.length` lowering can rewrite a string/list\n // `.length` path in place to `len(...)`, which is a computed value rather than a field identity.\n const checked = targets.items[index];\n if (checked === undefined || checked.kind !== 'path') {\n throw ctx.mismatch(\n checked ?? node,\n '`digest` requires a list literal of the fields it covers; name the fields',\n );\n }\n // A covered target's identity is the row its scope addresses: `$prev`/`$next`\n // read a neighbour's value and `$i` is a position, so none of them can name the\n // row a binding covers.\n const head = checked.path.split('.')[0];\n if (head === '$prev' || head === '$next' || head === '$i') {\n throw ctx.mismatch(\n checked,\n '`digest` covers the row its scope addresses; a neighbour or index binder cannot name one',\n );\n }\n // A covered target is a `fieldId`, which a context root is not; a signature can\n // never declare one, so binding it would produce a digest nothing can verify.\n const segments = checked.path.split('.');\n if (\n segments[0] === 'context' &&\n (ctx.fields.get('context') === undefined || ctx.contextRoots.has(segments.slice(1).join('.')))\n ) {\n throw ctx.mismatch(checked, '`digest` covers declared fields; a context root is not one');\n }\n }\n operands.requireType(1, (type) => isPrimitive(type, 'integer'), 'an integer schema version');\n return primitiveType('string');\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ExprNode } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { CheckContext } from './context.js';
|
|
3
|
+
/**
|
|
4
|
+
* A value aggregate the checker found legal, folding a list it cannot prove non-empty.
|
|
5
|
+
*
|
|
6
|
+
* `min` and `max` answer `UNKNOWN` over an empty list, and `sum` answers `UNKNOWN` over an
|
|
7
|
+
* empty list of money because money names no currency to total (`EXPR-10.2.2`,
|
|
8
|
+
* `EXPR-7.2.13`). A rule that writes one of them over a list that may be empty submits a form
|
|
9
|
+
* that decides nothing; the finding is not a refusal, and the surface turns it into an
|
|
10
|
+
* `UNDECIDED_AGGREGATE` warning.
|
|
11
|
+
*
|
|
12
|
+
* `sum` over a *numeric* list is not recorded: a present empty list totals decimal `0`
|
|
13
|
+
* (`EXPR-6.1.9`, `EXPR-10.2.2`), so that form is decided and there is nothing an author must
|
|
14
|
+
* repair.
|
|
15
|
+
*/
|
|
16
|
+
export interface UndecidedFold {
|
|
17
|
+
/** The aggregate that folds the list. A numeric `sum` is never recorded: it is decided. */
|
|
18
|
+
readonly op: 'sum' | 'min' | 'max' | 'avg' | 'median';
|
|
19
|
+
/** The value domain whose empty list has no total: money, or a quantity/duration with no unit. */
|
|
20
|
+
readonly domain?: 'money' | 'quantity' | 'duration';
|
|
21
|
+
readonly offset: number;
|
|
22
|
+
/** The authored list, when it has a source spelling, such as `f_rows`; else `undefined`. */
|
|
23
|
+
readonly list: string | undefined;
|
|
24
|
+
/** The declared member a `minItems` would prove the list non-empty, when one exists. */
|
|
25
|
+
readonly declaration: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Records an `UNDECIDED_AGGREGATE` finding for one value aggregate, when the fold is undecided.
|
|
29
|
+
*
|
|
30
|
+
* Only facts about the aggregate form and the declaration are read: a list literal's own length,
|
|
31
|
+
* a path's `minItems`, and a comprehension's filter. Nothing here follows a value through the
|
|
32
|
+
* document, so a list the checker cannot prove non-empty from the declaration it names is
|
|
33
|
+
* reported rather than guessed safe.
|
|
34
|
+
*
|
|
35
|
+
* The proof is deliberately conservative around the implicit binders. `$it`, `$prev` and `$next`
|
|
36
|
+
* are rebound by every comprehension, so a declaration a path reaches through them cannot be
|
|
37
|
+
* attributed to the folded list. `$row` is stable, but its members are declared inside an array
|
|
38
|
+
* row, where v1 refuses `minItems`; neither resolves to a declaration, and both stay undecided.
|
|
39
|
+
*/
|
|
40
|
+
export declare function noteUndecidedFold(ctx: CheckContext, call: ExprNode, op: UndecidedFold['op'], operand: ExprNode | undefined, domain?: 'money' | 'quantity' | 'duration'): void;
|
|
41
|
+
//# sourceMappingURL=fold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../../src/expr/typecheck/fold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IACtD,kGAAkG;IAClG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,wFAAwF;IACxF,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,YAAY,EACjB,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,EACvB,OAAO,EAAE,QAAQ,GAAG,SAAS,EAC7B,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,GACzC,IAAI,CAYN"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records an `UNDECIDED_AGGREGATE` finding for one value aggregate, when the fold is undecided.
|
|
3
|
+
*
|
|
4
|
+
* Only facts about the aggregate form and the declaration are read: a list literal's own length,
|
|
5
|
+
* a path's `minItems`, and a comprehension's filter. Nothing here follows a value through the
|
|
6
|
+
* document, so a list the checker cannot prove non-empty from the declaration it names is
|
|
7
|
+
* reported rather than guessed safe.
|
|
8
|
+
*
|
|
9
|
+
* The proof is deliberately conservative around the implicit binders. `$it`, `$prev` and `$next`
|
|
10
|
+
* are rebound by every comprehension, so a declaration a path reaches through them cannot be
|
|
11
|
+
* attributed to the folded list. `$row` is stable, but its members are declared inside an array
|
|
12
|
+
* row, where v1 refuses `minItems`; neither resolves to a declaration, and both stay undecided.
|
|
13
|
+
*/
|
|
14
|
+
export function noteUndecidedFold(ctx, call, op, operand, domain) {
|
|
15
|
+
if (operand === undefined)
|
|
16
|
+
return;
|
|
17
|
+
if (ctx.isInlinedNode(call))
|
|
18
|
+
return;
|
|
19
|
+
if (isProvablyNonEmpty(operand, (path) => ctx.fieldAtPath(path)))
|
|
20
|
+
return;
|
|
21
|
+
const list = foldedList(operand);
|
|
22
|
+
ctx.reportUndecidedFold({
|
|
23
|
+
op,
|
|
24
|
+
...(domain === undefined ? {} : { domain }),
|
|
25
|
+
offset: ctx.offsetOf(operand),
|
|
26
|
+
list: listName(list),
|
|
27
|
+
declaration: declaredListName(list, ctx),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** The list an aggregate actually folds, for the name and declaration the message states. */
|
|
31
|
+
function foldedList(node) {
|
|
32
|
+
let current = node;
|
|
33
|
+
while (current.kind === 'comprehension')
|
|
34
|
+
current = current.source;
|
|
35
|
+
return current;
|
|
36
|
+
}
|
|
37
|
+
/** The authored spelling of the folded list, when it is a path the author can name. */
|
|
38
|
+
function listName(node) {
|
|
39
|
+
return node.kind === 'path' ? node.path : undefined;
|
|
40
|
+
}
|
|
41
|
+
/** The declaration a `minItems: 1` would prove the folded list non-empty, when one exists. */
|
|
42
|
+
function declaredListName(node, ctx) {
|
|
43
|
+
if (node.kind !== 'path')
|
|
44
|
+
return undefined;
|
|
45
|
+
const field = ctx.fieldAtPath(node.path);
|
|
46
|
+
return field?.fieldId;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether the list cannot be empty on any form that passes the declared shape.
|
|
50
|
+
*
|
|
51
|
+
* A non-empty literal is non-empty by construction. A declared array with `minItems` at least
|
|
52
|
+
* one cannot be empty: an absent array counts as zero entries and the declaration folds that
|
|
53
|
+
* into readiness as a blocker (`spec/semantics/model-v1.md` `MODEL-2.1.17`). A comprehension is
|
|
54
|
+
* only as non-empty as its source, and only when it has no filter: a filter may drop every
|
|
55
|
+
* element, so a filtered comprehension is never a proof.
|
|
56
|
+
*/
|
|
57
|
+
function isProvablyNonEmpty(node, fieldAtPath) {
|
|
58
|
+
switch (node.kind) {
|
|
59
|
+
case 'list':
|
|
60
|
+
return node.items.length > 0;
|
|
61
|
+
case 'path': {
|
|
62
|
+
const field = fieldAtPath(node.path);
|
|
63
|
+
return field !== undefined && field.primitive === 'array' && (field.minItems ?? 0) >= 1;
|
|
64
|
+
}
|
|
65
|
+
case 'comprehension':
|
|
66
|
+
return node.predicate === undefined && isProvablyNonEmpty(node.source, fieldAtPath);
|
|
67
|
+
default:
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=fold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold.js","sourceRoot":"","sources":["../../../src/expr/typecheck/fold.ts"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAiB,EACjB,IAAc,EACd,EAAuB,EACvB,OAA6B,EAC7B,MAA0C;IAE1C,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAClC,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC;QAAE,OAAO;IACpC,IAAI,kBAAkB,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO;IACzE,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACjC,GAAG,CAAC,mBAAmB,CAAC;QACtB,EAAE;QACF,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC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AAC;QACD,KAAK,eAAe;YAClB,OAAO,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACtF;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC","sourcesContent":["import type { CompiledField, ExprNode } from '@azx-pbc/axiom-runtime';\nimport type { CheckContext } from './context.js';\n\n/**\n * A value aggregate the checker found legal, folding a list it cannot prove non-empty.\n *\n * `min` and `max` answer `UNKNOWN` over an empty list, and `sum` answers `UNKNOWN` over an\n * empty list of money because money names no currency to total (`EXPR-10.2.2`,\n * `EXPR-7.2.13`). A rule that writes one of them over a list that may be empty submits a form\n * that decides nothing; the finding is not a refusal, and the surface turns it into an\n * `UNDECIDED_AGGREGATE` warning.\n *\n * `sum` over a *numeric* list is not recorded: a present empty list totals decimal `0`\n * (`EXPR-6.1.9`, `EXPR-10.2.2`), so that form is decided and there is nothing an author must\n * repair.\n */\nexport interface UndecidedFold {\n /** The aggregate that folds the list. A numeric `sum` is never recorded: it is decided. */\n readonly op: 'sum' | 'min' | 'max' | 'avg' | 'median';\n /** The value domain whose empty list has no total: money, or a quantity/duration with no unit. */\n readonly domain?: 'money' | 'quantity' | 'duration';\n readonly offset: number;\n /** The authored list, when it has a source spelling, such as `f_rows`; else `undefined`. */\n readonly list: string | undefined;\n /** The declared member a `minItems` would prove the list non-empty, when one exists. */\n readonly declaration: string | undefined;\n}\n\n/**\n * Records an `UNDECIDED_AGGREGATE` finding for one value aggregate, when the fold is undecided.\n *\n * Only facts about the aggregate form and the declaration are read: a list literal's own length,\n * a path's `minItems`, and a comprehension's filter. Nothing here follows a value through the\n * document, so a list the checker cannot prove non-empty from the declaration it names is\n * reported rather than guessed safe.\n *\n * The proof is deliberately conservative around the implicit binders. `$it`, `$prev` and `$next`\n * are rebound by every comprehension, so a declaration a path reaches through them cannot be\n * attributed to the folded list. `$row` is stable, but its members are declared inside an array\n * row, where v1 refuses `minItems`; neither resolves to a declaration, and both stay undecided.\n */\nexport function noteUndecidedFold(\n ctx: CheckContext,\n call: ExprNode,\n op: UndecidedFold['op'],\n operand: ExprNode | undefined,\n domain?: 'money' | 'quantity' | 'duration',\n): void {\n if (operand === undefined) return;\n if (ctx.isInlinedNode(call)) return;\n if (isProvablyNonEmpty(operand, (path) => ctx.fieldAtPath(path))) return;\n const list = foldedList(operand);\n ctx.reportUndecidedFold({\n op,\n ...(domain === undefined ? {} : { domain }),\n offset: ctx.offsetOf(operand),\n list: listName(list),\n declaration: declaredListName(list, ctx),\n });\n}\n\n/** The list an aggregate actually folds, for the name and declaration the message states. */\nfunction foldedList(node: ExprNode): ExprNode {\n let current = node;\n while (current.kind === 'comprehension') current = current.source;\n return current;\n}\n\n/** The authored spelling of the folded list, when it is a path the author can name. */\nfunction listName(node: ExprNode): string | undefined {\n return node.kind === 'path' ? node.path : undefined;\n}\n\n/** The declaration a `minItems: 1` would prove the folded list non-empty, when one exists. */\nfunction declaredListName(node: ExprNode, ctx: CheckContext): string | undefined {\n if (node.kind !== 'path') return undefined;\n const field: CompiledField | undefined = ctx.fieldAtPath(node.path);\n return field?.fieldId;\n}\n\n/**\n * Whether the list cannot be empty on any form that passes the declared shape.\n *\n * A non-empty literal is non-empty by construction. A declared array with `minItems` at least\n * one cannot be empty: an absent array counts as zero entries and the declaration folds that\n * into readiness as a blocker (`spec/semantics/model-v1.md` `MODEL-2.1.17`). A comprehension is\n * only as non-empty as its source, and only when it has no filter: a filter may drop every\n * element, so a filtered comprehension is never a proof.\n */\nfunction isProvablyNonEmpty(\n node: ExprNode,\n fieldAtPath: (path: string) => CompiledField | undefined,\n): boolean {\n switch (node.kind) {\n case 'list':\n return node.items.length > 0;\n case 'path': {\n const field = fieldAtPath(node.path);\n return field !== undefined && field.primitive === 'array' && (field.minItems ?? 0) >= 1;\n }\n case 'comprehension':\n return node.predicate === undefined && isProvablyNonEmpty(node.source, fieldAtPath);\n default:\n return false;\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The built-ins that answer from the gate fold: the pass or block outcome of the rules a
|
|
3
|
+
* gate folds. A document admits them only inside a `gate` rule (`spec/semantics/expr-v1.md`
|
|
4
|
+
* `EXPR-15.1.7`, `EXPR-15.1.8`), because the fold is state a gate evaluation owns.
|
|
5
|
+
*
|
|
6
|
+
* The document compiler and `compileExpr` state one cause from here, so a caller moving an
|
|
7
|
+
* expression from a document slot to the standalone door reads the same reason. The set is
|
|
8
|
+
* one list because the step folds (`rule_ok_in`, `no_blocking_in`, `required_in`) are gate
|
|
9
|
+
* folds just as the single-rule forms are.
|
|
10
|
+
*/
|
|
11
|
+
declare const GATE_FOLD_OPERATORS: readonly ['rule_ok', 'no_blocking', 'rule_ok_in', 'no_blocking_in', 'required_in'];
|
|
12
|
+
export type GateFoldOperator = (typeof GATE_FOLD_OPERATORS)[number];
|
|
13
|
+
/** Whether an operator name reads the gate fold. */
|
|
14
|
+
export declare function isGateFoldOperator(op: string): op is GateFoldOperator;
|
|
15
|
+
/**
|
|
16
|
+
* The cause both doors state: the built-in reads the gate fold, and the fold belongs to a
|
|
17
|
+
* gate rule. Both report it as `RULE_REFERENCE`; only the surrounding diagnostic shape
|
|
18
|
+
* differs, so the sentence lives here once.
|
|
19
|
+
*/
|
|
20
|
+
export declare function gateFoldDetail(ops: readonly string[]): string;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=gate-folds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-folds.d.ts","sourceRoot":"","sources":["../../../src/expr/typecheck/gate-folds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,QAAA,MAAM,mBAAmB,YACvB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,aAAa,CACL,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAIpE,oDAAoD;AACpD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,EAAE,IAAI,gBAAgB,CAErE;AAUD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAG7D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The built-ins that answer from the gate fold: the pass or block outcome of the rules a
|
|
3
|
+
* gate folds. A document admits them only inside a `gate` rule (`spec/semantics/expr-v1.md`
|
|
4
|
+
* `EXPR-15.1.7`, `EXPR-15.1.8`), because the fold is state a gate evaluation owns.
|
|
5
|
+
*
|
|
6
|
+
* The document compiler and `compileExpr` state one cause from here, so a caller moving an
|
|
7
|
+
* expression from a document slot to the standalone door reads the same reason. The set is
|
|
8
|
+
* one list because the step folds (`rule_ok_in`, `no_blocking_in`, `required_in`) are gate
|
|
9
|
+
* folds just as the single-rule forms are.
|
|
10
|
+
*/
|
|
11
|
+
const GATE_FOLD_OPERATORS = [
|
|
12
|
+
'rule_ok',
|
|
13
|
+
'no_blocking',
|
|
14
|
+
'rule_ok_in',
|
|
15
|
+
'no_blocking_in',
|
|
16
|
+
'required_in',
|
|
17
|
+
];
|
|
18
|
+
const GATE_FOLD_OPERATOR_SET = new Set(GATE_FOLD_OPERATORS);
|
|
19
|
+
/** Whether an operator name reads the gate fold. */
|
|
20
|
+
export function isGateFoldOperator(op) {
|
|
21
|
+
return GATE_FOLD_OPERATOR_SET.has(op);
|
|
22
|
+
}
|
|
23
|
+
/** One or several operator names, spelled as the refusal names them. */
|
|
24
|
+
function gateFoldNames(ops) {
|
|
25
|
+
const names = [...new Set(ops)].map((op) => `\`${op}\``);
|
|
26
|
+
if (names.length <= 1)
|
|
27
|
+
return names[0] ?? '';
|
|
28
|
+
const last = names[names.length - 1] ?? '';
|
|
29
|
+
return `${names.slice(0, -1).join(', ')} and ${last}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The cause both doors state: the built-in reads the gate fold, and the fold belongs to a
|
|
33
|
+
* gate rule. Both report it as `RULE_REFERENCE`; only the surrounding diagnostic shape
|
|
34
|
+
* differs, so the sentence lives here once.
|
|
35
|
+
*/
|
|
36
|
+
export function gateFoldDetail(ops) {
|
|
37
|
+
const single = new Set(ops).size === 1;
|
|
38
|
+
return `${gateFoldNames(ops)} ${single ? 'reads' : 'read'} the gate fold, another rule's pass or block outcome, and ${single ? 'is' : 'are'} available only in a \`gate\` rule; move the check into a gate item`;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=gate-folds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-folds.js","sourceRoot":"","sources":["../../../src/expr/typecheck/gate-folds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,mBAAmB,GAAG;IAC1B,SAAS;IACT,aAAa;IACb,YAAY;IACZ,gBAAgB;IAChB,aAAa;CACL,CAAC;AAIX,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEjF,oDAAoD;AACpD,MAAM,UAAU,kBAAkB,CAAC,EAAU;IAC3C,OAAO,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,wEAAwE;AACxE,SAAS,aAAa,CAAC,GAAsB;IAC3C,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACzD,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAsB;IACnD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;IACvC,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,6DAA6D,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,qEAAqE,CAAC;AACnN,CAAC","sourcesContent":["/**\n * The built-ins that answer from the gate fold: the pass or block outcome of the rules a\n * gate folds. A document admits them only inside a `gate` rule (`spec/semantics/expr-v1.md`\n * `EXPR-15.1.7`, `EXPR-15.1.8`), because the fold is state a gate evaluation owns.\n *\n * The document compiler and `compileExpr` state one cause from here, so a caller moving an\n * expression from a document slot to the standalone door reads the same reason. The set is\n * one list because the step folds (`rule_ok_in`, `no_blocking_in`, `required_in`) are gate\n * folds just as the single-rule forms are.\n */\nconst GATE_FOLD_OPERATORS = [\n 'rule_ok',\n 'no_blocking',\n 'rule_ok_in',\n 'no_blocking_in',\n 'required_in',\n] as const;\n\nexport type GateFoldOperator = (typeof GATE_FOLD_OPERATORS)[number];\n\nconst GATE_FOLD_OPERATOR_SET: ReadonlySet<string> = new Set(GATE_FOLD_OPERATORS);\n\n/** Whether an operator name reads the gate fold. */\nexport function isGateFoldOperator(op: string): op is GateFoldOperator {\n return GATE_FOLD_OPERATOR_SET.has(op);\n}\n\n/** One or several operator names, spelled as the refusal names them. */\nfunction gateFoldNames(ops: readonly string[]): string {\n const names = [...new Set(ops)].map((op) => `\\`${op}\\``);\n if (names.length <= 1) return names[0] ?? '';\n const last = names[names.length - 1] ?? '';\n return `${names.slice(0, -1).join(', ')} and ${last}`;\n}\n\n/**\n * The cause both doors state: the built-in reads the gate fold, and the fold belongs to a\n * gate rule. Both report it as `RULE_REFERENCE`; only the surrounding diagnostic shape\n * differs, so the sentence lives here once.\n */\nexport function gateFoldDetail(ops: readonly string[]): string {\n const single = new Set(ops).size === 1;\n return `${gateFoldNames(ops)} ${single ? 'reads' : 'read'} the gate fold, another rule's pass or block outcome, and ${single ? 'is' : 'are'} available only in a \\`gate\\` rule; move the check into a gate item`;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Operands } from './operands.js';
|
|
2
|
+
import type { StaticType } from './types.js';
|
|
3
|
+
/** Presence, relevance, capability and rule-reference predicates. */
|
|
4
|
+
export type GuardOperator = 'present' | 'absent' | 'is_relevant' | 'has_cap' | 'rule_ok' | 'no_blocking' | 'rule_ok_in' | 'no_blocking_in' | 'required_in';
|
|
5
|
+
export declare function guardType(op: GuardOperator, operands: Operands): StaticType;
|
|
6
|
+
//# sourceMappingURL=guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../src/expr/typecheck/guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,qEAAqE;AACrE,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,QAAQ,GACR,aAAa,GACb,SAAS,GACT,SAAS,GACT,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,aAAa,CAAC;AAYlB,wBAAgB,SAAS,CAAC,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,UAAU,CA6B3E"}
|