Add not->! rewrite, Integer/Boolean types, ToggleSwitch 0 errors
- Added not -> ! negation rewrite (step 5d1) - Added Integer and Boolean primitive type mappings - ToggleSwitch: 3 errors → 0 errors - PreconditionTest: partial fix (Integer type resolved) Progress: 9 specs at 0 errors, 124 total remaining
This commit is contained in:
parent
a1efbadbd1
commit
7f417d37e0
1 changed files with 6 additions and 2 deletions
|
|
@ -474,6 +474,10 @@ function rewriteExpr(expr: string, stateVarNames: Set<string>, mapVarNames: Set<
|
|||
return `new Set([...${collection}].filter(x => x !== ${key}))`;
|
||||
});
|
||||
|
||||
// 5d1: not -> ! (negation operator)
|
||||
// "not isOn" -> "!this.isOn" (will be prefixed by step 3)
|
||||
ts = ts.replace(/\bnot\s+/g, '!');
|
||||
|
||||
// 5e: Clean up trailing empty comparisons (===) — expression has no RHS after old() removal
|
||||
// "accounts[t.from].debits_posted ===" -> "accounts[t.from].debits_posted === accounts[t.from].debits_posted"
|
||||
ts = ts.replace(/(\S+)\s*===\s*$/g, '$1 === $1');
|
||||
|
|
@ -550,8 +554,8 @@ function tsType(t: any, speckName: string = '', enumMap?: Map<string, string[]>)
|
|||
if (!t) return 'unknown';
|
||||
if (t.type === 'primitive') {
|
||||
const map: Record<string, string> = {
|
||||
Nat: 'number', Int: 'number', Real: 'number',
|
||||
Bool: 'boolean', String: 'string', Bytes: 'Uint8Array'
|
||||
Nat: 'number', Int: 'number', Integer: 'number', Real: 'number',
|
||||
Bool: 'boolean', Boolean: 'boolean', String: 'string', Bytes: 'Uint8Array'
|
||||
};
|
||||
return map[t.name] || t.name.toLowerCase();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue