@rcrsr/rill 0.15.0 → 0.16.0
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/dist/ast-nodes.d.ts +2 -13
- package/dist/ast-nodes.js +0 -1
- package/dist/ast-unions.d.ts +0 -1
- package/dist/ast-unions.js +0 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -1
- package/dist/error-classes.d.ts +0 -1
- package/dist/error-classes.js +0 -1
- package/dist/error-formatter.d.ts +0 -1
- package/dist/error-formatter.js +0 -1
- package/dist/error-registry.d.ts +0 -1
- package/dist/error-registry.js +32 -1
- package/dist/ext/crypto/index.d.ts +0 -1
- package/dist/ext/crypto/index.js +5 -6
- package/dist/ext/exec/index.d.ts +0 -1
- package/dist/ext/exec/index.js +3 -4
- package/dist/ext/exec/runner.d.ts +0 -1
- package/dist/ext/exec/runner.js +0 -1
- package/dist/ext/fetch/index.d.ts +0 -1
- package/dist/ext/fetch/index.js +8 -39
- package/dist/ext/fetch/request.d.ts +0 -1
- package/dist/ext/fetch/request.js +0 -1
- package/dist/ext/fs/index.d.ts +0 -1
- package/dist/ext/fs/index.js +26 -27
- package/dist/ext/fs/sandbox.d.ts +0 -1
- package/dist/ext/fs/sandbox.js +0 -1
- package/dist/ext/kv/index.d.ts +0 -1
- package/dist/ext/kv/index.js +19 -20
- package/dist/ext/kv/store.d.ts +0 -1
- package/dist/ext/kv/store.js +0 -1
- package/dist/generated/introspection-data.d.ts +0 -1
- package/dist/generated/introspection-data.js +0 -1
- package/dist/generated/version-data.d.ts +1 -2
- package/dist/generated/version-data.js +2 -3
- package/dist/highlight-map.d.ts +0 -1
- package/dist/highlight-map.js +0 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/lexer/errors.d.ts +0 -1
- package/dist/lexer/errors.js +0 -1
- package/dist/lexer/helpers.d.ts +0 -1
- package/dist/lexer/helpers.js +0 -1
- package/dist/lexer/index.d.ts +0 -1
- package/dist/lexer/index.js +0 -1
- package/dist/lexer/operators.d.ts +0 -1
- package/dist/lexer/operators.js +0 -1
- package/dist/lexer/readers.d.ts +0 -1
- package/dist/lexer/readers.js +0 -1
- package/dist/lexer/state.d.ts +0 -1
- package/dist/lexer/state.js +0 -1
- package/dist/lexer/tokenizer.d.ts +0 -1
- package/dist/lexer/tokenizer.js +0 -1
- package/dist/parser/helpers.d.ts +0 -1
- package/dist/parser/helpers.js +0 -1
- package/dist/parser/index.d.ts +0 -1
- package/dist/parser/index.js +0 -1
- package/dist/parser/parser-collect.d.ts +0 -1
- package/dist/parser/parser-collect.js +0 -1
- package/dist/parser/parser-control.d.ts +0 -1
- package/dist/parser/parser-control.js +0 -1
- package/dist/parser/parser-expr.d.ts +0 -1
- package/dist/parser/parser-expr.js +0 -1
- package/dist/parser/parser-extract.d.ts +0 -1
- package/dist/parser/parser-extract.js +0 -1
- package/dist/parser/parser-functions.d.ts +0 -1
- package/dist/parser/parser-functions.js +0 -1
- package/dist/parser/parser-literals.d.ts +0 -1
- package/dist/parser/parser-literals.js +4 -2
- package/dist/parser/parser-script.d.ts +0 -1
- package/dist/parser/parser-script.js +0 -1
- package/dist/parser/parser-shape.d.ts +2 -3
- package/dist/parser/parser-shape.js +8 -52
- package/dist/parser/parser-types.d.ts +28 -2
- package/dist/parser/parser-types.js +64 -13
- package/dist/parser/parser-use.d.ts +0 -1
- package/dist/parser/parser-use.js +0 -1
- package/dist/parser/parser-variables.d.ts +0 -1
- package/dist/parser/parser-variables.js +0 -1
- package/dist/parser/parser.d.ts +0 -1
- package/dist/parser/parser.js +0 -1
- package/dist/parser/state.d.ts +0 -1
- package/dist/parser/state.js +0 -1
- package/dist/runtime/core/callable.d.ts +40 -13
- package/dist/runtime/core/callable.js +137 -28
- package/dist/runtime/core/context.d.ts +0 -1
- package/dist/runtime/core/context.js +1 -2
- package/dist/runtime/core/equals.d.ts +0 -1
- package/dist/runtime/core/equals.js +35 -3
- package/dist/runtime/core/eval/base.d.ts +0 -1
- package/dist/runtime/core/eval/base.js +0 -1
- package/dist/runtime/core/eval/evaluator.d.ts +0 -1
- package/dist/runtime/core/eval/evaluator.js +0 -1
- package/dist/runtime/core/eval/index.d.ts +0 -1
- package/dist/runtime/core/eval/index.js +0 -1
- package/dist/runtime/core/eval/mixins/annotations.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/annotations.js +0 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/closures.js +82 -60
- package/dist/runtime/core/eval/mixins/collections.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/collections.js +9 -4
- package/dist/runtime/core/eval/mixins/control-flow.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.js +0 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/conversion.js +153 -86
- package/dist/runtime/core/eval/mixins/core.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/core.js +0 -1
- package/dist/runtime/core/eval/mixins/expressions.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/expressions.js +0 -1
- package/dist/runtime/core/eval/mixins/extraction.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/extraction.js +8 -9
- package/dist/runtime/core/eval/mixins/list-dispatch.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.js +0 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/literals.js +3 -7
- package/dist/runtime/core/eval/mixins/types.d.ts +2 -1
- package/dist/runtime/core/eval/mixins/types.js +222 -242
- package/dist/runtime/core/eval/mixins/use.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/use.js +0 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts +0 -1
- package/dist/runtime/core/eval/mixins/variables.js +6 -7
- package/dist/runtime/core/eval/types.d.ts +0 -1
- package/dist/runtime/core/eval/types.js +0 -1
- package/dist/runtime/core/execute.d.ts +0 -1
- package/dist/runtime/core/execute.js +0 -1
- package/dist/runtime/core/field-descriptor.d.ts +2 -3
- package/dist/runtime/core/field-descriptor.js +0 -1
- package/dist/runtime/core/introspection.d.ts +0 -1
- package/dist/runtime/core/introspection.js +0 -1
- package/dist/runtime/core/resolvers.d.ts +0 -1
- package/dist/runtime/core/resolvers.js +0 -1
- package/dist/runtime/core/signals.d.ts +0 -1
- package/dist/runtime/core/signals.js +0 -1
- package/dist/runtime/core/types.d.ts +0 -1
- package/dist/runtime/core/types.js +0 -1
- package/dist/runtime/core/values.d.ts +59 -26
- package/dist/runtime/core/values.js +289 -77
- package/dist/runtime/ext/builtins.d.ts +0 -1
- package/dist/runtime/ext/builtins.js +43 -17
- package/dist/runtime/ext/extensions.d.ts +0 -1
- package/dist/runtime/ext/extensions.js +0 -1
- package/dist/runtime/index.d.ts +2 -3
- package/dist/runtime/index.js +1 -2
- package/dist/signature-parser.d.ts +0 -1
- package/dist/signature-parser.js +8 -6
- package/dist/source-location.d.ts +0 -1
- package/dist/source-location.js +0 -1
- package/dist/token-types.d.ts +0 -1
- package/dist/token-types.js +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -1
- package/dist/value-types.d.ts +15 -12
- package/dist/value-types.js +0 -1
- package/package.json +2 -1
- package/dist/ast-nodes.d.ts.map +0 -1
- package/dist/ast-nodes.js.map +0 -1
- package/dist/ast-unions.d.ts.map +0 -1
- package/dist/ast-unions.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/error-classes.d.ts.map +0 -1
- package/dist/error-classes.js.map +0 -1
- package/dist/error-formatter.d.ts.map +0 -1
- package/dist/error-formatter.js.map +0 -1
- package/dist/error-registry.d.ts.map +0 -1
- package/dist/error-registry.js.map +0 -1
- package/dist/ext/crypto/index.d.ts.map +0 -1
- package/dist/ext/crypto/index.js.map +0 -1
- package/dist/ext/exec/index.d.ts.map +0 -1
- package/dist/ext/exec/index.js.map +0 -1
- package/dist/ext/exec/runner.d.ts.map +0 -1
- package/dist/ext/exec/runner.js.map +0 -1
- package/dist/ext/fetch/index.d.ts.map +0 -1
- package/dist/ext/fetch/index.js.map +0 -1
- package/dist/ext/fetch/request.d.ts.map +0 -1
- package/dist/ext/fetch/request.js.map +0 -1
- package/dist/ext/fs/index.d.ts.map +0 -1
- package/dist/ext/fs/index.js.map +0 -1
- package/dist/ext/fs/sandbox.d.ts.map +0 -1
- package/dist/ext/fs/sandbox.js.map +0 -1
- package/dist/ext/kv/index.d.ts.map +0 -1
- package/dist/ext/kv/index.js.map +0 -1
- package/dist/ext/kv/store.d.ts.map +0 -1
- package/dist/ext/kv/store.js.map +0 -1
- package/dist/generated/introspection-data.d.ts.map +0 -1
- package/dist/generated/introspection-data.js.map +0 -1
- package/dist/generated/version-data.d.ts.map +0 -1
- package/dist/generated/version-data.js.map +0 -1
- package/dist/highlight-map.d.ts.map +0 -1
- package/dist/highlight-map.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lexer/errors.d.ts.map +0 -1
- package/dist/lexer/errors.js.map +0 -1
- package/dist/lexer/helpers.d.ts.map +0 -1
- package/dist/lexer/helpers.js.map +0 -1
- package/dist/lexer/index.d.ts.map +0 -1
- package/dist/lexer/index.js.map +0 -1
- package/dist/lexer/operators.d.ts.map +0 -1
- package/dist/lexer/operators.js.map +0 -1
- package/dist/lexer/readers.d.ts.map +0 -1
- package/dist/lexer/readers.js.map +0 -1
- package/dist/lexer/state.d.ts.map +0 -1
- package/dist/lexer/state.js.map +0 -1
- package/dist/lexer/tokenizer.d.ts.map +0 -1
- package/dist/lexer/tokenizer.js.map +0 -1
- package/dist/parser/helpers.d.ts.map +0 -1
- package/dist/parser/helpers.js.map +0 -1
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/parser-collect.d.ts.map +0 -1
- package/dist/parser/parser-collect.js.map +0 -1
- package/dist/parser/parser-control.d.ts.map +0 -1
- package/dist/parser/parser-control.js.map +0 -1
- package/dist/parser/parser-expr.d.ts.map +0 -1
- package/dist/parser/parser-expr.js.map +0 -1
- package/dist/parser/parser-extract.d.ts.map +0 -1
- package/dist/parser/parser-extract.js.map +0 -1
- package/dist/parser/parser-functions.d.ts.map +0 -1
- package/dist/parser/parser-functions.js.map +0 -1
- package/dist/parser/parser-literals.d.ts.map +0 -1
- package/dist/parser/parser-literals.js.map +0 -1
- package/dist/parser/parser-script.d.ts.map +0 -1
- package/dist/parser/parser-script.js.map +0 -1
- package/dist/parser/parser-shape.d.ts.map +0 -1
- package/dist/parser/parser-shape.js.map +0 -1
- package/dist/parser/parser-types.d.ts.map +0 -1
- package/dist/parser/parser-types.js.map +0 -1
- package/dist/parser/parser-use.d.ts.map +0 -1
- package/dist/parser/parser-use.js.map +0 -1
- package/dist/parser/parser-variables.d.ts.map +0 -1
- package/dist/parser/parser-variables.js.map +0 -1
- package/dist/parser/parser.d.ts.map +0 -1
- package/dist/parser/parser.js.map +0 -1
- package/dist/parser/state.d.ts.map +0 -1
- package/dist/parser/state.js.map +0 -1
- package/dist/runtime/core/callable.d.ts.map +0 -1
- package/dist/runtime/core/callable.js.map +0 -1
- package/dist/runtime/core/context.d.ts.map +0 -1
- package/dist/runtime/core/context.js.map +0 -1
- package/dist/runtime/core/equals.d.ts.map +0 -1
- package/dist/runtime/core/equals.js.map +0 -1
- package/dist/runtime/core/eval/base.d.ts.map +0 -1
- package/dist/runtime/core/eval/base.js.map +0 -1
- package/dist/runtime/core/eval/evaluator.d.ts.map +0 -1
- package/dist/runtime/core/eval/evaluator.js.map +0 -1
- package/dist/runtime/core/eval/index.d.ts.map +0 -1
- package/dist/runtime/core/eval/index.js.map +0 -1
- package/dist/runtime/core/eval/mixins/annotations.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/annotations.js.map +0 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/closures.js.map +0 -1
- package/dist/runtime/core/eval/mixins/collections.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/collections.js.map +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/control-flow.js.map +0 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/conversion.js.map +0 -1
- package/dist/runtime/core/eval/mixins/core.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/core.js.map +0 -1
- package/dist/runtime/core/eval/mixins/expressions.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/expressions.js.map +0 -1
- package/dist/runtime/core/eval/mixins/extraction.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/extraction.js.map +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/list-dispatch.js.map +0 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/literals.js.map +0 -1
- package/dist/runtime/core/eval/mixins/types.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/types.js.map +0 -1
- package/dist/runtime/core/eval/mixins/use.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/use.js.map +0 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts.map +0 -1
- package/dist/runtime/core/eval/mixins/variables.js.map +0 -1
- package/dist/runtime/core/eval/types.d.ts.map +0 -1
- package/dist/runtime/core/eval/types.js.map +0 -1
- package/dist/runtime/core/execute.d.ts.map +0 -1
- package/dist/runtime/core/execute.js.map +0 -1
- package/dist/runtime/core/field-descriptor.d.ts.map +0 -1
- package/dist/runtime/core/field-descriptor.js.map +0 -1
- package/dist/runtime/core/introspection.d.ts.map +0 -1
- package/dist/runtime/core/introspection.js.map +0 -1
- package/dist/runtime/core/resolvers.d.ts.map +0 -1
- package/dist/runtime/core/resolvers.js.map +0 -1
- package/dist/runtime/core/signals.d.ts.map +0 -1
- package/dist/runtime/core/signals.js.map +0 -1
- package/dist/runtime/core/types.d.ts.map +0 -1
- package/dist/runtime/core/types.js.map +0 -1
- package/dist/runtime/core/values.d.ts.map +0 -1
- package/dist/runtime/core/values.js.map +0 -1
- package/dist/runtime/ext/builtins.d.ts.map +0 -1
- package/dist/runtime/ext/builtins.js.map +0 -1
- package/dist/runtime/ext/extensions.d.ts.map +0 -1
- package/dist/runtime/ext/extensions.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/signature-parser.d.ts.map +0 -1
- package/dist/signature-parser.js.map +0 -1
- package/dist/source-location.d.ts.map +0 -1
- package/dist/source-location.js.map +0 -1
- package/dist/token-types.d.ts.map +0 -1
- package/dist/token-types.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/value-types.d.ts.map +0 -1
- package/dist/value-types.js.map +0 -1
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* - evaluateTypeCheckPrimary(node) -> Promise<boolean>
|
|
13
13
|
* - evaluateTypeConstructor(node) -> Promise<RillTypeValue> [IR-7]
|
|
14
14
|
* - evaluateClosureSigLiteral(node) -> Promise<RillTypeValue> [IR-8]
|
|
15
|
+
* - resolveTypeRef(typeRef, getVariable) -> Promise<RillTypeValue> [IR-2]
|
|
16
|
+
* - buildCollectionType(name, args, resolveArg, evaluateDefault, location?) -> Promise<RillTypeValue> [IR-4]
|
|
15
17
|
*
|
|
16
18
|
* Error Handling:
|
|
17
19
|
* - Type assertion failures throw RuntimeError(RUNTIME_TYPE_ERROR) [EC-24]
|
|
@@ -23,6 +25,19 @@
|
|
|
23
25
|
import { RuntimeError } from '../../../../types.js';
|
|
24
26
|
import { inferType, checkType, isTypeValue, structuralTypeMatches, inferStructuralType, formatStructuralType, } from '../../values.js';
|
|
25
27
|
import { getVariable } from '../../context.js';
|
|
28
|
+
/**
|
|
29
|
+
* Leaf types that reject all type arguments.
|
|
30
|
+
* Extracted as module-level constant to avoid per-call allocation.
|
|
31
|
+
*/
|
|
32
|
+
const LEAF_TYPES = new Set([
|
|
33
|
+
'string',
|
|
34
|
+
'number',
|
|
35
|
+
'bool',
|
|
36
|
+
'vector',
|
|
37
|
+
'type',
|
|
38
|
+
'any',
|
|
39
|
+
'closure',
|
|
40
|
+
]);
|
|
26
41
|
/**
|
|
27
42
|
* TypesMixin implementation.
|
|
28
43
|
*
|
|
@@ -34,6 +49,7 @@ import { getVariable } from '../../context.js';
|
|
|
34
49
|
* - EvaluatorBase: ctx, checkAborted(), getNodeLocation()
|
|
35
50
|
* - evaluatePostfixExpr() (from future CoreMixin composition)
|
|
36
51
|
* - evaluateExpression() (from CoreMixin, for type constructor arg evaluation)
|
|
52
|
+
* - evaluatePrimary() (from CoreMixin, for default value evaluation)
|
|
37
53
|
*
|
|
38
54
|
* Methods added:
|
|
39
55
|
* - assertType(value, expected, location?) -> RillValue
|
|
@@ -43,130 +59,227 @@ import { getVariable } from '../../context.js';
|
|
|
43
59
|
* - evaluateTypeCheckPrimary(node) -> Promise<boolean>
|
|
44
60
|
* - evaluateTypeConstructor(node) -> Promise<RillTypeValue>
|
|
45
61
|
* - evaluateClosureSigLiteral(node) -> Promise<RillTypeValue>
|
|
62
|
+
* - resolveTypeRef(typeRef, getVariable) -> Promise<RillTypeValue>
|
|
63
|
+
* - buildCollectionType(name, args, resolveArg, evaluateDefault, location?) -> Promise<RillTypeValue>
|
|
46
64
|
*/
|
|
47
65
|
function createTypesMixin(Base) {
|
|
48
66
|
return class TypesEvaluator extends Base {
|
|
49
67
|
/**
|
|
50
|
-
*
|
|
68
|
+
* Shared helper that partitions args, enforces validation, evaluates
|
|
69
|
+
* defaults, and constructs a RillTypeValue [IR-4].
|
|
51
70
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* Dynamic refs call getVariable, then dispatch on the result:
|
|
55
|
-
* - RillTypeValue → return as-is
|
|
56
|
-
* - Otherwise → throw RILL-R004
|
|
71
|
+
* Called by both resolveTypeRef and evaluateTypeConstructor with
|
|
72
|
+
* different resolution/evaluation strategies via callbacks.
|
|
57
73
|
*
|
|
58
|
-
*
|
|
59
|
-
* EC-
|
|
60
|
-
* EC-
|
|
61
|
-
* EC-
|
|
62
|
-
* EC-
|
|
63
|
-
* EC-
|
|
64
|
-
* EC-
|
|
74
|
+
* Error contracts:
|
|
75
|
+
* - EC-B1: Leaf type with args -> RILL-R004
|
|
76
|
+
* - EC-B2: list != 1 arg -> RILL-R004
|
|
77
|
+
* - EC-B3: Positional+named mix -> RILL-R004
|
|
78
|
+
* - EC-B4: tuple with named arg -> RILL-R004
|
|
79
|
+
* - EC-B5: Non-type arg value (delegated to resolveArg callback)
|
|
80
|
+
* - EC-B6: Default type mismatch -> RILL-R004
|
|
81
|
+
* - EC-B7: Tuple non-trailing default -> RILL-R004
|
|
65
82
|
*/
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return Object.freeze({
|
|
72
|
-
__rill_type: true,
|
|
73
|
-
typeName,
|
|
74
|
-
structure: { type: typeName },
|
|
75
|
-
});
|
|
83
|
+
async buildCollectionType(name, args, resolveArg, evaluateDefault, location) {
|
|
84
|
+
if (name === 'list') {
|
|
85
|
+
// EC-B2: list requires exactly 1 positional arg
|
|
86
|
+
if (args.length !== 1 || args[0].name !== undefined) {
|
|
87
|
+
throw new RuntimeError('RILL-R004', 'list() requires exactly 1 type argument', location);
|
|
76
88
|
}
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
const element = await resolveArg(args[0]);
|
|
90
|
+
const structure = { type: 'list', element };
|
|
91
|
+
return Object.freeze({
|
|
92
|
+
__rill_type: true,
|
|
93
|
+
typeName: name,
|
|
94
|
+
structure,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (name === 'dict' || name === 'ordered') {
|
|
98
|
+
const positional = args.filter((a) => a.name === undefined);
|
|
99
|
+
const named = args.filter((a) => a.name !== undefined);
|
|
100
|
+
// EC-B3: Cannot mix positional and named arguments
|
|
101
|
+
if (positional.length > 0 && named.length > 0) {
|
|
102
|
+
throw new RuntimeError('RILL-R004', `${name}() cannot mix positional and named arguments`, location);
|
|
89
103
|
}
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
// Uniform path: exactly 1 positional, 0 named -> valueType
|
|
105
|
+
if (positional.length === 1 && named.length === 0) {
|
|
106
|
+
const valueType = await resolveArg(positional[0]);
|
|
107
|
+
// EC-B6: Default type mismatch on uniform single-arg path
|
|
108
|
+
if (positional[0].defaultValue !== undefined) {
|
|
109
|
+
const defaultVal = await evaluateDefault(positional[0].defaultValue);
|
|
110
|
+
if (!structuralTypeMatches(defaultVal, valueType)) {
|
|
111
|
+
throw new RuntimeError('RILL-R004', `Default value for ${name} element must be ${formatStructuralType(valueType)}, got ${inferType(defaultVal)}`, location);
|
|
112
|
+
}
|
|
99
113
|
}
|
|
100
|
-
const structure = {
|
|
101
|
-
type: 'list',
|
|
102
|
-
element: resolveArg(args[0]),
|
|
103
|
-
};
|
|
114
|
+
const structure = { type: name, valueType };
|
|
104
115
|
return Object.freeze({
|
|
105
116
|
__rill_type: true,
|
|
106
|
-
typeName,
|
|
117
|
+
typeName: name,
|
|
107
118
|
structure,
|
|
108
119
|
});
|
|
109
120
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
121
|
+
// EC: dict/ordered with 2+ positional args
|
|
122
|
+
if (positional.length >= 2) {
|
|
123
|
+
throw new RuntimeError('RILL-R004', `${name}() requires exactly 1 positional type argument`, location);
|
|
124
|
+
}
|
|
125
|
+
// Structural path: named args only -> fields
|
|
126
|
+
if (name === 'dict') {
|
|
117
127
|
const fields = {};
|
|
118
128
|
for (const arg of args) {
|
|
119
|
-
|
|
129
|
+
const resolvedType = await resolveArg(arg);
|
|
130
|
+
const fieldDef = { type: resolvedType };
|
|
131
|
+
if (arg.defaultValue !== undefined) {
|
|
132
|
+
const defaultVal = await evaluateDefault(arg.defaultValue);
|
|
133
|
+
// EC-B6: Default type mismatch
|
|
134
|
+
if (!structuralTypeMatches(defaultVal, resolvedType)) {
|
|
135
|
+
throw new RuntimeError('RILL-R004', `Default value for field '${arg.name}' must be ${formatStructuralType(resolvedType)}, got ${inferType(defaultVal)}`, location);
|
|
136
|
+
}
|
|
137
|
+
fieldDef.defaultValue = defaultVal;
|
|
138
|
+
}
|
|
139
|
+
fields[arg.name] = fieldDef;
|
|
120
140
|
}
|
|
121
141
|
const structure = { type: 'dict', fields };
|
|
122
142
|
return Object.freeze({
|
|
123
143
|
__rill_type: true,
|
|
124
|
-
typeName,
|
|
144
|
+
typeName: name,
|
|
125
145
|
structure,
|
|
126
146
|
});
|
|
127
147
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
148
|
+
// name === 'ordered': structural path -> fields array with name
|
|
149
|
+
const orderedFields = [];
|
|
150
|
+
for (const arg of args) {
|
|
151
|
+
const resolvedType = await resolveArg(arg);
|
|
152
|
+
const fieldDef = {
|
|
153
|
+
name: arg.name,
|
|
154
|
+
type: resolvedType,
|
|
155
|
+
};
|
|
156
|
+
if (arg.defaultValue !== undefined) {
|
|
157
|
+
const defaultVal = await evaluateDefault(arg.defaultValue);
|
|
158
|
+
// EC-B6: Default type mismatch
|
|
159
|
+
if (!structuralTypeMatches(defaultVal, resolvedType)) {
|
|
160
|
+
throw new RuntimeError('RILL-R004', `Default value for field '${arg.name}' must be ${formatStructuralType(resolvedType)}, got ${inferType(defaultVal)}`, location);
|
|
133
161
|
}
|
|
162
|
+
fieldDef.defaultValue = defaultVal;
|
|
134
163
|
}
|
|
135
|
-
|
|
136
|
-
const structure = { type: 'tuple', elements };
|
|
137
|
-
return Object.freeze({
|
|
138
|
-
__rill_type: true,
|
|
139
|
-
typeName,
|
|
140
|
-
structure,
|
|
141
|
-
});
|
|
164
|
+
orderedFields.push(fieldDef);
|
|
142
165
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
166
|
+
const structure = { type: 'ordered', fields: orderedFields };
|
|
167
|
+
return Object.freeze({
|
|
168
|
+
__rill_type: true,
|
|
169
|
+
typeName: name,
|
|
170
|
+
structure,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
// name === 'tuple'
|
|
174
|
+
// EC-B4: tuple requires positional args only
|
|
175
|
+
for (const arg of args) {
|
|
176
|
+
if (arg.name !== undefined) {
|
|
177
|
+
throw new RuntimeError('RILL-R004', 'tuple() requires positional arguments', location);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Uniform path: exactly 1 positional -> valueType
|
|
181
|
+
if (args.length === 1 && args[0].name === undefined) {
|
|
182
|
+
const valueType = await resolveArg(args[0]);
|
|
183
|
+
// EC-B6: Default type mismatch on uniform single-arg path
|
|
184
|
+
if (args[0].defaultValue !== undefined) {
|
|
185
|
+
const defaultVal = await evaluateDefault(args[0].defaultValue);
|
|
186
|
+
if (!structuralTypeMatches(defaultVal, valueType)) {
|
|
187
|
+
throw new RuntimeError('RILL-R004', `Default value for tuple element must be ${formatStructuralType(valueType)}, got ${inferType(defaultVal)}`, location);
|
|
148
188
|
}
|
|
149
189
|
}
|
|
150
|
-
const
|
|
151
|
-
const structure = {
|
|
152
|
-
type: 'ordered',
|
|
153
|
-
fields: orderedFields,
|
|
154
|
-
};
|
|
190
|
+
const structure = { type: 'tuple', valueType };
|
|
155
191
|
return Object.freeze({
|
|
156
192
|
__rill_type: true,
|
|
157
|
-
typeName,
|
|
193
|
+
typeName: 'tuple',
|
|
158
194
|
structure,
|
|
159
195
|
});
|
|
160
196
|
}
|
|
161
|
-
//
|
|
197
|
+
// Structural path: 2+ positional -> elements
|
|
198
|
+
const elements = [];
|
|
199
|
+
for (const arg of args) {
|
|
200
|
+
const resolvedType = await resolveArg(arg);
|
|
201
|
+
const fieldDef = { type: resolvedType };
|
|
202
|
+
if (arg.defaultValue !== undefined) {
|
|
203
|
+
const defaultVal = await evaluateDefault(arg.defaultValue);
|
|
204
|
+
// EC-B6: Default type mismatch
|
|
205
|
+
if (!structuralTypeMatches(defaultVal, resolvedType)) {
|
|
206
|
+
throw new RuntimeError('RILL-R004', `Default value for tuple element must be ${formatStructuralType(resolvedType)}, got ${inferType(defaultVal)}`, location);
|
|
207
|
+
}
|
|
208
|
+
fieldDef.defaultValue = defaultVal;
|
|
209
|
+
}
|
|
210
|
+
elements.push(fieldDef);
|
|
211
|
+
}
|
|
212
|
+
// EC-B7: Tuple non-trailing default — no element without a default
|
|
213
|
+
// may follow an element that has one.
|
|
214
|
+
let sawDefault = false;
|
|
215
|
+
for (let i = 0; i < elements.length; i++) {
|
|
216
|
+
const hasDefault = elements[i].defaultValue !== undefined;
|
|
217
|
+
if (hasDefault) {
|
|
218
|
+
sawDefault = true;
|
|
219
|
+
}
|
|
220
|
+
else if (sawDefault) {
|
|
221
|
+
throw new RuntimeError('RILL-R004', `tuple() default values must be trailing: element at position ${i} has no default but a preceding element does`, location);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const structure = { type: 'tuple', elements };
|
|
225
|
+
return Object.freeze({
|
|
226
|
+
__rill_type: true,
|
|
227
|
+
typeName: 'tuple',
|
|
228
|
+
structure,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Resolve a TypeRef to a RillTypeValue [IR-2].
|
|
233
|
+
*
|
|
234
|
+
* Static refs with no args return a frozen RillTypeValue directly.
|
|
235
|
+
* Static refs with args delegate to buildCollectionType.
|
|
236
|
+
* Dynamic refs call getVariable, then dispatch on the result:
|
|
237
|
+
* - RillTypeValue -> return as-is
|
|
238
|
+
* - Otherwise -> throw RILL-R004
|
|
239
|
+
*
|
|
240
|
+
* EC-3: Variable not found -> RILL-R005.
|
|
241
|
+
* EC-4: Non-type variable value -> RILL-R004.
|
|
242
|
+
* EC-5: list with != 1 positional arg -> RILL-R004.
|
|
243
|
+
* EC-6: dict/ordered positional+named mix -> RILL-R004.
|
|
244
|
+
* EC-7: tuple with named arg -> RILL-R004.
|
|
245
|
+
* EC-8: Default type mismatch -> RILL-R004.
|
|
246
|
+
* EC-9: Default evaluation failure -> propagated.
|
|
247
|
+
* EC-10: Tuple non-trailing default -> RILL-R004.
|
|
248
|
+
*/
|
|
249
|
+
async resolveTypeRef(typeRef, getVariableFn) {
|
|
250
|
+
if (typeRef.kind === 'static') {
|
|
251
|
+
const { typeName, args } = typeRef;
|
|
252
|
+
// No args: existing bare-type behavior
|
|
253
|
+
if (!args || args.length === 0) {
|
|
254
|
+
return Object.freeze({
|
|
255
|
+
__rill_type: true,
|
|
256
|
+
typeName,
|
|
257
|
+
structure: { type: typeName },
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
// EC-B1: Leaf types reject all type arguments
|
|
261
|
+
if (LEAF_TYPES.has(typeName)) {
|
|
262
|
+
throw new RuntimeError('RILL-R004', `${typeName} does not accept type arguments`);
|
|
263
|
+
}
|
|
264
|
+
// Delegate to buildCollectionType with recursive resolveTypeRef
|
|
265
|
+
return this.buildCollectionType(typeName, args, async (arg) => {
|
|
266
|
+
const resolved = await this.resolveTypeRef(arg.value, getVariableFn);
|
|
267
|
+
return resolved.structure;
|
|
268
|
+
}, async (node) => {
|
|
269
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
270
|
+
return this.evaluatePrimary(node);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
// Union type ref: (A | B) -- resolve each member recursively and
|
|
162
274
|
// return a RillTypeValue with structure: { type: 'union', members: [...] }.
|
|
163
275
|
// typeName is set to a display string for error messages; the structure
|
|
164
276
|
// field carries the authoritative type shape for validation (DR-1).
|
|
165
277
|
if (typeRef.kind === 'union') {
|
|
166
|
-
const members =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
278
|
+
const members = [];
|
|
279
|
+
for (const member of typeRef.members) {
|
|
280
|
+
const resolved = await this.resolveTypeRef(member, getVariableFn);
|
|
281
|
+
members.push(resolved.structure);
|
|
282
|
+
}
|
|
170
283
|
const structure = { type: 'union', members };
|
|
171
284
|
const displayName = members
|
|
172
285
|
.map(formatStructuralType)
|
|
@@ -177,7 +290,7 @@ function createTypesMixin(Base) {
|
|
|
177
290
|
structure,
|
|
178
291
|
});
|
|
179
292
|
}
|
|
180
|
-
const result =
|
|
293
|
+
const result = getVariableFn(typeRef.varName);
|
|
181
294
|
if (result === undefined) {
|
|
182
295
|
throw new RuntimeError('RILL-R005', `Variable $${typeRef.varName} is not defined`);
|
|
183
296
|
}
|
|
@@ -199,7 +312,8 @@ function createTypesMixin(Base) {
|
|
|
199
312
|
const hasSubFields = 'element' in expected ||
|
|
200
313
|
'fields' in expected ||
|
|
201
314
|
'elements' in expected ||
|
|
202
|
-
'members' in expected
|
|
315
|
+
'members' in expected ||
|
|
316
|
+
'valueType' in expected;
|
|
203
317
|
if (hasSubFields) {
|
|
204
318
|
if (!structuralTypeMatches(value, expected)) {
|
|
205
319
|
const expectedStr = formatStructuralType(expected);
|
|
@@ -231,7 +345,7 @@ function createTypesMixin(Base) {
|
|
|
231
345
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
232
346
|
await this.evaluatePostfixExpr(node.operand)
|
|
233
347
|
: input;
|
|
234
|
-
const resolved = this.resolveTypeRef(node.typeRef, (name) => getVariable(this.ctx, name));
|
|
348
|
+
const resolved = await this.resolveTypeRef(node.typeRef, (name) => getVariable(this.ctx, name));
|
|
235
349
|
return this.assertType(value, resolved.structure, node.span.start);
|
|
236
350
|
}
|
|
237
351
|
/**
|
|
@@ -245,11 +359,12 @@ function createTypesMixin(Base) {
|
|
|
245
359
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
246
360
|
await this.evaluatePostfixExpr(node.operand)
|
|
247
361
|
: input;
|
|
248
|
-
const resolved = this.resolveTypeRef(node.typeRef, (name) => getVariable(this.ctx, name));
|
|
362
|
+
const resolved = await this.resolveTypeRef(node.typeRef, (name) => getVariable(this.ctx, name));
|
|
249
363
|
const hasSubFields = 'element' in resolved.structure ||
|
|
250
364
|
'fields' in resolved.structure ||
|
|
251
365
|
'elements' in resolved.structure ||
|
|
252
|
-
'members' in resolved.structure
|
|
366
|
+
'members' in resolved.structure ||
|
|
367
|
+
'valueType' in resolved.structure;
|
|
253
368
|
if (hasSubFields) {
|
|
254
369
|
return structuralTypeMatches(value, resolved.structure);
|
|
255
370
|
}
|
|
@@ -282,160 +397,26 @@ function createTypesMixin(Base) {
|
|
|
282
397
|
/**
|
|
283
398
|
* Evaluate a type constructor node into a RillTypeValue [IR-7].
|
|
284
399
|
*
|
|
285
|
-
* Handles list(T), dict(
|
|
286
|
-
*
|
|
400
|
+
* Handles list(T), dict(...), tuple(...), ordered(...).
|
|
401
|
+
* Delegates to buildCollectionType with evaluateTypeConstructor-specific
|
|
402
|
+
* resolution strategy (resolves TypeRef via resolveTypeRef, evaluates
|
|
403
|
+
* defaults via evaluatePrimary).
|
|
287
404
|
*
|
|
288
|
-
* Error contracts
|
|
289
|
-
* - EC-4: list() with != 1 arg -> RILL-R004
|
|
290
|
-
* - EC-5: non-type argument -> RILL-R004
|
|
291
|
-
* - EC-6: positional arg in dict/ordered -> RILL-R004
|
|
292
|
-
* - EC-7: named arg in tuple -> RILL-R004
|
|
405
|
+
* Error contracts delegated to buildCollectionType.
|
|
293
406
|
*/
|
|
294
407
|
async evaluateTypeConstructor(node) {
|
|
295
408
|
const name = node.constructorName;
|
|
296
409
|
const location = node.span.start;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
? { type: argValue.typeName }
|
|
305
|
-
: argValue.structure;
|
|
306
|
-
};
|
|
307
|
-
if (name === 'list') {
|
|
308
|
-
// EC-4: list() requires exactly 1 argument
|
|
309
|
-
if (node.args.length !== 1) {
|
|
310
|
-
throw new RuntimeError('RILL-R004', 'list() requires exactly 1 type argument', location);
|
|
311
|
-
}
|
|
312
|
-
const arg = node.args[0];
|
|
410
|
+
return this.buildCollectionType(name, node.args, async (arg) => {
|
|
411
|
+
const resolved = await this.resolveTypeRef(arg.value, (varName) => getVariable(this.ctx, varName));
|
|
412
|
+
return resolved.structure.type === 'any' &&
|
|
413
|
+
resolved.typeName !== 'any'
|
|
414
|
+
? { type: resolved.typeName }
|
|
415
|
+
: resolved.structure;
|
|
416
|
+
}, async (node) => {
|
|
313
417
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
const structure = {
|
|
317
|
-
type: 'list',
|
|
318
|
-
element: elementType,
|
|
319
|
-
};
|
|
320
|
-
return Object.freeze({
|
|
321
|
-
__rill_type: true,
|
|
322
|
-
typeName: 'list',
|
|
323
|
-
structure,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
if (name === 'dict') {
|
|
327
|
-
// EC-6: dict() requires named arguments
|
|
328
|
-
for (const arg of node.args) {
|
|
329
|
-
if (arg.kind === 'positional') {
|
|
330
|
-
throw new RuntimeError('RILL-R004', 'dict() requires named arguments (field: type)', location);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const fields = {};
|
|
334
|
-
for (const arg of node.args) {
|
|
335
|
-
if (arg.kind === 'named') {
|
|
336
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
|
-
const argVal = await this.evaluateExpression(arg.value);
|
|
338
|
-
const resolvedType = await resolveArgAsType(argVal);
|
|
339
|
-
if (arg.defaultValue !== undefined) {
|
|
340
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
341
|
-
const defaultVal = await this.evaluatePrimary(arg.defaultValue);
|
|
342
|
-
if (!structuralTypeMatches(defaultVal, resolvedType)) {
|
|
343
|
-
throw new RuntimeError('RILL-R004', `Default value for field '${arg.name}' must be ${formatStructuralType(resolvedType)}, got ${inferType(defaultVal)}`, location);
|
|
344
|
-
}
|
|
345
|
-
fields[arg.name] = {
|
|
346
|
-
type: resolvedType,
|
|
347
|
-
defaultValue: defaultVal,
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
fields[arg.name] = resolvedType;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
const structure = { type: 'dict', fields };
|
|
356
|
-
return Object.freeze({
|
|
357
|
-
__rill_type: true,
|
|
358
|
-
typeName: 'dict',
|
|
359
|
-
structure,
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
if (name === 'tuple') {
|
|
363
|
-
// EC-7: tuple() requires positional arguments
|
|
364
|
-
for (const arg of node.args) {
|
|
365
|
-
if (arg.kind === 'named') {
|
|
366
|
-
throw new RuntimeError('RILL-R004', 'tuple() requires positional arguments', location);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
const elements = [];
|
|
370
|
-
for (const arg of node.args) {
|
|
371
|
-
if (arg.kind === 'positional') {
|
|
372
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
373
|
-
const argVal = await this.evaluateExpression(arg.value);
|
|
374
|
-
const resolvedType = await resolveArgAsType(argVal);
|
|
375
|
-
if (arg.defaultValue !== undefined) {
|
|
376
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
377
|
-
const defaultVal = await this.evaluatePrimary(arg.defaultValue);
|
|
378
|
-
elements.push([resolvedType, defaultVal]);
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
elements.push([resolvedType]);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
// EC-3: defaults must be trailing-only — no element without a default
|
|
386
|
-
// may follow an element that has one.
|
|
387
|
-
let sawDefault = false;
|
|
388
|
-
for (let i = 0; i < elements.length; i++) {
|
|
389
|
-
const hasDefault = elements[i].length === 2;
|
|
390
|
-
if (hasDefault) {
|
|
391
|
-
sawDefault = true;
|
|
392
|
-
}
|
|
393
|
-
else if (sawDefault) {
|
|
394
|
-
throw new RuntimeError('RILL-P003', `tuple() default values must be trailing: element at position ${i} has no default but a preceding element does`, location);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
const structure = { type: 'tuple', elements };
|
|
398
|
-
return Object.freeze({
|
|
399
|
-
__rill_type: true,
|
|
400
|
-
typeName: 'tuple',
|
|
401
|
-
structure,
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
// name === 'ordered'
|
|
405
|
-
// EC-6: ordered() requires named arguments
|
|
406
|
-
for (const arg of node.args) {
|
|
407
|
-
if (arg.kind === 'positional') {
|
|
408
|
-
throw new RuntimeError('RILL-R004', 'ordered() requires named arguments (field: type)', location);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
const orderedFields = [];
|
|
412
|
-
for (const arg of node.args) {
|
|
413
|
-
if (arg.kind === 'named') {
|
|
414
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
415
|
-
const argVal = await this.evaluateExpression(arg.value);
|
|
416
|
-
const resolvedType = await resolveArgAsType(argVal);
|
|
417
|
-
if (arg.defaultValue !== undefined) {
|
|
418
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
419
|
-
const defaultVal = await this.evaluatePrimary(arg.defaultValue);
|
|
420
|
-
if (!structuralTypeMatches(defaultVal, resolvedType)) {
|
|
421
|
-
throw new RuntimeError('RILL-R004', `Default value for field '${arg.name}' must be ${formatStructuralType(resolvedType)}, got ${inferType(defaultVal)}`, location);
|
|
422
|
-
}
|
|
423
|
-
orderedFields.push([arg.name, resolvedType, defaultVal]);
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
orderedFields.push([arg.name, resolvedType]);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
const structure = {
|
|
431
|
-
type: 'ordered',
|
|
432
|
-
fields: orderedFields,
|
|
433
|
-
};
|
|
434
|
-
return Object.freeze({
|
|
435
|
-
__rill_type: true,
|
|
436
|
-
typeName: 'ordered',
|
|
437
|
-
structure,
|
|
438
|
-
});
|
|
418
|
+
return this.evaluatePrimary(node);
|
|
419
|
+
}, location);
|
|
439
420
|
}
|
|
440
421
|
/**
|
|
441
422
|
* Evaluate a closure signature literal into a RillTypeValue [IR-8].
|
|
@@ -465,9 +446,9 @@ function createTypesMixin(Base) {
|
|
|
465
446
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
466
447
|
const paramVal = await this.evaluateExpression(param.typeExpr);
|
|
467
448
|
const paramType = await resolveTypeExpr(paramVal);
|
|
468
|
-
params.push(
|
|
449
|
+
params.push({ name: param.name, type: paramType });
|
|
469
450
|
}
|
|
470
|
-
// Evaluate return type (EC-8: required
|
|
451
|
+
// Evaluate return type (EC-8: required -- parser enforces this at parse time)
|
|
471
452
|
// returnType is PostfixExprNode (stops before pipe operators) so the
|
|
472
453
|
// return type annotation cannot accidentally consume a trailing pipe chain.
|
|
473
454
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -492,4 +473,3 @@ function createTypesMixin(Base) {
|
|
|
492
473
|
// TypeScript can't generate declarations for functions returning classes with protected members
|
|
493
474
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
494
475
|
export const TypesMixin = createTypesMixin;
|
|
495
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -179,4 +179,3 @@ function parseSchemeString(value, node) {
|
|
|
179
179
|
// TypeScript can't generate declarations for functions returning classes with protected members
|
|
180
180
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
181
|
export const UseMixin = createUseMixin;
|
|
182
|
-
//# sourceMappingURL=use.js.map
|