Enable source function type checks in the shared GUI runtime
Verify Tessera GUI / verify (push) Failing after 7m34s
Verify Tessera GUI / verify (push) Failing after 7m34s
This commit is contained in:
@@ -196,7 +196,7 @@ Native visual methods are now available on Block: `measure(mount, Constraints(mi
|
||||
|
||||
Outside a renderer layout call, native measurement queries find intrinsic native subtree size and clamp it to the given constraints. During layout, native base methods use the staged measured children of that occurrence. Native Row/Column arrangement uses child sizes, padding and gaps; it does not stretch children to fill the supplied bounds. Hit testing uses local coordinates against the current Mount dimensions. Coordinates/dimensions must be finite and remain within the native layout limit. Width/height and constraint ranges cannot be negative or inverted. The value constructors preserve fields as ordinary objects; methods validate their contents when used, and global annotation type checking remains pending.
|
||||
|
||||
Visual, EventTarget, Children and Presentable are explicit managed Trait definitions. Block declares Visual (measure/arrange/paint/hitTest) and EventTarget (on/dispatch/onEvent); ContainerBlock declares Children (append/remove/replace/move/children), inherited by Page. `ui.supports(value, capability)` queries an instance; `ui.implements(type, capability)` queries a type. `ui.implement(type, capability)` checks required methods and establishes an explicit relation. Matching member names alone never declare a capability. Aster checks source positional parameter counts, including self, when registering, creating subclasses or replacing methods; declaration and ancestor updates also validate existing affected descendants. Native callable signatures remain trusted host declarations; argument/return annotations, effect types and formal trait syntax are still pending.
|
||||
Visual, EventTarget, Children and Presentable are explicit managed Trait definitions. Block declares Visual (measure/arrange/paint/hitTest) and EventTarget (on/dispatch/onEvent); ContainerBlock declares Children (append/remove/replace/move/children), inherited by Page. `ui.supports(value, capability)` queries an instance; `ui.implements(type, capability)` queries a type. `ui.implement(type, capability)` checks required methods and establishes an explicit relation. Matching member names alone never declare a capability. Aster checks source positional parameter counts, including self, when registering, creating subclasses or replacing methods; declaration and ancestor updates also validate existing affected descendants. Native callable signatures remain trusted host declarations; source argument/return annotations are checked at invocation as described below. Native signature metadata, effect types and formal trait syntax remain pending.
|
||||
|
||||
A plain source object can declare Presentable by implementing `present(self, window: Window): Block` and calling `ui.implement(MyType, Presentable)`. `ui.present(value)` invokes this method with the calling window and checks the returned actual Block; `ui.open(value)` also opens the result in a Page. Block values pass through directly. The existing summary viewer remains the fallback for unregistered values, and merely viewing a function does not execute it. Presentation runs through the same bounded VM call sequence; there is no recursive host evaluator. A source adapter can keep the original object through fields/callbacks/bindings; [presentable.endor](examples/presentable.endor) shows a source-preserving view and GUI calls to the original object's method. Presentation methods are ordinary calls; visual measure/arrange/paint/hitTest still run read-only and check their nominal results at runtime. Source implementations of EventTarget.on/dispatch must provide the contract's canonical 3/2 arguments after self; native methods retain their existing optional convenience arguments.
|
||||
|
||||
@@ -372,3 +372,28 @@ explicitly validates the pinned engine itself. CI uses official Cargo sources
|
||||
and standard HTTPS checkout without custom SSH secrets. Font checks cover
|
||||
proportional/monospace advances, fractional scaling, multiline height, Chinese
|
||||
fallback, grapheme-safe truncation, antialiasing and alpha blending.
|
||||
|
||||
|
||||
### Source function types
|
||||
|
||||
Tessera enables Aster runtime checks for source parameter and return annotations.
|
||||
`Object` accepts any live value, `Unit` accepts nil, `Number`, `String`/`Text` and
|
||||
`Bool` check their value kinds. `Function` accepts source/native functions and
|
||||
bound methods; callable class definitions remain `Type`. Newly created functions
|
||||
share the actual managed Function type, so `isInstance(callback, Function)` works.
|
||||
`View` is retained as a global compatibility alias for Block.
|
||||
|
||||
Other annotation names resolve through the function's own globals and captured
|
||||
builtins on each invocation. A real Type requires nominal inheritance; a Trait
|
||||
requires an explicit implementation. A method's own declaring-class annotation
|
||||
uses its receiver's actual owning definition, allowing saved bound methods on old
|
||||
instances to survive a REPL class-name redefinition. Other global type names are
|
||||
not frozen when a function is defined. TypeMismatch reports the function,
|
||||
parameter/return and expected/actual names. Unknown annotations and argument
|
||||
mismatches reject before the body; a bad return does not roll back completed writes.
|
||||
The per-call return definition remains rooted until success/error cleanup.
|
||||
|
||||
See [function-types.endor](examples/function-types.endor) for actual Endor source.
|
||||
This adds no static inference, field-write checks, override variance, generics,
|
||||
effect typing or common native-signature metadata. Native APIs continue to validate
|
||||
their arguments and results at their own boundaries.
|
||||
|
||||
Reference in New Issue
Block a user