Skip to content

RuleScript v1.9.0

Choose a tag to compare

@github-actions github-actions released this 06 Jul 02:32
· 13 commits to main since this release
9e6c874

RuleScript v1.9.0

RuleScript v1.9.0 adds strongly typed user functions while keeping existing scripts compatible. The release focuses on function signatures, overload analysis, runtime overload dispatch, and diagnostics.

Explicit Return Types

Functions may now declare a return type:

function Add(a: number, b: number) -> number:
    return a + b;
endfunction

The existing syntax remains valid:

function Add(a, b):
    return a + b;
endfunction

Supported function types are any, null, number, string, bool, boolean, array, object, and void.

void means the function must not return a value. return; is valid, but return 123; is reported as an analysis error.

Return Type Diagnostics

Declared return types are validated during analysis. A function declared as -> number must return number values from every return statement.

When a declared non-void function does not return on every path, analysis reports:

Not all code paths return a value.

Old-style functions remain valid. When an old-style function returns a value, analysis emits a compatibility warning recommending an explicit return type.

Function Overloads

User functions may share a name when their parameter signatures differ:

function Format(value: number) -> string:
    return ToString(value);
endfunction

function Format(value: string) -> string:
    return value;
endfunction

Duplicate signatures are rejected:

Duplicate function signature 'Add(number, number)'.

All overloads with the same name must use the same declared return type:

Function overloads for 'Convert' must use the same return type.

Overload Resolution

Analysis and runtime overload resolution use:

  • function name
  • argument count
  • argument type compatibility
  • exact matches before any

Return type does not participate in overload resolution. If no candidate matches, analysis/runtime reports no matching overload. If multiple candidates tie, analysis/runtime reports an ambiguous overload.

Host, User, And Built-In Functions

User, host, and built-in functions now participate in the same overload set. A script can define a user function with the same name as a host or built-in function when the signatures differ.

Runtime dispatch selects the best matching overload from the available user, host, and built-in candidates without implicit type conversion.

Compatibility And Scope

  • Existing function syntax remains supported.
  • Existing scripts continue to run.
  • Parser, binder, runtime, and symbol architecture remain incremental extensions of the v1.8 model.
  • No generics, nullable type syntax, delegates, lambdas, interfaces, or new executable syntax were added.
  • Runtime does not perform automatic type conversion for overload selection.

Validation

The v1.9.0 work is covered by tests for:

  • parser support for -> returnType
  • old syntax compatibility
  • declared return type metadata
  • return type mismatch diagnostics
  • missing return warnings
  • old syntax return warnings
  • duplicate function signatures
  • unified overload return type rules
  • no matching overload diagnostics
  • ambiguous overload diagnostics
  • runtime overload dispatch
  • user/host/built-in overload coexistence
  • v1.8 regression coverage