Identity and cause
LinkGenerated rule factory used as a value
- Family
- topaz
- Phase
- check
- Code
TPZ5500
Availability
Included by default: Pending
An admitted package lock and its actual std.lispex.rules generated binding are required.
The SELF producer and its pipeline call are source reviewed. Installed-product exposure and default-distribution availability remain Pending.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/bodies_captures.tpz at
d61f9fd0efb0· 947-1009 - compiler/crates/topaz_self_frontend/topaz/checker.tpz at
d61f9fd0efb0· 149-160 - diagnoseLispexRuleFactoryEscapes at
151141d7bb44· 947-1009 - runCheckerPhases at
151141d7bb44· 149-160 - application_modules at
151141d7bb44· 197-230 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.toml at
151141d7bb44· 1-22 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.lock at
151141d7bb44· 7-38
Cause and conditions
A generated std. factory must be the direct callee of a call.
Using the factory itself as a value produces TPZ5500 during checking.
Related rule: Generated rule factory referencesResponse
Invoke the generated factory directly with the limits required by Generated rule factories. Do not store, return, or pass the factory itself. The admitted lock determines its name and the returned handle follows the standard library contract.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/bodies_captures.tpz at
d61f9fd0efb0· 947-1009 - compiler/crates/topaz_self_frontend/topaz/checker.tpz at
d61f9fd0efb0· 149-160
Cause
LinkGenerated rule factory references
A generated std. factory must be the direct callee of a call.
Using the factory itself as a value produces TPZ5500 during checking.
The public 5.21.3 examples on this page check placement with the 5.21 factory signature. Topaz 6.0 defines its signature and preparation limits in Generated rule factories. The locked-factory example specifies the 6.0 call.
Why
A direct callee identifies the selected lock binding. Passing the factory as a value would hide that selection.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/bodies_captures.tpz at
d61f9fd0efb0· 947-1009 - compiler/crates/topaz_self_frontend/topaz/checker.tpz at
d61f9fd0efb0· 149-160 - diagnoseLispexRuleFactoryEscapes at
151141d7bb44· 947-1009 - runCheckerPhases at
151141d7bb44· 149-160 - application_modules at
151141d7bb44· 197-230 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.toml at
151141d7bb44· 1-22 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.lock at
151141d7bb44· 7-38 - topaz.decision.lispex-v2-factories.1 at
topaz.decisi
This restriction applies to generated rule factories, not to every function with no parameters. It is checked before execution and does not by itself report a failure while evaluating a Lispex rule.
Response
LinkInvoke the generated factory directly with the limits required by Generated rule factories. Do not store, return, or pass the factory itself. The admitted lock determines its name and the returned handle follows the standard library contract.
Generated factory examples
LinkCall the generated factory directly
Linkimport std.lispex.rules { approve }let rule = approve()
Expected result
Expected result
Checking accepts the program. Exit code 0.
This public 5.21.3 example checks factory placement with the maintained 5.21 application package and its committed lock. Replace src/main.tpz without changing that package.
Source evidence
- diagnoseLispexRuleFactoryEscapes at
151141d7bb44· 947-1009 - runCheckerPhases at
151141d7bb44· 149-160 - application_modules at
151141d7bb44· 197-230 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.toml at
151141d7bb44· 1-22 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.lock at
151141d7bb44· 7-38
Reject a generated factory used as a value
Linkimport std.lispex.rules { approve }let factory = approve
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5500generated-rule-factory-value-escape atsrc/main.tpz:2:15
This public 5.21.3 example checks factory placement with the maintained 5.21 application package and its committed lock. Replace src/main.tpz without changing that package.
Source evidence
- diagnoseLispexRuleFactoryEscapes at
151141d7bb44· 947-1009 - runCheckerPhases at
151141d7bb44· 149-160 - application_modules at
151141d7bb44· 197-230 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.toml at
151141d7bb44· 1-22 - compiler/corpus/lispex-decision-application/bounded-application-v1/topaz.lock at
151141d7bb44· 7-38