diff --git a/.github/workflows/ci-all.yml b/.github/workflows/ci-all.yml index 69759bd8..e072e1fc 100644 --- a/.github/workflows/ci-all.yml +++ b/.github/workflows/ci-all.yml @@ -12,6 +12,18 @@ jobs: working-directory: packages/algo-ts upload-artifact-name: algo-ts upload-artifact-path: ./packages/algo-ts/dist + post-build-script: | + cd dist + set +e # Continue on error + thisVersion=$(npm view ./ version) + diffText=$(npm diff --diff=./ --diff=@algorandfoundation/algorand-typescript@$thisVersion) + diffExitCode=$? + set -e # Exit on error + [ $diffExitCode -ne 0 ] && (echo "$thisVersion has not been published yet"; exit 0;) || echo "$thisVersion already published, checking diff against local build" + diffTextLen=${#diffText} + [ $diffTextLen -eq 0 ] && echo 'No changes' || (echo 'ERROR: Code differs to published version. Please bump package version or revert changes'; echo $diffText; exit 1;) + + ci-puya-ts: name: 'Build @algorandfoundation/puya-ts' uses: ./.github/workflows/node-ci.yml @@ -30,4 +42,6 @@ jobs: upload-artifact-path: ./dist python-version: 3.12.6 pre-test-script: | - pipx install puyapy --python 3.12.6 + pipx install algokit --python 3.12.6 + algokit localnet start + pipx install git+https://github.com/algorandfoundation/puya --python 3.12.6 diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index 39fbd489..f569f3d8 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -47,6 +47,9 @@ on: required: false type: string default: npm run build + post-build-script: + required: false + type: string run-build: required: false type: boolean @@ -178,6 +181,10 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.npm-auth-token || secrets.GITHUB_TOKEN }} + - name: Post build + if: ${{ inputs.post-build-script }} + run: ${{ inputs.post-build-script }} + - name: Publish artifact if: ${{ inputs.upload-artifact-name }} uses: actions/upload-artifact@v4 diff --git a/.gitignore b/.gitignore index b80e0e18..b81bcbf3 100644 --- a/.gitignore +++ b/.gitignore @@ -54,9 +54,7 @@ test-results.xml # Website & Code docs generation code-docs/ -out/ debug-out/ -!tests/approvals/out # dotenv environment variable files .env @@ -64,3 +62,6 @@ debug-out/ .env.test.local .env.production.local .env.local + + +tests/expected-output/out diff --git a/commitlint.config.cjs b/commitlint.config.cjs index 9472837a..fa82b653 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -1,15 +1,14 @@ module.exports = { extends: ['@commitlint/config-conventional'], rules: { - // Allow sentence case commit messages - 'subject-case': [1, 'always', ['pascal-case', 'upper-case']], - 'type-empty': [1, 'never'], - 'subject-empty': [1, 'always'], + 'subject-case': [0, 'always', ['pascal-case', 'upper-case']], + 'type-empty': [2, 'never'], + 'subject-empty': [0, 'always'], 'body-leading-blank': [0, 'always'], - 'body-max-line-length': [1, 'always', 200], - 'header-max-length': [1, 'always', 150], - 'footer-max-length': [1, 'always', 150], - 'footer-max-line-length': [1, 'always', 150], + 'body-max-line-length': [0, 'always', 200], + 'header-max-length': [0, 'always', 150], + 'footer-max-length': [0, 'always', 150], + 'footer-max-line-length': [0, 'always', 150], }, } diff --git a/examples/calculator/contract.algo.ts b/examples/calculator/contract.algo.ts index 31807895..c0411632 100644 --- a/examples/calculator/contract.algo.ts +++ b/examples/calculator/contract.algo.ts @@ -1,5 +1,5 @@ import type { uint64 } from '@algorandfoundation/algorand-typescript' -import { assert, Bytes, Contract, err, log, op, Txn, Uint64 } from '@algorandfoundation/algorand-typescript' +import { assert, BaseContract, Bytes, err, log, op, Txn, Uint64 } from '@algorandfoundation/algorand-typescript' const ADD = Uint64(1) const SUB = Uint64(2) @@ -13,7 +13,7 @@ function itoa(i: uint64): string { } return itoa(i / radix).concat(digits.at(i % radix).toString()) } -export default class MyContract extends Contract { +export default class MyContract extends BaseContract { public approvalProgram(): boolean { const numArgs = Txn.numAppArgs let a: uint64, b: uint64, action: uint64 diff --git a/examples/voting/contract.algo.ts b/examples/voting/contract.algo.ts index 53a43e30..eb0b9bbb 100644 --- a/examples/voting/contract.algo.ts +++ b/examples/voting/contract.algo.ts @@ -33,7 +33,6 @@ const BOX_BYTE_MIN_BALANCE: uint64 = 400 // The min balance increase for each asset opted into const ASSET_MIN_BALANCE: uint64 = 100000 -// TODO: ObjectPType should hopefully respect this ordering of properties type VotingPreconditions = { is_voting_open: uint64 is_allowed_to_vote: uint64 diff --git a/package-lock.json b/package-lock.json index 5043db5a..a9290756 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "zod": "^3.23.8" }, "devDependencies": { + "@algorandfoundation/algokit-utils": "^7.0.0-beta.7", "@algorandfoundation/algorand-typescript": "file:packages/algo-ts/dist", "@commitlint/cli": "^19.5.0", "@commitlint/config-conventional": "^19.5.0", @@ -73,6 +74,22 @@ "tslib": "^2.6.2" } }, + "node_modules/@algorandfoundation/algokit-utils": { + "version": "7.0.0-beta.7", + "resolved": "https://registry.npmjs.org/@algorandfoundation/algokit-utils/-/algokit-utils-7.0.0-beta.7.tgz", + "integrity": "sha512-xueS9bYnboF3x4Zp/7mCgkLZQR91b5NOuM6aZawv5ySZ+GrRqqZnThJYcGVSNG5GSlGp1ypkEi3oXeApmwdGCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^6.0.3" + }, + "engines": { + "node": ">=18.0" + }, + "peerDependencies": { + "algosdk": "^2.7.0" + } + }, "node_modules/@algorandfoundation/algorand-typescript": { "resolved": "packages/algo-ts/dist", "link": true @@ -2897,6 +2914,39 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/algo-msgpack-with-bigint": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/algo-msgpack-with-bigint/-/algo-msgpack-with-bigint-2.1.1.tgz", + "integrity": "sha512-F1tGh056XczEaEAqu7s+hlZUDWwOBT70Eq0lfMpBP2YguSQVyxRbprLq5rELXKQOyOaixTWYhMeMQMzP0U5FoQ==", + "dev": true, + "license": "ISC", + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/algosdk": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/algosdk/-/algosdk-2.9.0.tgz", + "integrity": "sha512-o0n0nLMbTX6SFQdMUk2/2sy50jmEmZk5OTPYSh2aAeP8DUPxrhjMPfwGsYNvaO+qk75MixC2eWpfA9vygCQ/Mg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "algo-msgpack-with-bigint": "^2.1.1", + "buffer": "^6.0.3", + "hi-base32": "^0.5.1", + "js-sha256": "^0.9.0", + "js-sha3": "^0.8.0", + "js-sha512": "^0.8.0", + "json-bigint": "^1.0.0", + "tweetnacl": "^1.0.3", + "vlq": "^2.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/ansi-escapes": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.0.0.tgz", @@ -3047,6 +3097,27 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/before-after-hook": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz", @@ -3084,6 +3155,17 @@ "node": ">= 12" } }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": "*" + } + }, "node_modules/bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", @@ -3115,6 +3197,31 @@ "node": ">=8" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -5354,6 +5461,14 @@ "node": ">= 0.4" } }, + "node_modules/hi-base32": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz", + "integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/highlight.js": { "version": "10.7.3", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", @@ -5429,6 +5544,27 @@ "node": ">=18.18.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -6066,6 +6202,30 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-sha256": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/js-sha512": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", + "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -6086,6 +6246,17 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", @@ -11807,6 +11978,14 @@ "fsevents": "~2.3.3" } }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "dev": true, + "license": "Unlicense", + "peer": true + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -12652,6 +12831,14 @@ } } }, + "node_modules/vlq": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-2.0.4.tgz", + "integrity": "sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -12965,7 +13152,7 @@ }, "packages/algo-ts/dist": { "name": "@algorandfoundation/algorand-typescript", - "version": "0.0.1-alpha.13", + "version": "0.0.1-alpha.14", "dev": true, "peerDependencies": { "tslib": "^2.6.2" diff --git a/package.json b/package.json index 42fa8fa3..33ee2a2c 100644 --- a/package.json +++ b/package.json @@ -7,14 +7,9 @@ "scripts": { "postinstall": "npx patch-package", "dev:examples": "tsx src/cli.ts build examples --output-awst --output-awst-json", - "dev:auction": "tsx src/cli.ts build examples/auction --dry-run", - "dev:voting": "tsx src/cli.ts build examples/voting/contract.algo.ts --output-awst --output-awst-json", - "dev:hello": "tsx src/cli.ts build examples/hello-world/contract.algo.ts --output-awst --output-awst-json", - "dev:hello-abi": "tsx src/cli.ts build examples/hello-world-abi ", - "dev:calculator": "tsx src/cli.ts build examples/calculator/contract.algo.ts", - "dev:approvals": "tsx src/cli.ts build tests/approvals --output-awst --output-awst-json --no-output-teal --no-output-arc32", + "dev:approvals": "rimraf tests/approvals/out && tsx src/cli.ts build tests/approvals --output-awst --output-awst-json --no-output-teal --output-ssa-ir --out-dir out/[name]", "dev:expected-output": "tsx src/cli.ts build tests/expected-output --dry-run", - "dev:testing": "tsx src/cli.ts build tests/approvals/byte-expressions.algo.ts --output-awst --output-awst-json --log-level=info", + "dev:testing": "tsx src/cli.ts build tests/approvals/arc4-types.algo.ts --output-awst --output-awst-json --output-ssa-ir --log-level=info --log-level debug --out-dir out/[name]", "audit": "better-npm-audit audit", "format": "prettier --write .", "lint": "eslint \"src/**/*.ts\"", @@ -45,6 +40,7 @@ "author": "Algorand foundation", "license": "MIT", "devDependencies": { + "@algorandfoundation/algokit-utils": "^7.0.0-beta.7", "@algorandfoundation/algorand-typescript": "file:packages/algo-ts/dist", "@commitlint/cli": "^19.5.0", "@commitlint/config-conventional": "^19.5.0", diff --git a/packages/algo-ts/package.json b/packages/algo-ts/package.json index fb9aa7d6..39fa8d6f 100644 --- a/packages/algo-ts/package.json +++ b/packages/algo-ts/package.json @@ -1,6 +1,6 @@ { "name": "@algorandfoundation/algorand-typescript", - "version": "0.0.1-alpha.13", + "version": "0.0.1-alpha.14", "description": "This package contains definitions for the types which comprise Algorand TypeScript which can be compiled to run on the Algorand Virtual Machine using the Puya compiler.", "private": false, "main": "index.js", @@ -16,7 +16,7 @@ "build:2-check-types": "tsc -p tsconfig.json", "build:3-build": "rollup -c --configPlugin typescript", "build:4-copy-pkg-json": "tstk copy-package-json -c", - "build:5-copy-readme": "copyfiles ./README.md ./dist", + "build:5-copy-readme": "copyfiles ./readme.md ./dist", "watch": "rollup -c -w --configPlugin typescript", "test": "vitest run" }, diff --git a/packages/algo-ts/src/arc4/encoded-types.ts b/packages/algo-ts/src/arc4/encoded-types.ts index 75356d35..eba974bd 100644 --- a/packages/algo-ts/src/arc4/encoded-types.ts +++ b/packages/algo-ts/src/arc4/encoded-types.ts @@ -1,7 +1,8 @@ -import { biguint, BigUintCompat, Bytes, bytes, BytesBacked, StringCompat, uint64, Uint64Compat } from '../primitives' -import { err } from '../util' +import { avmError, avmInvariant } from '../impl/errors' +import { arrayUtil, BytesCls, getNumber, getUint8Array, isBytes, isUint64 } from '../impl/primitives' +import { biguint, BigUintCompat, Bytes, bytes, BytesBacked, StringCompat, Uint64, uint64, Uint64Compat } from '../primitives' import { Account } from '../reference' -import { arrayUtil } from '../impl/primitives' +import { err } from '../util' export type BitSize = 8 | 16 | 32 | 64 | 128 | 256 | 512 type NativeForArc4Int = N extends 8 | 16 | 32 | 64 ? uint64 : biguint @@ -11,6 +12,10 @@ abstract class AbiEncoded implements BytesBacked { get bytes(): bytes { throw new Error('todo') } + + equals(other: this): boolean { + return this.bytes.equals(other.bytes) + } } export class Str extends AbiEncoded { @@ -38,17 +43,14 @@ export class UFixedNxM { } export class Byte extends UintN<8> { - constructor(v: Uint64Compat) { + constructor(v?: Uint64Compat) { super(v) } - get native(): uint64 { - throw new Error('TODO') - } } export class Bool { #v: boolean - constructor(v: boolean) { - this.#v = v + constructor(v?: boolean) { + this.#v = v ?? false } get native(): boolean { @@ -56,31 +58,104 @@ export class Bool { } } -abstract class Arc4Array extends AbiEncoded { - protected constructor(protected items: TItem[]) { +abstract class Arc4ReadonlyArray extends AbiEncoded { + protected items: TItem[] + protected constructor(items: TItem[]) { super() - } + this.items = items.slice() + return new Proxy(this, { + get(target, prop) { + if (isUint64(prop)) { + const idx = getNumber(prop) + if (idx < target.items.length) return target.items[idx] + avmError('Index out of bounds') + } + return Reflect.get(target, prop) + }, + set(target, prop, value) { + if (isUint64(prop)) { + const idx = getNumber(prop) + if (idx < target.items.length) { + target.items[idx] = value + return true + } + avmError('Index out of bounds') + } + avmError('Property is not writable') + }, + }) + } + + /** + * Returns the current length of this array + */ get length(): uint64 { - throw new Error('TODO') + return Uint64(this.items.length) } + + /** + * Returns the item at the given index. + * Negative indexes are taken from the end. + * @param index The index of the item to retrieve + */ at(index: Uint64Compat): TItem { return arrayUtil.arrayAt(this.items, index) } - slice(start: Uint64Compat, end: Uint64Compat): DynamicArray { + + /** @internal + * Create a new Dynamic array with all items from this array + */ + slice(): DynamicArray + /** @internal + * Create a new DynamicArray with all items up till `end`. + * Negative indexes are taken from the end. + * @param end An index in which to stop copying items. + */ + slice(end: Uint64Compat): DynamicArray + /** @internal + * Create a new DynamicArray with items from `start`, up until `end` + * Negative indexes are taken from the end. + * @param start An index in which to start copying items. + * @param end An index in which to stop copying items + */ + slice(start: Uint64Compat, end: Uint64Compat): DynamicArray + slice(start?: Uint64Compat, end?: Uint64Compat): DynamicArray { return new DynamicArray(...arrayUtil.arraySlice(this.items, start, end)) } + + /** + * Returns an iterator for the items in this array + */ [Symbol.iterator](): IterableIterator { return this.items[Symbol.iterator]() } - entries(): IterableIterator { - throw new Error('TODO') + + /** + * Returns an iterator for a tuple of the indexes and items in this array + */ + *entries(): IterableIterator { + for (const [idx, item] of this.items.entries()) { + yield [Uint64(idx), item] + } } - keys(): IterableIterator { - throw new Error('TODO') + + /** + * Returns an iterator for the indexes in this array + */ + *keys(): IterableIterator { + for (const idx of this.items.keys()) { + yield Uint64(idx) + } } + + /** + * Get or set the item at the specified index. + * Negative indexes are not supported + */ + [index: uint64]: TItem } -export class StaticArray extends Arc4Array { +export class StaticArray extends Arc4ReadonlyArray { constructor() constructor(...items: TItem[] & { length: TLength }) constructor(...items: TItem[]) @@ -93,13 +168,26 @@ export class StaticArray extends Arc4Array } } -export class DynamicArray extends Arc4Array { +export class DynamicArray extends Arc4ReadonlyArray { constructor(...items: TItem[]) { super(items) } - push(...items: TItem[]): void {} + + /** + * Push a number of items into this array + * @param items The items to be added to this array + */ + push(...items: TItem[]): void { + this.items.push(...items) + } + + /** + * Pop a single item from this array + */ pop(): TItem { - throw new Error('Not implemented') + const item = this.items.pop() + if (item === undefined) avmError('The array is empty') + return item } copy(): DynamicArray { @@ -124,12 +212,24 @@ export class Tuple { } } -export class Address extends StaticArray { - constructor(value: Account | string | bytes) { - super() +export class Address extends Arc4ReadonlyArray { + constructor(value?: Account | string | bytes) { + let byteValues: Uint8Array + if (value === undefined) { + byteValues = new Uint8Array(32) + } else if (typeof value === 'string') { + // Interpret as base 32 + byteValues = BytesCls.fromBase32(value).asUint8Array() + } else if (isBytes(value)) { + byteValues = getUint8Array(value) + } else { + byteValues = getUint8Array(value.bytes) + } + avmInvariant(byteValues.length === 32, 'Addresses should be 32 bytes') + super(Array.from(byteValues).map((b) => new Byte(b))) } get native(): Account { - throw new Error('TODO') + return Account(Bytes(this.items.map((i) => i.native))) } } diff --git a/packages/algo-ts/src/impl/primitives.ts b/packages/algo-ts/src/impl/primitives.ts index 5d37e95f..687b9ba6 100644 --- a/packages/algo-ts/src/impl/primitives.ts +++ b/packages/algo-ts/src/impl/primitives.ts @@ -64,6 +64,10 @@ export const getNumber = (v: StubUint64Compat): number => { internalError(`Cannot convert ${v} to number`) } +export const getUint8Array = (v: StubBytesCompat): Uint8Array => { + return BytesCls.fromCompat(v).asUint8Array() +} + export const isBytes = (v: unknown): v is StubBytesCompat => { if (typeof v === 'string') return true if (v instanceof BytesCls) return true @@ -71,7 +75,6 @@ export const isBytes = (v: unknown): v is StubBytesCompat => { } export const isUint64 = (v: unknown): v is StubUint64Compat => { - if (typeof v == 'boolean') return true if (typeof v == 'number') return true if (typeof v == 'bigint') return true return v instanceof Uint64Cls diff --git a/packages/algo-ts/src/reference.ts b/packages/algo-ts/src/reference.ts index b5a3ab57..0c430c17 100644 --- a/packages/algo-ts/src/reference.ts +++ b/packages/algo-ts/src/reference.ts @@ -123,7 +123,7 @@ export type Asset = { readonly total: uint64 /** - * @see AssetParams.Decimals + * @see AssetParams.decimals */ readonly decimals: uint64 diff --git a/packages/algo-ts/tsconfig.build.json b/packages/algo-ts/tsconfig.build.json index 46ef1c76..9d7effcc 100644 --- a/packages/algo-ts/tsconfig.build.json +++ b/packages/algo-ts/tsconfig.build.json @@ -3,7 +3,8 @@ "compilerOptions": { "outDir": "./dist/", "noEmit": false, - "declaration": true + "declaration": true, + "stripInternal": true }, "include": ["src/**/*.ts"], "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/tests/**"] diff --git a/src/awst/index.ts b/src/awst/index.ts index 528e4fdc..64eb2957 100644 --- a/src/awst/index.ts +++ b/src/awst/index.ts @@ -1,5 +1,3 @@ export * as awst from './nodes' - -export * as wtypes from './wtypes' export * from './util' export type ConstantValue = bigint | Uint8Array | boolean | string diff --git a/src/awst/intrinsic-factory.ts b/src/awst/intrinsic-factory.ts index b46fac79..7eb6bc80 100644 --- a/src/awst/intrinsic-factory.ts +++ b/src/awst/intrinsic-factory.ts @@ -1,11 +1,11 @@ import type { DeliberateAny } from '../typescript-helpers' import { bigIntToUint8Array } from '../util' import { nodeFactory } from './node-factory' -import * as awst from './nodes' import type { Expression } from './nodes' +import * as awst from './nodes' import { BytesEncoding } from './nodes' import type { SourceLocation } from './source-location' -import * as wtypes from './wtypes' +import { wtypes } from './wtypes' export const intrinsicFactory = { bytesConcat({ diff --git a/src/awst/json-serialize-awst.ts b/src/awst/json-serialize-awst.ts index 5ba9e39b..9978af51 100644 --- a/src/awst/json-serialize-awst.ts +++ b/src/awst/json-serialize-awst.ts @@ -1,11 +1,13 @@ import { snakeCase } from 'change-case' import path from 'node:path' import { Constants } from '../constants' +import { InternalError } from '../errors' import { logger } from '../logger' import { invariant } from '../util' import { buildBase85Encoder } from '../util/base-85' import { ARC4ABIMethodConfig, ContractReference, LogicSigReference } from './models' import type { RootNode } from './nodes' +import { IntrinsicCall } from './nodes' import { SourceLocation } from './source-location' export class SnakeCaseSerializer { @@ -59,7 +61,27 @@ export class AwstSerializer extends SnakeCaseSerializer { if (value instanceof ContractReference || value instanceof LogicSigReference) { return value.toString() } - if (value instanceof SourceLocation) { + if (value instanceof IntrinsicCall) { + // Convert bigint immediates to number so they serialize without quotes and can be disambiguated from string immediates + return { + _type: IntrinsicCall.name, + ...(super.serializerFunction(key, value) as object), + immediates: value.immediates.map((i) => { + if (typeof i === 'bigint') { + if (i <= Number.MAX_SAFE_INTEGER) { + return Number(i) + } else { + throw new InternalError( + 'Intrinsic call with integer immediate arg cannot be serialized as it is larger than Number.MAX_SAFE_INTEGER', + { sourceLocation: value.sourceLocation }, + ) + } + } + return i + }), + } + } + if (value instanceof SourceLocation && value.file) { let filePath: string = value.file if (this.options?.sourcePaths === 'absolute') { invariant(this.options.programDirectory, 'Program directory must be supplied for absolute paths') @@ -71,6 +93,7 @@ export class AwstSerializer extends SnakeCaseSerializer { } return { ...(super.serializerFunction(key, value) as object), + scope: undefined, file: filePath, } } diff --git a/src/awst/models.ts b/src/awst/models.ts index af841c7a..01d860e2 100644 --- a/src/awst/models.ts +++ b/src/awst/models.ts @@ -30,7 +30,7 @@ export class ARC4BareMethodConfig extends ModelBase { readonly sourceLocation: SourceLocation | undefined readonly allowedCompletionTypes: OnCompletionAction[] readonly create: ARC4CreateOption - readonly isBare = true as const + readonly isBare = true constructor(props: Omit, 'isBare'>) { super() this.sourceLocation = props.sourceLocation @@ -60,7 +60,7 @@ export type DefaultArgumentSource = export class ARC4ABIMethodConfig extends ModelBase { readonly sourceLocation: SourceLocation | undefined readonly name: string - readonly isBare = false as const + readonly isBare = false readonly create: ARC4CreateOption readonly readonly: boolean readonly allowedCompletionTypes: OnCompletionAction[] @@ -124,7 +124,6 @@ export class LogicSigReference extends ModelBase { return this.id } } -export type CompilationSet = Array export enum TransactionKind { pay = 1, diff --git a/src/awst/node-factory.ts b/src/awst/node-factory.ts index 8a365fae..1711ea48 100644 --- a/src/awst/node-factory.ts +++ b/src/awst/node-factory.ts @@ -30,9 +30,7 @@ import { VoidConstant, } from './nodes' import type { SourceLocation } from './source-location' -import type { WType } from './wtypes' -import * as wtypes from './wtypes' -import { boolWType, voidWType, WTuple } from './wtypes' +import { wtypes } from './wtypes' type ConcreteNodes = typeof concreteNodes @@ -41,10 +39,15 @@ const explicitNodeFactory = { voidConstant(props: { sourceLocation: SourceLocation }): VoidConstant { return new VoidConstant({ ...props, - wtype: voidWType, + wtype: wtypes.voidWType, }) }, - bytesConstant(props: { value: Uint8Array; encoding?: BytesEncoding; sourceLocation: SourceLocation; wtype?: WType }): BytesConstant { + bytesConstant(props: { + value: Uint8Array + encoding?: BytesEncoding + sourceLocation: SourceLocation + wtype?: wtypes.WType + }): BytesConstant { return new BytesConstant({ encoding: BytesEncoding.unknown, wtype: wtypes.bytesWType, @@ -90,7 +93,7 @@ const explicitNodeFactory = { not(props: { expr: Expression; sourceLocation: SourceLocation }): Not { return new Not({ ...props, - wtype: boolWType, + wtype: wtypes.boolWType, }) }, uInt64BinaryOperation(props: Omit, 'wtype'>): UInt64BinaryOperation { @@ -108,7 +111,7 @@ const explicitNodeFactory = { numericComparisonExpression(props: Omit, 'wtype'>): NumericComparisonExpression { return new NumericComparisonExpression({ ...props, - wtype: boolWType, + wtype: wtypes.boolWType, }) }, bytesComparisonExpression(props: Omit, 'wtype'>): BytesComparisonExpression { @@ -119,7 +122,7 @@ const explicitNodeFactory = { ) return new BytesComparisonExpression({ ...props, - wtype: boolWType, + wtype: wtypes.boolWType, }) }, boolConstant(props: { value: boolean; sourceLocation: SourceLocation }): BoolConstant { @@ -162,7 +165,7 @@ const explicitNodeFactory = { booleanBinaryOperation(props: Omit, 'wtype'>) { return new BooleanBinaryOperation({ ...props, - wtype: boolWType, + wtype: wtypes.boolWType, }) }, assignmentExpression({ @@ -198,10 +201,10 @@ const explicitNodeFactory = { sourceLocation, }) }, - tupleExpression(props: Omit, 'wtype'>) { + tupleExpression(props: Omit, 'wtype'> & { wtype?: wtypes.WTuple }) { return new TupleExpression({ ...props, - wtype: new WTuple({ types: props.items.map((i) => i.wtype), immutable: true }), + wtype: props.wtype ?? new wtypes.WTuple({ types: props.items.map((i) => i.wtype), immutable: true }), }) }, methodDocumentation(props?: { description?: string | null; args?: Map; returns?: string | null }) { @@ -225,8 +228,8 @@ const explicitNodeFactory = { }) }, checkedMaybe({ expr, comment }: { expr: Expression; comment: string }) { - invariant(expr.wtype instanceof WTuple && expr.wtype.types.length === 2, 'expr WType must be WTuple of 2') - invariant(expr.wtype.types[1].equals(boolWType), '2nd tuple item type must be bool') + invariant(expr.wtype instanceof wtypes.WTuple && expr.wtype.types.length === 2, 'expr WType must be WTuple of 2') + invariant(expr.wtype.types[1].equals(wtypes.boolWType), '2nd tuple item type must be bool') return new CheckedMaybe({ expr, comment, @@ -236,7 +239,7 @@ const explicitNodeFactory = { }, tupleItemExpression(props: Omit, 'wtype'>) { invariant( - props.base.wtype instanceof WTuple && props.base.wtype.types.length > Number(props.index), + props.base.wtype instanceof wtypes.WTuple && props.base.wtype.types.length > Number(props.index), 'expr.base must be WTuple with length greater than index', ) return new TupleItemExpression({ @@ -244,7 +247,7 @@ const explicitNodeFactory = { wtype: props.base.wtype.types[Number(props.index)], }) }, - reinterpretCast({ expr, wtype, sourceLocation }: { expr: Expression; wtype: WType; sourceLocation: SourceLocation }) { + reinterpretCast({ expr, wtype, sourceLocation }: { expr: Expression; wtype: wtypes.WType; sourceLocation: SourceLocation }) { if (expr instanceof BytesConstant) { return new BytesConstant({ ...expr, diff --git a/src/awst/nodes.ts b/src/awst/nodes.ts index fc4b2f06..c26d8f3d 100644 --- a/src/awst/nodes.ts +++ b/src/awst/nodes.ts @@ -4,7 +4,7 @@ import type { Props } from '../typescript-helpers' import type { ARC4ABIMethodConfig, ARC4BareMethodConfig, ContractReference, LogicSigReference } from './models' import type { SourceLocation } from './source-location' import type { TxnField } from './txn-fields' -import type * as wtypes from './wtypes' +import type { wtypes } from './wtypes' export class SubroutineID { constructor(props: Props) { @@ -1150,14 +1150,10 @@ export class ContractMethod extends classes(_Function, ContractMemberNode) { this.cref = props.cref this.memberName = props.memberName this.arc4MethodConfig = props.arc4MethodConfig - this.synthetic = props.synthetic - this.inheritable = props.inheritable } cref: ContractReference memberName: string arc4MethodConfig: ARC4BareMethodConfig | ARC4ABIMethodConfig | null - synthetic: boolean - inheritable: boolean accept(visitor: ContractMemberNodeVisitor): T { return visitor.visitContractMethod(this) } @@ -1254,39 +1250,37 @@ export class ARC4Router extends Expression { return visitor.visitARC4Router(this) } } -export class ContractFragment extends RootNode { - constructor(props: Props) { +export class Contract extends RootNode { + constructor(props: Props) { super(props) this.id = props.id this.name = props.name - this.bases = props.bases - this.init = props.init + this.description = props.description + this.methodResolutionOrder = props.methodResolutionOrder this.approvalProgram = props.approvalProgram this.clearProgram = props.clearProgram - this.subroutines = props.subroutines + this.methods = props.methods this.appState = props.appState - this.reservedScratchSpace = props.reservedScratchSpace this.stateTotals = props.stateTotals - this.docstring = props.docstring + this.reservedScratchSpace = props.reservedScratchSpace } id: ContractReference name: string - bases: Array - init: ContractMethod | null - approvalProgram: ContractMethod | null - clearProgram: ContractMethod | null - subroutines: Array - appState: Map - reservedScratchSpace: Set + description: string | null + methodResolutionOrder: Array + approvalProgram: ContractMethod + clearProgram: ContractMethod + methods: Array + appState: Array stateTotals: StateTotals | null - docstring: string | null + reservedScratchSpace: Set accept(visitor: RootNodeVisitor): T { - return visitor.visitContractFragment(this) + return visitor.visitContract(this) } } export type LValue = VarExpression | FieldExpression | IndexExpression | TupleExpression | AppStateExpression | AppAccountStateExpression export type Constant = IntegerConstant | BoolConstant | BytesConstant | StringConstant -export type AWST = ContractFragment | LogicSignature | Subroutine +export type AWST = Contract | LogicSignature | Subroutine export const concreteNodes = { subroutineID: SubroutineID, expressionStatement: ExpressionStatement, @@ -1376,7 +1370,7 @@ export const concreteNodes = { compiledLogicSig: CompiledLogicSig, stateTotals: StateTotals, aRC4Router: ARC4Router, - contractFragment: ContractFragment, + contract: Contract, uInt64Constant: IntegerConstant, bigUIntConstant: IntegerConstant, } as const @@ -1466,5 +1460,5 @@ export interface ContractMemberNodeVisitor { export interface RootNodeVisitor { visitSubroutine(rootNode: Subroutine): T visitLogicSignature(rootNode: LogicSignature): T - visitContractFragment(rootNode: ContractFragment): T + visitContract(rootNode: Contract): T } diff --git a/src/awst/source-location.ts b/src/awst/source-location.ts index 7535ceb8..d8333176 100644 --- a/src/awst/source-location.ts +++ b/src/awst/source-location.ts @@ -1,27 +1,64 @@ -import type ts from 'typescript' +import ts from 'typescript' import { invariant, normalisePath } from '../util' export class SourceLocation { - file: string + file: string | null line: number endLine: number column: number endColumn: number + scope: 'file' | 'range' - constructor(props: { file: string; line: number; endLine: number; column: number; endColumn: number }) { - this.file = props.file + constructor(props: { + file?: string | null + line: number + endLine: number + column: number + endColumn: number + scope: SourceLocation['scope'] + }) { + invariant(props.line <= props.endLine, 'Start line must be before end line') + if (props.line === props.endLine) invariant(props.column <= props.endColumn, 'Start column must be before end column') + this.file = props.file ?? null this.line = props.line this.endLine = props.endLine this.column = props.column this.endColumn = props.endColumn + this.scope = props.scope + + // Exclude scope from enumerable properties so it doesn't end up being serialized + Object.defineProperty(this, 'scope', { + enumerable: false, + }) + } + + private static getStartAndEnd(node: ts.Node): { start: number; end: number } { + if (ts.isClassDeclaration(node)) { + return fromNodeTillStartOfNode(node, node.members.at(0)) + } + if (ts.isMethodDeclaration(node) || ts.isFunctionDeclaration(node)) { + return fromNodeTillStartOfNode(node, node.body) + } + if (ts.isForStatement(node) || ts.isForInStatement(node) || ts.isForOfStatement(node)) { + return fromNodeTillStartOfNode(node, node.statement) + } + if (ts.isIfStatement(node)) { + return fromNodeTillStartOfNode(node, node.thenStatement) + } + + return { + start: node.getStart(), + end: node.getEnd(), + } } - static fromNode(sourceFile: ts.SourceFile, node: ts.Node, programDirectory: string): SourceLocation { - const startPos = node.getStart(sourceFile) - const width = node.getWidth(sourceFile) + static fromNode(node: ts.Node, programDirectory: string): SourceLocation { + const sourceFile = node.getSourceFile() + + const { start, end } = SourceLocation.getStartAndEnd(node) - const startLoc = sourceFile.getLineAndCharacterOfPosition(startPos) - const endLoc = sourceFile.getLineAndCharacterOfPosition(startPos + width) + const startLoc = sourceFile.getLineAndCharacterOfPosition(start) + const endLoc = sourceFile.getLineAndCharacterOfPosition(end) return new SourceLocation({ file: normalisePath(sourceFile.fileName, programDirectory), @@ -29,16 +66,20 @@ export class SourceLocation { endLine: endLoc.line + 1, column: startLoc.character, endColumn: endLoc.character, + scope: 'range', }) } static fromFile(sourceFile: ts.SourceFile, programDirectory: string): SourceLocation { + const endPos = sourceFile.getEnd() + const endLoc = sourceFile.getLineAndCharacterOfPosition(endPos) return new SourceLocation({ file: normalisePath(sourceFile.fileName, programDirectory), line: 1, - endLine: 1, + endLine: endLoc.line + 1, column: 1, - endColumn: 1, + endColumn: endLoc.character, + scope: 'file', }) } @@ -52,6 +93,7 @@ export class SourceLocation { endLine: endLoc.line + 1, column: startLoc.character, endColumn: endLoc.character, + scope: 'range', }) } @@ -64,6 +106,7 @@ export class SourceLocation { endLine: startLoc.line + 1, column: startLoc.character, endColumn: startLoc.character, + scope: 'range', }) } @@ -83,7 +126,23 @@ export class SourceLocation { column: acc.line === cur.line ? Math.min(acc.column, cur.column) : acc.line < cur.line ? acc.column : cur.column, endColumn: acc.endLine === cur.endLine ? Math.max(acc.endColumn, cur.endColumn) : acc.endLine > cur.endLine ? acc.endColumn : cur.endColumn, + scope: 'range', }) }) } + + static None = new SourceLocation({ + line: 1, + endLine: 1, + column: 0, + endColumn: 1, + scope: 'file', + }) +} + +function fromNodeTillStartOfNode(n1: ts.Node, n2?: ts.Node): { start: number; end: number } { + return { + start: n1.getStart(), + end: n2 ? n2.getStart() - n2.getLeadingTriviaWidth() : n1.getEnd(), + } } diff --git a/src/awst/to-code-visitor.ts b/src/awst/to-code-visitor.ts index 0035c4cb..18606c2c 100644 --- a/src/awst/to-code-visitor.ts +++ b/src/awst/to-code-visitor.ts @@ -2,10 +2,11 @@ import { Buffer } from 'node:buffer' import { TodoError } from '../errors' import { logger } from '../logger' import { uint8ArrayToBase32, uint8ArrayToUtf8 } from '../util' +import type { ContractReference } from './models' import type { AppStorageDefinition, ContractMemberNodeVisitor, ExpressionVisitor, RootNodeVisitor, StatementVisitor } from './nodes' import * as nodes from './nodes' import { AppStorageKind, BytesEncoding, ContractMethodTarget, InstanceMethodTarget, InstanceSuperMethodTarget, SubroutineID } from './nodes' -import { boolWType } from './wtypes' +import { wtypes } from './wtypes' function printBytes(value: Uint8Array, encoding: BytesEncoding) { switch (encoding) { @@ -35,7 +36,7 @@ export class ToCodeVisitor return `${expression.func}(${expression.args.map((a) => a.value.accept(this)).join(', ')})` } visitARC4Router(expression: nodes.ARC4Router): string { - throw new Error('Method not implemented.') + return `arc4Router()` } visitAppStorageDefinition(contractMemberNode: AppStorageDefinition): string[] { throw new Error('Method not implemented.') @@ -63,7 +64,10 @@ export class ToCodeVisitor return [`goto ${statement.target}`] } visitIntersectionSliceExpression(expression: nodes.IntersectionSliceExpression): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + const args = [expression.beginIndex, expression.endIndex] + .flatMap((f) => (typeof f === 'bigint' ? f : (f?.accept(this) ?? []))) + .join(', ') + return `${expression.base.accept(this)}.slice(${args})` } visitBoxValueExpression(expression: nodes.BoxValueExpression): string { if (expression.key instanceof nodes.BytesConstant) { @@ -91,10 +95,10 @@ export class ToCodeVisitor throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) } visitMethodConstant(expression: nodes.MethodConstant): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + return `Method("${expression.value}")` } visitAddressConstant(expression: nodes.AddressConstant): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + return `Address("${expression.value}")` } visitARC4Encode(expression: nodes.ARC4Encode): string { return `ARC4_ENCODE(${expression.value.accept(this)}, wtype=${expression.wtype})` @@ -103,16 +107,16 @@ export class ToCodeVisitor return `copy(${expression.value.accept(this)})` } visitArrayConcat(expression: nodes.ArrayConcat): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + return `${expression.left.accept(this)}.concat(${expression.right.accept(this)}` } visitArrayPop(expression: nodes.ArrayPop): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + return `${expression.base.accept(this)}.pop()` } visitArrayExtend(expression: nodes.ArrayExtend): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + return `${expression.base.accept(this)}.push(...${expression.other.accept(this)}` } visitARC4Decode(expression: nodes.ARC4Decode): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + return `ARC4_DECODE(${expression.value})` } visitIntrinsicCall(expression: nodes.IntrinsicCall): string { const immediates = expression.immediates.length ? `<${expression.immediates.map((i) => i).join(', ')}>` : '' @@ -135,6 +139,11 @@ export class ToCodeVisitor return `checked_maybe(${expression.expr.accept(this)}, comment=${expression.comment})` } visitTupleExpression(expression: nodes.TupleExpression): string { + const names = expression.wtype.names + if (names) { + return `{ ${expression.items.map((item, i) => `${names[i]}: ${item.accept(this)}`).join(', ')} }` + } + return `[${expression.items.map((i) => i.accept(this)).join(', ')}]` } visitTupleItemExpression(expression: nodes.TupleItemExpression): string { @@ -151,7 +160,7 @@ export class ToCodeVisitor return `submit_txn(${expression.itxns.map((i) => i.accept(this)).join(', ')})` } visitFieldExpression(expression: nodes.FieldExpression): string { - throw new TodoError('Method not implemented.', { sourceLocation: expression.sourceLocation }) + return `${expression.base.accept(this)}.${expression.name}` } visitIndexExpression(expression: nodes.IndexExpression): string { return `${expression.base.accept(this)}[${expression.index.accept(this)}]` @@ -174,7 +183,7 @@ export class ToCodeVisitor } visitReinterpretCast(expression: nodes.ReinterpretCast): string { const target = expression.expr.accept(this) - if (expression.wtype.equals(boolWType)) { + if (expression.wtype.equals(wtypes.boolWType)) { return `Boolean(${target})` } return `reinterpret_cast<${expression.wtype}>(${target})` @@ -308,14 +317,24 @@ export class ToCodeVisitor ] } visitContractMethod(statement: nodes.ContractMethod): string[] { - return [`${statement.memberName}(): ${statement.returnType}`, '{', ...indent(statement.body.accept(this)), '}', ''] + const prefix = statement.cref.id === this.currentContract.at(-1)?.id ? '' : `${statement.cref.className}::` + return [`${prefix}${statement.memberName}(): ${statement.returnType}`, '{', ...indent(statement.body.accept(this)), '}', ''] } visitLogicSignature(moduleStatement: nodes.LogicSignature): string[] { throw new TodoError('Method not implemented.', { sourceLocation: moduleStatement.sourceLocation }) } - visitContractFragment(c: nodes.ContractFragment): string[] { + + private currentContract: ContractReference[] = [] + visitContract(c: nodes.Contract): string[] { + this.currentContract.push(c.id) + + using _ = { + [Symbol.dispose]: () => { + this.currentContract.pop() + }, + } const body: string[] = [] - if (c.appState.size) { + if (c.appState.length) { const storageByKind = Array.from(c.appState.values()).reduce( (acc, cur) => acc.set(cur.kind, [...(acc.get(cur.kind) ?? []), cur]), new Map(), @@ -342,23 +361,17 @@ export class ToCodeVisitor if (c.reservedScratchSpace.size) { logger.warn(c.sourceLocation, 'Handle reservedScratchSpace to-code') } - if (c.init) { - body.push(...this.visitSpecialMethod(c.init, 'constructor')) - } if (c.approvalProgram) { body.push(...this.visitSpecialMethod(c.approvalProgram, 'approvalProgram')) } if (c.clearProgram) { body.push(...this.visitSpecialMethod(c.clearProgram, 'clearProgram')) } - for (const method of c.subroutines) { + for (const method of c.methods) { body.push(...method.accept(this)) } const header = ['contract', c.name] - if (c.bases.length) { - header.push('extends', c.bases.map((b) => `${b.moduleName}::${b.className}`).join(', ')) - } return [header.join(' '), '{', ...indent(body), '}'] } diff --git a/src/awst/txn-fields.ts b/src/awst/txn-fields.ts index 90a9faae..06ca6890 100644 --- a/src/awst/txn-fields.ts +++ b/src/awst/txn-fields.ts @@ -1,4 +1,4 @@ -import { wtypes } from './index' +import { wtypes } from './wtypes' export class TxnFieldData { readonly immediate: string diff --git a/src/awst/wtypes.ts b/src/awst/wtypes.ts index b8382f48..74b9be19 100644 --- a/src/awst/wtypes.ts +++ b/src/awst/wtypes.ts @@ -8,241 +8,363 @@ export enum AVMType { any = AVMType.bytes | AVMType.uint64, } -export class WType { - constructor(props: { name: string; immutable?: boolean; scalarType: AVMType | null; ephemeral?: boolean }) { - this.name = props.name - this.immutable = props.immutable ?? true - this.scalarType = props.scalarType - this.ephemeral = props.ephemeral ?? false - } +// eslint-disable-next-line @typescript-eslint/no-namespace +export namespace wtypes { + export class WType { + constructor(props: { name: string; immutable?: boolean; scalarType: AVMType | null; ephemeral?: boolean }) { + this.name = props.name + this.immutable = props.immutable ?? true + this.scalarType = props.scalarType + this.ephemeral = props.ephemeral ?? false + } - readonly name: string - readonly immutable: boolean - /** - * ephemeral types are not suitable for naive storage / persistence, - * even if their underlying type is a simple stack value - */ - readonly ephemeral: boolean - /** - * The AVM stack type of this type (if any) - */ - readonly scalarType: AVMType | null - - equals(other: WType): boolean { - return other.name === this.name - } + readonly name: string + readonly immutable: boolean + /** + * ephemeral types are not suitable for naive storage / persistence, + * even if their underlying type is a simple stack value + */ + readonly ephemeral: boolean + /** + * The AVM stack type of this type (if any) + */ + readonly scalarType: AVMType | null - toString(): string { - return this.name - } + equals(other: WType): boolean { + return other instanceof this.constructor && other.name === this.name + } - get id() { - return this.name - } -} + toString(): string { + return this.name + } -export const voidWType = new WType({ - name: 'void', - scalarType: null, -}) -export const boolWType = new WType({ - name: 'bool', - scalarType: AVMType.uint64, -}) -export const uint64WType = new WType({ - name: 'uint64', - scalarType: AVMType.uint64, -}) -export const uint64RangeWType = new WType({ - name: 'uint64_range', - scalarType: null, - immutable: true, -}) -export const bytesWType = new WType({ - name: 'bytes', - scalarType: AVMType.bytes, -}) -export const stateKeyWType = new WType({ - name: 'state_key', - scalarType: AVMType.bytes, -}) -export const boxKeyWType = new WType({ - name: 'box_key', - scalarType: AVMType.bytes, -}) -export const stringWType = new WType({ - name: 'string', - scalarType: AVMType.bytes, -}) -export const biguintWType = new WType({ - name: 'biguint', - scalarType: AVMType.bytes, -}) -export const assetWType = new WType({ - name: 'asset', - scalarType: AVMType.uint64, -}) - -export const accountWType = new WType({ - name: 'account', - scalarType: AVMType.bytes, -}) -export const applicationWType = new WType({ - name: 'application', - scalarType: AVMType.uint64, -}) - -export abstract class ARC4Type extends WType { - readonly decodeType: WType | null - readonly arc4Name: string - readonly otherEncodeableTypes: WType[] - constructor({ - decodeType, - arc4Name, - otherEncodeableTypes, - ...rest - }: { - decodeType: WType | null - arc4Name: string - otherEncodeableTypes: WType[] - name: string - immutable?: boolean - scalarType: AVMType | null - ephemeral?: boolean - }) { - super(rest) - this.arc4Name = arc4Name - this.decodeType = decodeType - this.otherEncodeableTypes = otherEncodeableTypes + get id() { + return this.name + } } -} -export class WStructType extends WType { - fields: Record + export const voidWType = new WType({ + name: 'void', + scalarType: null, + }) + export const boolWType = new WType({ + name: 'bool', + scalarType: AVMType.uint64, + }) + export const uint64WType = new WType({ + name: 'uint64', + scalarType: AVMType.uint64, + }) + export const uint64RangeWType = new WType({ + name: 'uint64_range', + scalarType: null, + immutable: true, + }) + export const bytesWType = new WType({ + name: 'bytes', + scalarType: AVMType.bytes, + }) + export const stateKeyWType = new WType({ + name: 'state_key', + scalarType: AVMType.bytes, + }) + export const boxKeyWType = new WType({ + name: 'box_key', + scalarType: AVMType.bytes, + }) + export const stringWType = new WType({ + name: 'string', + scalarType: AVMType.bytes, + }) + export const biguintWType = new WType({ + name: 'biguint', + scalarType: AVMType.bytes, + }) + export const assetWType = new WType({ + name: 'asset', + scalarType: AVMType.uint64, + }) - constructor({ fields, name }: { fields: Record; name: string }) { - super({ - name, - scalarType: null, - immutable: true, - }) - this.fields = fields + export const accountWType = new WType({ + name: 'account', + scalarType: AVMType.bytes, + }) + export const applicationWType = new WType({ + name: 'application', + scalarType: AVMType.uint64, + }) + + export class ARC4Type extends WType { + readonly puyaTypeName: string = 'ARC4Type' + readonly nativeType: WType | null + readonly arc4Name: string + readonly otherEncodeableTypes: WType[] + constructor({ + nativeType, + arc4Name, + otherEncodeableTypes, + ...rest + }: { + nativeType: WType | null + arc4Name: string + otherEncodeableTypes?: WType[] + name: string + immutable?: boolean + scalarType?: AVMType | null + ephemeral?: boolean + }) { + super({ ...rest, scalarType: rest.scalarType ?? AVMType.bytes }) + this.arc4Name = arc4Name + this.nativeType = nativeType + this.otherEncodeableTypes = otherEncodeableTypes ?? [] + } } -} -export class WTuple extends WType { - types: WType[] - constructor(props: { types: WType[]; immutable?: boolean }) { - super({ - name: 'WTuple', - scalarType: null, - immutable: props.immutable ?? true, - }) - invariant(props.types.length, 'Tuple length cannot be zero') - this.types = props.types + export class WStructType extends WType { + fields: Record + + constructor({ fields, name }: { fields: Record; name: string }) { + super({ + name, + scalarType: null, + immutable: true, + }) + this.fields = fields + } } - toString(): string { - return `${this.immutable ? 'readonly' : ''}tuple[${this.types.join(', ')}]` + export class WTuple extends WType { + types: WType[] + names: string[] | undefined + constructor(props: { names?: string[]; types: WType[]; immutable?: boolean; name?: string }) { + super({ + name: props.name ?? 'tuple', + scalarType: null, + immutable: props.immutable ?? true, + }) + invariant(props.types.length, 'Tuple length cannot be zero') + this.types = props.types + if (props.names) { + invariant(props.names.length === props.types.length, 'If names is provided, length must match types') + this.names = props.names + } + } + + equals(other: WType): boolean { + if (other instanceof WTuple) { + return ( + this.name === other.name && + this.types.every((t, i) => t.equals(other.types[i])) && + (this.names?.every((n, i) => n === other.names?.[i]) ?? this.names === other.names) + ) + } + return false + } + + toString(): string { + if (this.names) { + return `${this.name ?? ''}{ ${this.names.map((n, i) => `${n}: ${this.types[i]}`).join(', ')} }` + } + return `${this.immutable ? 'readonly' : ''}${this.name ?? ''}[${this.types.join(', ')}]` + } } -} -export class WArray extends WType { - readonly elementType: WType - constructor(props: { itemType: WType; immutable: boolean }) { - super({ - name: 'WArray', - scalarType: null, - immutable: props.immutable, - }) - this.elementType = props.itemType + export class WArray extends WType { + readonly elementType: WType + constructor(props: { itemType: WType; immutable: boolean }) { + super({ + name: 'WArray', + scalarType: null, + immutable: props.immutable, + }) + this.elementType = props.itemType + } } -} -export class WEnumeration extends WType { - readonly sequenceType: WType - constructor(props: { sequenceType: WType }) { - super({ - name: 'WArray', - scalarType: null, - immutable: true, - }) - this.sequenceType = props.sequenceType + export class WEnumeration extends WType { + readonly sequenceType: WType + constructor(props: { sequenceType: WType }) { + super({ + name: 'WArray', + scalarType: null, + immutable: true, + }) + this.sequenceType = props.sequenceType + } } -} -export class WGroupTransaction extends WType { - transactionType: TransactionKind | null - constructor({ transactionType }: { transactionType?: TransactionKind }) { - super({ - scalarType: AVMType.uint64, - name: transactionType === undefined ? 'group_transaction' : `group_transaction_${TransactionKind[transactionType]}`, - }) - this.transactionType = transactionType ?? null + export class WGroupTransaction extends WType { + transactionType: TransactionKind | null + constructor({ transactionType }: { transactionType?: TransactionKind }) { + super({ + scalarType: AVMType.uint64, + name: transactionType === undefined ? 'group_transaction' : `group_transaction_${TransactionKind[transactionType]}`, + }) + this.transactionType = transactionType ?? null + } } -} -export class WInnerTransaction extends WType { - transactionType: TransactionKind | null - constructor({ transactionType }: { transactionType?: TransactionKind }) { - super({ - scalarType: null, - name: transactionType === undefined ? 'inner_transaction' : `inner_transaction_${TransactionKind[transactionType]}`, - }) - this.transactionType = transactionType ?? null + export class WInnerTransaction extends WType { + transactionType: TransactionKind | null + constructor({ transactionType }: { transactionType?: TransactionKind }) { + super({ + scalarType: null, + name: transactionType === undefined ? 'inner_transaction' : `inner_transaction_${TransactionKind[transactionType]}`, + }) + this.transactionType = transactionType ?? null + } } -} -export class WInnerTransactionFields extends WType { - transactionType: TransactionKind | null - constructor({ transactionType }: { transactionType?: TransactionKind }) { - super({ - scalarType: null, - name: transactionType === undefined ? 'inner_transaction_fields' : `inner_transaction_fields_${TransactionKind[transactionType]}`, - }) - this.transactionType = transactionType ?? null + export class WInnerTransactionFields extends WType { + transactionType: TransactionKind | null + constructor({ transactionType }: { transactionType?: TransactionKind }) { + super({ + scalarType: null, + name: transactionType === undefined ? 'inner_transaction_fields' : `inner_transaction_fields_${TransactionKind[transactionType]}`, + }) + this.transactionType = transactionType ?? null + } } -} -export class ARC4UIntN extends ARC4Type { - readonly n: bigint - constructor({ n }: { n: bigint }) { - super({ - name: `arc4.uint${n}`, - scalarType: AVMType.bytes, - decodeType: n <= 64 ? uint64WType : biguintWType, - arc4Name: `uint${n}`, - otherEncodeableTypes: [uint64WType, biguintWType, boolWType], - }) - this.n = n + export class ARC4UIntN extends ARC4Type { + readonly n: bigint + constructor({ n, arc4Name }: { n: bigint; arc4Name?: string }) { + super({ + name: arc4Name ? `arc4.${arc4Name}` : `arc4.uint${n}`, + scalarType: AVMType.bytes, + nativeType: n <= 64 ? uint64WType : biguintWType, + arc4Name: arc4Name ?? `uint${n}`, + otherEncodeableTypes: [uint64WType, biguintWType, boolWType], + }) + this.n = n + } } -} -export class ARC4UFixedNxM extends ARC4Type {} -export class ARC4Struct extends ARC4Type {} + export class ARC4UFixedNxM extends ARC4Type {} + + export class ARC4Struct extends ARC4Type { + fields: Record + sourceLocation: SourceLocation | null -export abstract class ARC4Array extends ARC4Type { - readonly elementType: ARC4Type - protected constructor(props: { arc4Name: string; otherEncodeableTypes: WType[]; name: string; elementType: ARC4Type }) { - super({ decodeType: null, scalarType: AVMType.bytes, immutable: false, ...props }) - this.elementType = props.elementType + constructor({ fields, sourceLocation, name }: { name: string; fields: Record; sourceLocation?: SourceLocation }) { + super({ + arc4Name: Object.values(fields) + .map((f) => f.arc4Name) + .join(','), + name, + nativeType: null, + }) + this.sourceLocation = sourceLocation ?? null + this.fields = fields + } } -} + export class ARC4Tuple extends ARC4Type { + readonly types: ARC4Type[] + readonly sourceLocation: SourceLocation | null -export class ARC4DynamicArray extends ARC4Array { - readonly sourceLocation: SourceLocation | null - constructor({ elementType, sourceLocation }: { elementType: ARC4Type; sourceLocation?: SourceLocation }) { - super({ elementType, name: `arc4.dynamic_array<${elementType.name}>`, arc4Name: `${elementType.arc4Name}[]`, otherEncodeableTypes: [] }) - this.sourceLocation = sourceLocation ?? null + constructor({ types, sourceLocation }: { types: ARC4Type[]; sourceLocation?: SourceLocation }) { + const typesStr = types.map((t) => t.arc4Name).join(',') + super({ + name: `arc4.tuple<${typesStr}>`, + arc4Name: `(${typesStr})`, + nativeType: null, + }) + this.sourceLocation = sourceLocation ?? null + this.types = types + } } -} -export class ARC4StaticArray extends ARC4Array { - readonly sourceLocation: SourceLocation | null - readonly arraySize: bigint - constructor({ elementType, sourceLocation, arraySize }: { arraySize: bigint; elementType: ARC4Type; sourceLocation?: SourceLocation }) { - super({ + + export abstract class ARC4Array extends ARC4Type { + readonly elementType: ARC4Type + protected constructor(props: { + arc4Name: string + otherEncodeableTypes: WType[] + name: string + elementType: ARC4Type + nativeType?: WType + immutable?: boolean + }) { + super({ ...props, scalarType: AVMType.bytes, immutable: props.immutable ?? false, nativeType: props.nativeType ?? null }) + this.elementType = props.elementType + } + } + + export class ARC4DynamicArray extends ARC4Array { + readonly sourceLocation: SourceLocation | null + constructor({ + elementType, + sourceLocation, + arc4Name, + nativeType, + immutable, + }: { + elementType: ARC4Type + sourceLocation?: SourceLocation + arc4Name?: string + nativeType?: WType + immutable?: boolean + }) { + super({ + elementType, + name: `arc4.dynamic_array<${elementType.name}>`, + arc4Name: arc4Name ?? `${elementType.arc4Name}[]`, + otherEncodeableTypes: [], + nativeType, + immutable, + }) + this.sourceLocation = sourceLocation ?? null + } + } + export class ARC4StaticArray extends ARC4Array { + readonly sourceLocation: SourceLocation | null + readonly arraySize: bigint + constructor({ elementType, - name: `arc4.static_array<${elementType.name}>`, - arc4Name: `${elementType.arc4Name}[${arraySize}]`, - otherEncodeableTypes: [], - }) - this.sourceLocation = sourceLocation ?? null - this.arraySize = arraySize + sourceLocation, + arraySize, + arc4Name, + nativeType, + immutable, + }: { + arraySize: bigint + elementType: ARC4Type + sourceLocation?: SourceLocation + arc4Name?: string + nativeType?: WType + immutable?: boolean + }) { + super({ + elementType, + name: `arc4.static_array<${elementType.name}>`, + arc4Name: arc4Name ?? `${elementType.arc4Name}[${arraySize}]`, + nativeType: nativeType, + otherEncodeableTypes: [], + immutable, + }) + this.sourceLocation = sourceLocation ?? null + this.arraySize = arraySize + } } + + export const arc4ByteAliasWType = new ARC4UIntN({ + n: 8n, + arc4Name: 'byte', + }) + export const arc4AddressAliasWType = new ARC4StaticArray({ + arraySize: 32n, + immutable: true, + elementType: arc4ByteAliasWType, + nativeType: accountWType, + arc4Name: 'address', + }) + + export const arc4BooleanWType = new ARC4Type({ + name: 'arc4.bool', + arc4Name: 'bool', + immutable: true, + nativeType: boolWType, + }) + + export const arc4StringAliasWType = new ARC4DynamicArray({ + arc4Name: 'string', + elementType: arc4ByteAliasWType, + nativeType: stringWType, + immutable: true, + }) } diff --git a/src/awst_build/arc4-util.ts b/src/awst_build/arc4-util.ts new file mode 100644 index 00000000..19bc04cd --- /dev/null +++ b/src/awst_build/arc4-util.ts @@ -0,0 +1,87 @@ +import type { ARC32StructDef } from '../awst/models' +import type { SourceLocation } from '../awst/source-location' +import { CodeError } from '../errors' +import { logger } from '../logger' +import type { FunctionPType, PType } from './ptypes' +import { + accountPType, + applicationPType, + assetPType, + boolPType, + bytesPType, + GroupTransactionPType, + ObjectPType, + stringPType, + TuplePType, + uint64PType, + voidPType, +} from './ptypes' +import { + ARC4BooleanType, + arc4ByteAlias, + ARC4EncodedType, + ARC4StringType, + ARC4StructType, + ARC4TupleType, + DynamicArrayType, + UintNType, +} from './ptypes/arc4-types' + +export function ptypeToArc4PType(ptype: PType, sourceLocation: SourceLocation): PType { + if (ptype instanceof ARC4EncodedType) return ptype + if (ptype instanceof GroupTransactionPType) return ptype + if (ptype.equals(applicationPType) || ptype.equals(accountPType) || ptype.equals(assetPType)) return ptype + if (ptype.equals(voidPType)) return voidPType + if (isArc4EncodableType(ptype)) { + return ptypeToArc4EncodedType(ptype, sourceLocation) + } + logger.error(sourceLocation, `Unsupported type used in ABI method: ${ptype}`) + return ptype +} + +export function isArc4EncodableType(ptype: PType): boolean { + if (ptype instanceof ARC4EncodedType) return true + if (ptype.equals(boolPType)) return true + if (ptype.equals(uint64PType)) return true + if (ptype.equals(bytesPType)) return true + if (ptype.equals(stringPType)) return true + if (ptype instanceof TuplePType) return ptype.items.every((i) => isArc4EncodableType(i)) + if (ptype instanceof ObjectPType) return ptype.orderedProperties().every(([, pt]) => isArc4EncodableType(pt)) + + return false +} +export function ptypeToArc4EncodedType(ptype: PType, sourceLocation: SourceLocation): ARC4EncodedType { + if (ptype instanceof ARC4EncodedType) return ptype + if (ptype.equals(boolPType)) return ARC4BooleanType + if (ptype.equals(uint64PType)) return new UintNType({ n: 64n }) + if (ptype.equals(bytesPType)) return new DynamicArrayType({ elementType: arc4ByteAlias }) + if (ptype.equals(stringPType)) return ARC4StringType + if (ptype instanceof TuplePType) return new ARC4TupleType({ types: ptype.items.map((i) => ptypeToArc4EncodedType(i, sourceLocation)) }) + if (ptype instanceof ObjectPType) + return new ARC4StructType({ + name: ptype.name, + module: ptype.module, + fields: Object.fromEntries(ptype.orderedProperties().map(([p, pt]) => [p, ptypeToArc4EncodedType(pt, sourceLocation)])), + }) + + throw new CodeError(`${ptype} cannot be encoded to an ARC4 type`, { sourceLocation }) +} + +export function getFunctionTypes(ptype: FunctionPType, sourceLocation: SourceLocation): Record { + const result: Record = {} + for (const [param, paramType] of ptype.parameters) { + result[param] = paramType + } + if ('output' in result) { + logger.error(sourceLocation, 'for compatibility with ARC-32, ARC-4 methods cannot have an argument named output') + } + result['output'] = ptype.returnType + return result +} + +export function getArc4StructDef(ptype: ARC4StructType): ARC32StructDef { + return { + name: ptype.name, + elements: Object.entries(ptype.fields).map(([f, t]) => [f, t.wtype.arc4Name]), + } +} diff --git a/src/awst_build/base-visitor.ts b/src/awst_build/base-visitor.ts index 0470feda..6c8470b5 100644 --- a/src/awst_build/base-visitor.ts +++ b/src/awst_build/base-visitor.ts @@ -4,7 +4,7 @@ import type { Expression, LValue, Statement } from '../awst/nodes' import type { SourceLocation } from '../awst/source-location' import { CodeError, NotSupported, TodoError } from '../errors' import { logger } from '../logger' -import { codeInvariant, enumerate, invariant } from '../util' +import { codeInvariant, enumerate, invariant, sortBy } from '../util' import type { Expressions } from '../visitor/syntax-names' import { AugmentedAssignmentBinaryOp, @@ -205,7 +205,7 @@ export abstract class BaseVisitor implements Visitor { this.logNotSupported(node.questionDotToken, 'The optional chaining (?.) operator is not supported') const sourceLocation = this.sourceLocation(node) const eb = this.baseAccept(node.expression) - const args = node.arguments.map((a) => requireInstanceBuilder(this.baseAccept(a))) + const args = node.arguments.map((a) => this.baseAccept(a)) const typeArgs = this.context.getTypeParameters(node) return eb.call(args, typeArgs, sourceLocation) } @@ -213,7 +213,7 @@ export abstract class BaseVisitor implements Visitor { visitNewExpression(node: ts.NewExpression): NodeBuilder { const sourceLocation = this.sourceLocation(node) const eb = this.baseAccept(node.expression) - const args = node.arguments?.map((a) => requireInstanceBuilder(this.baseAccept(a))) ?? [] + const args = node.arguments?.map((a) => this.baseAccept(a)) ?? [] const typeArgs = node.typeArguments?.map((t) => this.context.getPTypeForNode(t)) ?? this.context.getPTypeForNode(node).getGenericArgs() return eb.newCall(args, typeArgs, sourceLocation) } @@ -530,7 +530,12 @@ export abstract class BaseVisitor implements Visitor { if (sourceType instanceof ObjectPType) { // Recursively narrow object properties codeInvariant(targetType instanceof ObjectPType, errorMessage) + const targetPropertyOrder = targetType + .orderedProperties() + .reduce((acc, [prop], index) => acc.set(prop, index), new Map()) return new ObjectPType({ + name: targetType.name, + module: targetType.module, properties: Object.fromEntries( sourceType .orderedProperties() @@ -539,7 +544,8 @@ export abstract class BaseVisitor implements Visitor { prop in targetType.properties ? this.buildAssignmentExpressionType(targetType.getPropertyType(prop), propType, sourceLocation) : propType, - ]), + ]) + .toSorted(sortBy(([prop]) => targetPropertyOrder.get(prop) ?? Number.MAX_SAFE_INTEGER)), ), }) } @@ -585,7 +591,7 @@ export abstract class BaseVisitor implements Visitor { ) } } - return nodeFactory.tupleExpression({ items: targets, sourceLocation }) + return nodeFactory.tupleExpression({ items: targets, sourceLocation, wtype: assignmentType.wtype }) } } if (target.ptype.equals(assignmentType)) { @@ -598,4 +604,52 @@ export abstract class BaseVisitor implements Visitor { }, ) } + + protected parseMemberModifiers(node: { modifiers?: readonly ts.ModifierLike[] }) { + let isPublic = true + let isStatic = false + if (node.modifiers) + for (const m of node.modifiers) { + switch (m.kind) { + case ts.SyntaxKind.StaticKeyword: + isStatic = true + continue + case ts.SyntaxKind.PublicKeyword: + isPublic = true + continue + case ts.SyntaxKind.ProtectedKeyword: + isPublic = false + continue + case ts.SyntaxKind.PrivateKeyword: + isPublic = false + continue + case ts.SyntaxKind.AbstractKeyword: + // TODO: Do we need to do anything here? + continue + case ts.SyntaxKind.AccessorKeyword: + logger.error(this.sourceLocation(m), 'properties are not supported') + continue + case ts.SyntaxKind.AsyncKeyword: + logger.error(this.sourceLocation(m), 'async keyword is not supported') + continue + case ts.SyntaxKind.DeclareKeyword: + logger.error(this.sourceLocation(m), 'declare keyword is not supported') + continue + case ts.SyntaxKind.ExportKeyword: + case ts.SyntaxKind.ConstKeyword: + case ts.SyntaxKind.DefaultKeyword: + case ts.SyntaxKind.ReadonlyKeyword: + case ts.SyntaxKind.OverrideKeyword: + case ts.SyntaxKind.InKeyword: + case ts.SyntaxKind.OutKeyword: + case ts.SyntaxKind.Decorator: + // Ignore for now + continue + } + } + return { + isStatic, + isPublic, + } + } } diff --git a/src/awst_build/constructor-visitor.ts b/src/awst_build/constructor-visitor.ts index bf6b4247..cdf706a8 100644 --- a/src/awst_build/constructor-visitor.ts +++ b/src/awst_build/constructor-visitor.ts @@ -31,8 +31,6 @@ export class ConstructorVisitor extends ContractMethodBaseVisitor { args, returnType: voidPType.wtype, body, - inheritable: true, - synthetic: false, cref: contractInfo.cref, documentation, }) diff --git a/src/awst_build/context/awst-build-context.ts b/src/awst_build/context/awst-build-context.ts index d870441b..c6707010 100644 --- a/src/awst_build/context/awst-build-context.ts +++ b/src/awst_build/context/awst-build-context.ts @@ -1,6 +1,6 @@ import ts from 'typescript' import type { awst } from '../../awst' -import type { CompilationSet, ContractReference, LogicSigReference } from '../../awst/models' +import type { ContractReference, LogicSigReference } from '../../awst/models' import { nodeFactory } from '../../awst/node-factory' import type { AppStorageDefinition, Constant } from '../../awst/nodes' import { SourceLocation } from '../../awst/source-location' @@ -9,6 +9,8 @@ import { logger } from '../../logger' import { codeInvariant, invariant } from '../../util' import type { AppStorageDeclaration } from '../contract-data' import type { NodeBuilder } from '../eb' +import type { Index, LogicSig } from '../models' +import { CompilationSet } from '../models' import type { ContractClassPType, PType } from '../ptypes' import { typeRegistry } from '../type-registry' import { TypeResolver } from '../type-resolver' @@ -86,9 +88,10 @@ export interface AwstBuildContext { getStorageDeclaration(contractType: ContractClassPType, memberName: string): AppStorageDeclaration | undefined - getStorageDefinitionsForContract(contractType: ContractClassPType): Map + getStorageDefinitionsForContract(contractType: ContractClassPType): AppStorageDefinition[] - addToCompilationSet(compilationTarget: ContractReference | LogicSigReference): void + addToCompilationSet(compilationTarget: ContractReference, contract: Index): void + addToCompilationSet(compilationTarget: LogicSigReference, logicSig: LogicSig): void get compilationSet(): CompilationSet } @@ -102,13 +105,13 @@ class AwstBuildContextImpl implements AwstBuildContext { readonly switchLoopCtx = new SwitchLoopContext() readonly typeResolver: TypeResolver readonly typeChecker: ts.TypeChecker - readonly #compilationSet: Array + readonly #compilationSet: CompilationSet private constructor( public readonly program: ts.Program, private readonly constants: Map, private readonly nameResolver: UniqueNameResolver, private readonly storageDeclarations: Map>, - compilationSet: Array, + compilationSet: CompilationSet, ) { this.typeChecker = program.getTypeChecker() this.typeResolver = new TypeResolver(this.typeChecker, this.program.getCurrentDirectory()) @@ -116,7 +119,7 @@ class AwstBuildContextImpl implements AwstBuildContext { } static forProgram(program: ts.Program): AwstBuildContext { - return new AwstBuildContextImpl(program, new Map(), new UniqueNameResolver(), new Map(), []) + return new AwstBuildContextImpl(program, new Map(), new UniqueNameResolver(), new Map(), new CompilationSet()) } addConstant(name: string, value: Constant) { @@ -187,8 +190,7 @@ class AwstBuildContextImpl implements AwstBuildContext { } getSourceLocation(node: ts.Node) { - const sourceFile = node.getSourceFile() - return SourceLocation.fromNode(sourceFile, node, this.program.getCurrentDirectory()) + return SourceLocation.fromNode(node, this.program.getCurrentDirectory()) } addStorageDeclaration(declaration: AppStorageDeclaration): void { @@ -213,17 +215,17 @@ class AwstBuildContextImpl implements AwstBuildContext { return undefined } - getStorageDefinitionsForContract(contractType: ContractClassPType): Map { + getStorageDefinitionsForContract(contractType: ContractClassPType): AppStorageDefinition[] { const result = new Map() for (const baseType of contractType.baseTypes) { - for (const [member, definition] of this.getStorageDefinitionsForContract(baseType)) { - if (result.has(member)) { + for (const definition of this.getStorageDefinitionsForContract(baseType)) { + if (result.has(definition.memberName)) { logger.error( definition.sourceLocation, - `Redefinition of app storage member, original declared in ${result.get(member)?.sourceLocation}`, + `Redefinition of app storage member, original declared in ${result.get(definition.memberName)?.sourceLocation}`, ) } - result.set(member, definition) + result.set(definition.memberName, definition) } } const localDeclarations = this.storageDeclarations.get(contractType.fullName) @@ -238,18 +240,20 @@ class AwstBuildContextImpl implements AwstBuildContext { result.set(member, declaration.definition) } } - return result + return Array.from(result.values()) } - addToCompilationSet(compilationTarget: ContractReference | LogicSigReference) { - if (this.#compilationSet.some((s) => s.id === compilationTarget.id)) { + addToCompilationSet(compilationTarget: ContractReference, contract: Index): void + addToCompilationSet(compilationTarget: LogicSigReference, logicSig: LogicSig): void + addToCompilationSet(compilationTarget: ContractReference | LogicSigReference, contractOrSig: Index | LogicSig) { + if (this.#compilationSet.has(compilationTarget)) { logger.debug(undefined, `${compilationTarget.id} already exists in compilation set`) return } - this.#compilationSet.push(compilationTarget) + this.#compilationSet.set(compilationTarget, contractOrSig) } get compilationSet() { - return this.#compilationSet.slice() + return this.#compilationSet } } diff --git a/src/awst_build/contract-method-visitor.ts b/src/awst_build/contract-method-visitor.ts index 39a3a893..e426aaec 100644 --- a/src/awst_build/contract-method-visitor.ts +++ b/src/awst_build/contract-method-visitor.ts @@ -1,18 +1,23 @@ -import type ts from 'typescript' -import type { ContractReference } from '../awst/models' +import ts from 'typescript' +import type { DefaultArgumentSource } from '../awst/models' +import { ARC4ABIMethodConfig, ARC4BareMethodConfig, ARC4CreateOption, ContractReference, OnCompletionAction } from '../awst/models' import * as awst from '../awst/nodes' -import { CodeError } from '../errors' -import { invariant } from '../util' +import type { SourceLocation } from '../awst/source-location' +import { Constants } from '../constants' +import { CodeError, TodoError } from '../errors' +import { logger } from '../logger' +import { codeInvariant, isIn } from '../util' +import { getArc4StructDef, getFunctionTypes, ptypeToArc4PType } from './arc4-util' import type { AwstBuildContext } from './context/awst-build-context' +import type { Arc4AbiDecoratorData, DecoratorData } from './decorator-visitor' +import { DecoratorVisitor } from './decorator-visitor' import type { NodeBuilder } from './eb' import { ContractSuperBuilder, ContractThisBuilder } from './eb/contract-builder' +import { isValidLiteralForPType } from './eb/util' import { FunctionVisitor } from './function-visitor' -import { ContractClassPType } from './ptypes' - -export type ContractMethodInfo = { - cref: ContractReference - arc4MethodConfig?: awst.ContractMethod['arc4MethodConfig'] -} +import type { FunctionPType } from './ptypes' +import { ContractClassPType, GlobalStateType } from './ptypes' +import { ARC4StructType } from './ptypes/arc4-types' export class ContractMethodBaseVisitor extends FunctionVisitor { visitSuperKeyword(node: ts.SuperExpression): NodeBuilder { @@ -36,22 +41,45 @@ export class ContractMethodBaseVisitor extends FunctionVisitor { export class ContractMethodVisitor extends ContractMethodBaseVisitor { private readonly _result: awst.ContractMethod + private readonly _contractType: ContractClassPType - constructor(ctx: AwstBuildContext, node: ts.MethodDeclaration, contractInfo: ContractMethodInfo) { + constructor(ctx: AwstBuildContext, node: ts.MethodDeclaration, contractType: ContractClassPType) { super(ctx, node) + this._contractType = contractType const sourceLocation = this.sourceLocation(node) const { args, body, documentation } = this.buildFunctionAwst(node) + const cref = ContractReference.fromPType(this._contractType) + + const decorators = (node.modifiers ?? []).flatMap((modifier) => { + if (!ts.isDecorator(modifier)) return [] + + return DecoratorVisitor.buildDecoratorData(this.context, modifier) + }) + + if (decorators.length > 1) { + logger.error( + sourceLocation, + 'Only one decorator is allowed per method. Multiple on complete actions can be provided in a single decorator', + ) + } + + const modifiers = this.parseMemberModifiers(node) + + const arc4MethodConfig = this.buildArc4Config({ + functionType: this._functionType, + decorator: decorators[0], + modifiers, + methodLocation: sourceLocation, + }) this._result = new awst.ContractMethod({ - arc4MethodConfig: contractInfo.arc4MethodConfig ?? null, + arc4MethodConfig: arc4MethodConfig ?? null, memberName: this._functionType.name, sourceLocation, args, returnType: this._functionType.returnType.wtypeOrThrow, body, - inheritable: true, - synthetic: false, - cref: contractInfo.cref, + cref, documentation, }) } @@ -63,10 +91,142 @@ export class ContractMethodVisitor extends ContractMethodBaseVisitor { public static buildContractMethod( parentCtx: AwstBuildContext, node: ts.MethodDeclaration, - contractMethodInfo: ContractMethodInfo, + contractType: ContractClassPType, ): awst.ContractMethod { - const result = new ContractMethodVisitor(parentCtx.createChildContext(), node, contractMethodInfo).result - invariant(result instanceof awst.ContractMethod, "result must be ContractMethod'") - return result + return new ContractMethodVisitor(parentCtx.createChildContext(), node, contractType).result + } + + private buildArc4Config({ + functionType, + decorator, + modifiers: { isPublic, isStatic }, + methodLocation, + }: { + functionType: FunctionPType + decorator: DecoratorData | undefined + modifiers: { isPublic: boolean; isStatic: boolean } + methodLocation: SourceLocation + }): awst.ContractMethod['arc4MethodConfig'] | null { + const isProgramMethod = isIn(functionType.name, [Constants.approvalProgramMethodName, Constants.clearStateProgramMethodName]) + + if (decorator && isIn(decorator.type, [Constants.arc4BareDecoratorName, Constants.arc4AbiDecoratorName])) { + if (!isPublic) { + logger.error(methodLocation, 'Private or protected methods cannot be exposed as an abi method') + return null + } + if (isStatic) { + logger.error(methodLocation, 'Static methods cannot be exposed as an abi method') + return null + } + if (isProgramMethod) { + logger.error(methodLocation, `${functionType.name} is reserved for program implementations and cannot be used as an abi method`) + return null + } + } + if (isProgramMethod || !isPublic || isStatic) return null + + if (decorator?.type === 'arc4.baremethod') { + return new ARC4BareMethodConfig({ + sourceLocation: decorator.sourceLocation, + allowedCompletionTypes: decorator.ocas, + create: decorator.create, + }) + } + + const funcTypes = getFunctionTypes(functionType, methodLocation) + + const mappedTypes = Object.entries(funcTypes).map(([n, t]) => [n, ptypeToArc4PType(t, methodLocation)]) + + const structs = Object.fromEntries( + mappedTypes + .filter((mappedType): mappedType is [string, ARC4StructType] => mappedType[1] instanceof ARC4StructType) + .map(([p, t]) => [p, getArc4StructDef(t)]), + ) + + if (decorator?.type === 'arc4.abimethod') { + return new ARC4ABIMethodConfig({ + sourceLocation: decorator.sourceLocation, + allowedCompletionTypes: decorator.ocas, + create: decorator.create, + name: decorator.nameOverride ?? functionType.name, + readonly: decorator.readonly, + defaultArgs: Object.fromEntries( + Object.entries(decorator.defaultArguments).map(([parameterName, argConfig]) => [ + parameterName, + this.buildDefaultArgument({ + methodName: functionType.name, + parameterName, + config: argConfig, + decoratorLocation: decorator.sourceLocation, + }), + ]), + ), + structs, + }) + } else if (isPublic && this._contractType.isARC4) { + return new ARC4ABIMethodConfig({ + sourceLocation: methodLocation, + allowedCompletionTypes: [OnCompletionAction.NoOp], + + create: ARC4CreateOption.Disallow, + name: functionType.name, + readonly: false, + defaultArgs: {}, + structs, + }) + } + return null + } + + private buildDefaultArgument({ + methodName, + parameterName, + config, + decoratorLocation, + }: { + methodName: string + parameterName: string + config: Arc4AbiDecoratorData['defaultArguments'][string] + decoratorLocation: SourceLocation + }): DefaultArgumentSource { + const [, paramType] = this._contractType.methods[methodName].parameters.find(([p]) => p === parameterName) ?? [undefined, undefined] + codeInvariant( + paramType, + `Default argument specification '${parameterName}' does not match any parameters on the target method`, + decoratorLocation, + ) + if (config.type === 'constant') { + codeInvariant(isValidLiteralForPType(config.value, paramType), `Literal cannot be converted to type ${paramType}`, decoratorLocation) + + return { + source: 'constant', + value: config.value, + } + } + const methodType = this._contractType.methods[config.name] + if (methodType) { + codeInvariant( + methodType.returnType.equals(paramType), + `Default argument specification for '${parameterName}' does not match parameter type`, + decoratorLocation, + ) + return { + source: 'abi-method', + memberName: config.name, + } + } + const propertyType = this._contractType.properties[config.name] + if (propertyType instanceof GlobalStateType) { + codeInvariant( + propertyType.contentType.equals(paramType), + `Default argument specification for '${parameterName}' does not match parameter type`, + decoratorLocation, + ) + return { + source: 'global-state', + memberName: config.name, + } + } + throw new TodoError('Unsupported default argument config') } } diff --git a/src/awst_build/contract-visitor.ts b/src/awst_build/contract-visitor.ts index 0f9d0117..bc638e9b 100644 --- a/src/awst_build/contract-visitor.ts +++ b/src/awst_build/contract-visitor.ts @@ -1,12 +1,10 @@ import ts from 'typescript' -import type { DefaultArgumentSource } from '../awst/models' -import { ARC4ABIMethodConfig, ARC4BareMethodConfig, ARC4CreateOption, ContractReference, OnCompletionAction } from '../awst/models' +import { ContractReference } from '../awst/models' import { nodeFactory } from '../awst/node-factory' import type * as awst from '../awst/nodes' import type { ContractMethod } from '../awst/nodes' -import { ContractFragment } from '../awst/nodes' import type { SourceLocation } from '../awst/source-location' -import { voidWType } from '../awst/wtypes' +import { wtypes } from '../awst/wtypes' import { Constants } from '../constants' import { AwstBuildFailureError, NotSupported, TodoError } from '../errors' import { logger } from '../logger' @@ -18,35 +16,29 @@ import { BaseVisitor } from './base-visitor' import { ConstructorVisitor } from './constructor-visitor' import type { AwstBuildContext } from './context/awst-build-context' import { ContractMethodVisitor } from './contract-method-visitor' -import type { Arc4AbiDecoratorData, DecoratorData } from './decorator-visitor' -import { DecoratorVisitor } from './decorator-visitor' import { ContractSuperBuilder } from './eb/contract-builder' import { BoxProxyExpressionBuilder } from './eb/storage/box' import { GlobalStateFunctionResultBuilder } from './eb/storage/global-state' import { LocalStateFunctionResultBuilder } from './eb/storage/local-state' -import { isValidLiteralForPType, requireInstanceBuilder } from './eb/util' -import { ContractClassPType, GlobalStateType } from './ptypes' +import { requireInstanceBuilder } from './eb/util' +import { Index } from './models' +import type { ContractClassPType } from './ptypes' export class ContractVisitor extends BaseVisitor implements Visitor { private _ctor?: ContractMethod - private _subroutines: ContractMethod[] = [] + private _methods: ContractMethod[] = [] private _approvalProgram: ContractMethod | null = null private _clearStateProgram: ContractMethod | null = null - private _className: string - private _contractPType: ContractClassPType + private readonly _contractPType: ContractClassPType private readonly _propertyInitialization: awst.Statement[] = [] - public readonly result: ContractFragment public accept = (node: TNode) => accept(this, node) - constructor(ctx: AwstBuildContext, classDec: ts.ClassDeclaration) { + constructor(ctx: AwstBuildContext, classDec: ts.ClassDeclaration, ptype: ContractClassPType) { super(ctx) const sourceLocation = this.context.getSourceLocation(classDec) codeInvariant(classDec.name, 'Anonymous classes are not supported for contracts', sourceLocation) - this._className = this.textVisitor.accept(classDec.name) - const contractPtype = this.context.getPTypeForNode(classDec) - invariant(contractPtype instanceof ContractClassPType, 'Contract PType must be ContractClassType') - this._contractPType = contractPtype + this._contractPType = ptype const isAbstract = Boolean(classDec.modifiers?.some((m) => m.kind === ts.SyntaxKind.AbstractKeyword)) @@ -61,17 +53,21 @@ export class ContractVisitor extends BaseVisitor implements Visitor ContractReference.fromPType(bt)), + description: null, + approvalProgram: this._contractPType.isARC4 ? null : this._approvalProgram, clearProgram: this._clearStateProgram, - bases: this.getBaseContracts(contractPtype), - id: cref, reservedScratchSpace: new Set(), sourceLocation: sourceLocation, stateTotals: { @@ -81,9 +77,15 @@ export class ContractVisitor extends BaseVisitor implements Visitor { - return [ - new ContractReference({ - className: baseType.name, - moduleName: baseType.module, - }), - ...this.getBaseContracts(baseType), - ] - }) - } - visitClassStaticBlockDeclaration(node: ts.ClassStaticBlockDeclaration): void { throw new TodoError('visitClassStaticBlockDeclaration') } @@ -149,207 +138,17 @@ export class ContractVisitor extends BaseVisitor implements Visitor p === parameterName) ?? [undefined, undefined] - codeInvariant( - paramType, - `Default argument specification '${parameterName}' does not match any parameters on the target method`, - decoratorLocation, - ) - if (config.type === 'constant') { - codeInvariant(isValidLiteralForPType(config.value, paramType), `Literal cannot be converted to type ${paramType}`, decoratorLocation) - - return { - source: 'constant', - value: config.value, - } - } - const methodType = this._contractPType.methods[config.name] - if (methodType) { - codeInvariant( - methodType.returnType.equals(paramType), - `Default argument specification for '${parameterName}' does not match parameter type`, - decoratorLocation, - ) - return { - source: 'abi-method', - memberName: config.name, - } - } - const propertyType = this._contractPType.properties[config.name] - if (propertyType instanceof GlobalStateType) { - codeInvariant( - propertyType.contentType.equals(paramType), - `Default argument specification for '${parameterName}' does not match parameter type`, - decoratorLocation, - ) - return { - source: 'global-state', - memberName: config.name, - } - } - throw new TodoError('Unsupported default argument config') - } - - private buildArc4Config({ - decorator, - methodName, - modifiers: { isPublic, isStatic }, - methodLocation, - }: { - methodName: string - decorator: DecoratorData | undefined - modifiers: { isPublic: boolean; isStatic: boolean } - methodLocation: SourceLocation - }): awst.ContractMethod['arc4MethodConfig'] { - if (decorator && [Constants.arc4BareDecoratorName, Constants.arc4AbiDecoratorName].includes(decorator.type)) { - if (!isPublic) { - logger.error(methodLocation, 'Private or protected methods cannot be exposed as an abi method') - } - if (isStatic) { - logger.error(methodLocation, 'Static methods cannot be exposed as an abi method') - } - } - - if (decorator?.type === 'arc4.baremethod') { - return new ARC4BareMethodConfig({ - sourceLocation: decorator.sourceLocation, - allowedCompletionTypes: decorator.ocas, - create: decorator.create, - }) - } else if (decorator?.type === 'arc4.abimethod') { - return new ARC4ABIMethodConfig({ - sourceLocation: decorator.sourceLocation, - allowedCompletionTypes: decorator.ocas, - create: decorator.create, - name: decorator.nameOverride ?? methodName, - readonly: decorator.readonly, - defaultArgs: Object.fromEntries( - Object.entries(decorator.defaultArguments).map(([parameterName, argConfig]) => [ - parameterName, - this.buildDefaultArgument({ - methodName, - parameterName, - config: argConfig, - decoratorLocation: decorator.sourceLocation, - }), - ]), - ), - structs: {}, // TODO - }) - } else if (isPublic && this._contractPType.isARC4) { - return new ARC4ABIMethodConfig({ - sourceLocation: methodLocation, - allowedCompletionTypes: [OnCompletionAction.NoOp], - - create: ARC4CreateOption.Disallow, - name: methodName, - readonly: false, - defaultArgs: {}, - structs: {}, // TODO - }) - } - return null - } - - private parseMemberModifiers(node: { modifiers?: readonly ts.ModifierLike[] }) { - let isPublic = true - let isStatic = false - if (node.modifiers) - for (const m of node.modifiers) { - switch (m.kind) { - case ts.SyntaxKind.StaticKeyword: - isStatic = true - continue - case ts.SyntaxKind.PublicKeyword: - isPublic = true - continue - case ts.SyntaxKind.ProtectedKeyword: - isPublic = false - continue - case ts.SyntaxKind.PrivateKeyword: - isPublic = false - continue - case ts.SyntaxKind.AbstractKeyword: - // TODO: Do we need to do anything here? - continue - case ts.SyntaxKind.AccessorKeyword: - logger.error(this.sourceLocation(m), 'properties are not supported') - continue - case ts.SyntaxKind.AsyncKeyword: - logger.error(this.sourceLocation(m), 'async keyword is not supported') - continue - case ts.SyntaxKind.DeclareKeyword: - logger.error(this.sourceLocation(m), 'declare keyword is not supported') - continue - case ts.SyntaxKind.ExportKeyword: - case ts.SyntaxKind.ConstKeyword: - case ts.SyntaxKind.DefaultKeyword: - case ts.SyntaxKind.ReadonlyKeyword: - case ts.SyntaxKind.OverrideKeyword: - case ts.SyntaxKind.InKeyword: - case ts.SyntaxKind.OutKeyword: - case ts.SyntaxKind.Decorator: - // Ignore for now - continue - } - } - return { - isStatic, - isPublic, - } - } - visitMethodDeclaration(node: ts.MethodDeclaration): void { - const sourceLocation = this.sourceLocation(node) - const methodName = this.textVisitor.accept(node.name) - - const decorators = (node.modifiers ?? []).flatMap((modifier) => { - if (!ts.isDecorator(modifier)) return [] - - return DecoratorVisitor.buildDecoratorData(this.context, modifier) - }) - - const modifiers = this.parseMemberModifiers(node) - - if (decorators.length > 1) { - logger.error( - sourceLocation, - 'Only one decorator is allowed per method. Multiple on complete actions can be provided in a single decorator', - ) - } - const cref = ContractReference.fromPType(this._contractPType) - switch (methodName) { + const contractMethod = ContractMethodVisitor.buildContractMethod(this.context, node, this._contractPType) + switch (contractMethod.memberName) { case Constants.approvalProgramMethodName: - if (decorators.length) logger.error(sourceLocation, `${Constants.approvalProgramMethodName} should not have a decorator`) - this._approvalProgram = ContractMethodVisitor.buildContractMethod(this.context, node, { cref }) + this._approvalProgram = contractMethod break case Constants.clearStateProgramMethodName: - if (decorators.length) logger.error(sourceLocation, `${Constants.clearStateProgramMethodName} should not have a decorator`) - this._clearStateProgram = ContractMethodVisitor.buildContractMethod(this.context, node, { cref }) + this._clearStateProgram = contractMethod break default: - this._subroutines.push( - ContractMethodVisitor.buildContractMethod(this.context, node, { - cref, - arc4MethodConfig: this.buildArc4Config({ - decorator: decorators[0], - methodName, - modifiers, - methodLocation: sourceLocation, - }), - }), - ) + this._methods.push(contractMethod) } } visitPropertyDeclaration(node: ts.PropertyDeclaration): void { @@ -397,7 +196,7 @@ export class ContractVisitor extends BaseVisitor implements Visitor, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [{ allowActions, onCreate }], } = parseFunctionArgs({ @@ -66,7 +66,7 @@ export class Arc4AbiMethodDecoratorBuilder extends NodeBuilder { return arc4AbiMethodDecorator } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [{ allowActions, onCreate, readonly, name, defaultArguments }], } = parseFunctionArgs({ diff --git a/src/awst_build/eb/arc4/arrays.ts b/src/awst_build/eb/arc4/arrays.ts index c3017ce3..c79969e1 100644 --- a/src/awst_build/eb/arc4/arrays.ts +++ b/src/awst_build/eb/arc4/arrays.ts @@ -1,11 +1,17 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' +import { IntegerConstant, StringConstant } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import { uint64WType } from '../../../awst/wtypes' -import { codeInvariant, invariant } from '../../../util' +import { wtypes } from '../../../awst/wtypes' +import { Constants } from '../../../constants' +import { wrapInCodeError } from '../../../errors' +import { logger } from '../../../logger' + +import { base32ToUint8Array, codeInvariant, invariant } from '../../../util' import type { PType } from '../../ptypes' -import { IterableIteratorType, NumericLiteralPType, TuplePType, uint64PType } from '../../ptypes' +import { accountPType, bytesPType, IterableIteratorType, NumericLiteralPType, stringPType, TuplePType, uint64PType } from '../../ptypes' import { + arc4AddressAlias, ARC4EncodedType, DynamicArrayConstructor, DynamicArrayType, @@ -14,17 +20,20 @@ import { } from '../../ptypes/arc4-types' import { instanceEb } from '../../type-registry' import type { InstanceBuilder } from '../index' -import { FunctionBuilder, InstanceExpressionBuilder, NodeBuilder } from '../index' +import { FunctionBuilder, NodeBuilder } from '../index' import { IterableIteratorExpressionBuilder } from '../iterable-iterator-expression-builder' +import { AccountExpressionBuilder } from '../reference/account' import { AtFunctionBuilder } from '../shared/at-function-builder' import { SliceFunctionBuilder } from '../shared/slice-function-builder' import { UInt64ExpressionBuilder } from '../uint64-expression-builder' import { requireExpressionOfType } from '../util' import { parseFunctionArgs } from '../util/arg-parsing' +import { Arc4EncodedBaseExpressionBuilder } from './base' export class DynamicArrayConstructorBuilder extends NodeBuilder { readonly ptype = DynamicArrayConstructor - newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + + newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { const { args: [...initialItems], ptypes: [elementType], @@ -51,7 +60,8 @@ export class DynamicArrayConstructorBuilder extends NodeBuilder { } export class StaticArrayConstructorBuilder extends NodeBuilder { readonly ptype = StaticArrayConstructor - newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + + newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { const { args: [...initialItems], ptypes: [elementType, arraySize], @@ -90,14 +100,92 @@ export class StaticArrayConstructorBuilder extends NodeBuilder { ) } } +export class AddressConstructorBuilder extends NodeBuilder { + readonly ptype = DynamicArrayConstructor + + newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + const { + args: [accountOrAddressOrBytes], + } = parseFunctionArgs({ + args, + typeArgs, + callLocation: sourceLocation, + funcName: 'Address constructor', + genericTypeArgs: 2, + argSpec: (a) => [a.optional(accountPType, stringPType, bytesPType)], + }) + if (!accountOrAddressOrBytes) { + return new AddressExpressionBuilder( + nodeFactory.addressConstant({ + value: Constants.zeroAddressEncoded, + sourceLocation, + wtype: arc4AddressAlias.wtype, + }), + arc4AddressAlias, + ) + } + + if (accountOrAddressOrBytes.ptype.equals(accountPType)) { + return new AddressExpressionBuilder( + nodeFactory.reinterpretCast({ + expr: accountOrAddressOrBytes.resolve(), + sourceLocation, + wtype: arc4AddressAlias.wtype, + }), + arc4AddressAlias, + ) + } else if (accountOrAddressOrBytes.ptype.equals(stringPType)) { + const value = accountOrAddressOrBytes.resolve() + if (value instanceof StringConstant) { + wrapInCodeError(() => base32ToUint8Array(value.value), value.sourceLocation) + return new AddressExpressionBuilder( + nodeFactory.addressConstant({ + value: value.value, + sourceLocation, + wtype: arc4AddressAlias.wtype, + }), + arc4AddressAlias, + ) + } + logger.error( + value.sourceLocation, + `Invalid address literal. Addresses should be ${Constants.encodedAddressLength} characters and not include base32 padding`, + ) + } + return new AddressExpressionBuilder( + nodeFactory.reinterpretCast({ + expr: accountOrAddressOrBytes.resolve(), + sourceLocation, + wtype: arc4AddressAlias.wtype, + }), + arc4AddressAlias, + ) + } +} export abstract class ArrayExpressionBuilder< TArrayType extends DynamicArrayType | StaticArrayType, -> extends InstanceExpressionBuilder { - iterate(sourceLocation: SourceLocation): Expression { +> extends Arc4EncodedBaseExpressionBuilder { + iterate(): Expression { return this.resolve() } + indexAccess(index: InstanceBuilder, sourceLocation: SourceLocation): NodeBuilder { + const indexExpr = requireExpressionOfType(index, uint64PType) + if (indexExpr instanceof IntegerConstant && this.ptype instanceof StaticArrayType && indexExpr.value >= this.ptype.arraySize) { + logger.error(index.sourceLocation, 'Index access out of bounds') + } + return instanceEb( + nodeFactory.indexExpression({ + base: this.resolve(), + sourceLocation: sourceLocation, + index: indexExpr, + wtype: this.ptype.elementType.wtype, + }), + this.ptype.elementType, + ) + } + memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder { switch (name) { case 'at': @@ -112,8 +200,11 @@ export abstract class ArrayExpressionBuilder< return new EntriesFunctionBuilder(this) case 'copy': return new CopyFunctionBuilder(this) - case 'slice': - return new SliceFunctionBuilder(this.resolve(), this.ptype) + case 'slice': { + const sliceResult = + this.ptype instanceof StaticArrayType ? new DynamicArrayType({ elementType: this.ptype.elementType }) : this.ptype + return new SliceFunctionBuilder(this.resolve(), sliceResult) + } } return super.memberAccess(name, sourceLocation) } @@ -124,7 +215,7 @@ class CopyFunctionBuilder extends FunctionBuilder { super(arrayBuilder.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { parseFunctionArgs({ args, typeArgs, genericTypeArgs: 0, argSpec: (a) => [], funcName: 'copy', callLocation: sourceLocation }) return instanceEb( nodeFactory.copy({ @@ -140,12 +231,12 @@ class EntriesFunctionBuilder extends FunctionBuilder { super(arrayBuilder.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { parseFunctionArgs({ args, typeArgs, callLocation: sourceLocation, argSpec: (_) => [], genericTypeArgs: 0, funcName: 'entries' }) const iteratorType = IterableIteratorType.parameterise([new TuplePType({ items: [uint64PType, this.arrayBuilder.ptype.elementType] })]) return new IterableIteratorExpressionBuilder( nodeFactory.enumeration({ - expr: this.arrayBuilder.iterate(sourceLocation), + expr: this.arrayBuilder.iterate(), sourceLocation, wtype: iteratorType.wtype, }), @@ -168,7 +259,7 @@ export class DynamicArrayExpressionBuilder extends ArrayExpressionBuilder { + constructor(expr: Expression, ptype: PType) { + invariant(ptype instanceof StaticArrayType, 'ptype must be instance of StaticArrayType') + invariant(ptype.equals(arc4AddressAlias), 'ptype must be arc4AddressAlias') + super(expr, ptype) + } + + memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder { + switch (name) { + case 'length': + return new UInt64ExpressionBuilder(nodeFactory.uInt64Constant({ value: this.ptype.arraySize, sourceLocation })) + case 'native': + return new AccountExpressionBuilder(this.toBytes(sourceLocation)) + } + return super.memberAccess(name, sourceLocation) + } +} export class ArrayPushFunctionBuilder extends FunctionBuilder { constructor(private arrayBuilder: ArrayExpressionBuilder) { super(arrayBuilder.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const elementType = this.arrayBuilder.ptype.elementType const { args: [...items], } = parseFunctionArgs({ args, typeArgs, - funcName: 'at', + funcName: 'push', callLocation: sourceLocation, genericTypeArgs: 0, argSpec: (a) => [a.required(elementType), ...args.slice(1).map(() => a.required(elementType))], @@ -232,7 +340,7 @@ export class ArrayPopFunctionBuilder extends FunctionBuilder { super(arrayBuilder.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const elementType = this.arrayBuilder.ptype.elementType parseFunctionArgs({ args, diff --git a/src/awst_build/eb/arc4/base.ts b/src/awst_build/eb/arc4/base.ts new file mode 100644 index 00000000..370bed92 --- /dev/null +++ b/src/awst_build/eb/arc4/base.ts @@ -0,0 +1,84 @@ +import { nodeFactory } from '../../../awst/node-factory' +import type { Expression } from '../../../awst/nodes' +import { EqualityComparison } from '../../../awst/nodes' +import type { SourceLocation } from '../../../awst/source-location' +import { wtypes } from '../../../awst/wtypes' +import { CodeError } from '../../../errors' +import type { PType } from '../../ptypes' +import type { ARC4EncodedType } from '../../ptypes/arc4-types' +import { BooleanExpressionBuilder } from '../boolean-expression-builder' +import { BytesExpressionBuilder } from '../bytes-expression-builder' +import type { InstanceBuilder, NodeBuilder } from '../index' +import { BuilderComparisonOp, FunctionBuilder, InstanceExpressionBuilder } from '../index' +import { parseFunctionArgs } from '../util/arg-parsing' + +export class Arc4EncodedBaseExpressionBuilder extends InstanceExpressionBuilder { + constructor(expr: Expression, ptype: T) { + super(expr, ptype) + } + + compare(other: InstanceBuilder, op: BuilderComparisonOp, sourceLocation: SourceLocation): InstanceBuilder { + switch (op) { + case BuilderComparisonOp.eq: + case BuilderComparisonOp.ne: + throw new CodeError(`${op} operator is not supported on ${this.typeDescription}. Use 'equals' method instead`, { sourceLocation }) + } + return super.compare(other, op, sourceLocation) + } + + // + // compare(other: InstanceBuilder, op: BuilderBinaryOp, sourceLocation: SourceLocation): InstanceBuilder { + // switch (op) { + // case Bu + // } + // return super.binaryOp(other, op, sourceLocation); + // } + + memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder { + switch (name) { + case 'bytes': + return new BytesExpressionBuilder(this.toBytes(sourceLocation)) + case 'equals': + return new Arc4EqualsFunctionBuilder(this, sourceLocation) + } + return super.memberAccess(name, sourceLocation) + } + + toBytes(sourceLocation: SourceLocation): Expression { + return nodeFactory.reinterpretCast({ + expr: this.resolve(), + wtype: wtypes.bytesWType, + sourceLocation, + }) + } +} + +class Arc4EqualsFunctionBuilder extends FunctionBuilder { + constructor( + private left: Arc4EncodedBaseExpressionBuilder, + sourceLocation: SourceLocation, + ) { + super(sourceLocation) + } + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + const { + args: [right], + } = parseFunctionArgs({ + args, + typeArgs, + genericTypeArgs: 0, + callLocation: sourceLocation, + funcName: 'equals', + argSpec: (a) => [a.required(this.left.ptype)], + }) + return new BooleanExpressionBuilder( + nodeFactory.bytesComparisonExpression({ + operator: EqualityComparison.eq, + lhs: this.left.toBytes(sourceLocation), + rhs: right.toBytes(sourceLocation), + sourceLocation, + }), + ) + } +} diff --git a/src/awst_build/eb/arc4/uint-n-constructor-builder.ts b/src/awst_build/eb/arc4/uint-n-constructor-builder.ts index cb6db5c7..3278cb61 100644 --- a/src/awst_build/eb/arc4/uint-n-constructor-builder.ts +++ b/src/awst_build/eb/arc4/uint-n-constructor-builder.ts @@ -3,21 +3,24 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import { IntegerConstant } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' +import { CodeError } from '../../../errors' import { bigIntToUint8Array, codeInvariant, invariant } from '../../../util' import type { PType } from '../../ptypes' import { biguintPType, NumericLiteralPType, uint64PType } from '../../ptypes' -import { UintNType } from '../../ptypes/arc4-types' +import { arc4ByteAlias, UintNType } from '../../ptypes/arc4-types' import { instanceEb } from '../../type-registry' import type { InstanceBuilder } from '../index' -import { InstanceExpressionBuilder, NodeBuilder } from '../index' +import { NodeBuilder } from '../index' import { isValidLiteralForPType } from '../util' import { parseFunctionArgs } from '../util/arg-parsing' +import { Arc4EncodedBaseExpressionBuilder } from './base' export class UintNConstructorBuilder extends NodeBuilder { get ptype(): undefined { return undefined } - newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + + newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { const { ptypes: [size], args: [initialValueBuilder], @@ -36,68 +39,95 @@ export class UintNConstructorBuilder extends NodeBuilder { ) const ptype = new UintNType({ n: size.literalValue }) - if (initialValueBuilder === undefined) { + return newUintN(initialValueBuilder, ptype, sourceLocation) + } +} + +export class ByteConstructorBuilder extends NodeBuilder { + get ptype(): undefined { + return undefined + } + + newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + const { + args: [initialValueBuilder], + } = parseFunctionArgs({ + args, + typeArgs, + genericTypeArgs: 1, + funcName: 'Byte constructor', + argSpec: (a) => [a.optional()], + callLocation: sourceLocation, + }) + + return newUintN(initialValueBuilder, arc4ByteAlias, sourceLocation) + } +} + +function newUintN(initialValueBuilder: InstanceBuilder | undefined, ptype: UintNType, sourceLocation: SourceLocation) { + if (initialValueBuilder === undefined) { + return new UintNExpressionBuilder( + nodeFactory.integerConstant({ + value: 0n, + tealAlias: null, + wtype: ptype.wtype, + sourceLocation: sourceLocation, + }), + ptype, + ) + } + if (initialValueBuilder.resolvableToPType(uint64PType)) { + const initialValue = initialValueBuilder.resolveToPType(uint64PType).resolve() + if (initialValue instanceof IntegerConstant) { + codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}`) + return new UintNExpressionBuilder( + nodeFactory.integerConstant({ + value: initialValue.value, + wtype: ptype.wtype, + tealAlias: null, + sourceLocation: sourceLocation, + }), + ptype, + ) + } else { + return new UintNExpressionBuilder( + nodeFactory.aRC4Encode({ + wtype: ptype.wtype, + sourceLocation, + value: initialValue, + }), + ptype, + ) + } + } + + if (initialValueBuilder.resolvableToPType(biguintPType)) { + const initialValue = initialValueBuilder.resolveToPType(biguintPType).resolve() + if (initialValue instanceof IntegerConstant) { + codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}`) return new UintNExpressionBuilder( nodeFactory.bytesConstant({ - value: new Uint8Array([0]), + value: bigIntToUint8Array(initialValue.value), wtype: ptype.wtypeOrThrow, sourceLocation: sourceLocation, }), ptype, ) + } else { + return new UintNExpressionBuilder( + nodeFactory.aRC4Encode({ + wtype: ptype.wtype, + sourceLocation, + value: initialValue, + }), + ptype, + ) } - if (initialValueBuilder.resolvableToPType(uint64PType)) { - const initialValue = initialValueBuilder.resolveToPType(uint64PType).resolve() - if (initialValue instanceof IntegerConstant) { - codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}`) - return new UintNExpressionBuilder( - nodeFactory.bytesConstant({ - value: bigIntToUint8Array(initialValue.value), - wtype: ptype.wtypeOrThrow, - sourceLocation: sourceLocation, - }), - ptype, - ) - } else { - return new UintNExpressionBuilder( - nodeFactory.aRC4Encode({ - wtype: ptype.wtype, - sourceLocation, - value: initialValue, - }), - ptype, - ) - } - } - - if (initialValueBuilder.resolvableToPType(biguintPType)) { - const initialValue = initialValueBuilder.resolveToPType(biguintPType).resolve() - if (initialValue instanceof IntegerConstant) { - codeInvariant(isValidLiteralForPType(initialValue.value, ptype), `${initialValue.value} cannot be converted to ${ptype}`) - return new UintNExpressionBuilder( - nodeFactory.bytesConstant({ - value: bigIntToUint8Array(initialValue.value), - wtype: ptype.wtypeOrThrow, - sourceLocation: sourceLocation, - }), - ptype, - ) - } else { - return new UintNExpressionBuilder( - nodeFactory.aRC4Encode({ - wtype: ptype.wtype, - sourceLocation, - value: initialValue, - }), - ptype, - ) - } - } - - return super.newCall(args, typeArgs, sourceLocation) } + throw CodeError.unexpectedUnhandledArgs({ sourceLocation }) } -export class UintNExpressionBuilder extends InstanceExpressionBuilder { + +export class UintNExpressionBuilder extends Arc4EncodedBaseExpressionBuilder { constructor(expr: Expression, ptype: PType) { invariant(ptype instanceof UintNType, 'ptype must be instance of UIntNType') super(expr, ptype) diff --git a/src/awst_build/eb/assert-function-builder.ts b/src/awst_build/eb/assert-function-builder.ts index 4fe165b0..a0cce60c 100644 --- a/src/awst_build/eb/assert-function-builder.ts +++ b/src/awst_build/eb/assert-function-builder.ts @@ -5,14 +5,14 @@ import { CodeError } from '../../errors' import { invariant } from '../../util' import type { PType } from '../ptypes' import { stringPType } from '../ptypes' -import type { InstanceBuilder } from './index' +import type { NodeBuilder } from './index' import { FunctionBuilder } from './index' import { requireConstantOfType, requireStringConstant } from './util' import { parseFunctionArgs } from './util/arg-parsing' import { VoidExpressionBuilder } from './void-expression-builder' export class AssertFunctionBuilder extends FunctionBuilder { - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const [condition, message, ...rest] = args if (rest.length !== 0) { throw CodeError.unexpectedUnhandledArgs({ sourceLocation }) @@ -39,7 +39,7 @@ export class AssertFunctionBuilder extends FunctionBuilder { } export class ErrFunctionBuilder extends FunctionBuilder { - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [message], } = parseFunctionArgs({ diff --git a/src/awst_build/eb/assert-match-function-builder.ts b/src/awst_build/eb/assert-match-function-builder.ts index 44232387..e5571053 100644 --- a/src/awst_build/eb/assert-match-function-builder.ts +++ b/src/awst_build/eb/assert-match-function-builder.ts @@ -18,7 +18,7 @@ import { VoidExpressionBuilder } from './void-expression-builder' export class AssertMatchFunctionBuilder extends NodeBuilder { readonly ptype = assertMatchFunction - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [subject, tests, comment], } = parseFunctionArgs({ @@ -27,8 +27,9 @@ export class AssertMatchFunctionBuilder extends NodeBuilder { callLocation: sourceLocation, genericTypeArgs: 1, funcName: 'assertMatch', - argSpec: (a) => [a.required(), a.required(), a.optional(stringPType)], + argSpec: (a) => [a.passthrough(), a.required(), a.optional(stringPType)], }) + codeInvariant(subject, 'subject parameter is missing', sourceLocation) codeInvariant(tests instanceof ObjectLiteralExpressionBuilder, 'Test conditions must be an object literal', tests.sourceLocation) diff --git a/src/awst_build/eb/biguint-expression-builder.ts b/src/awst_build/eb/biguint-expression-builder.ts index 9796720e..47182a08 100644 --- a/src/awst_build/eb/biguint-expression-builder.ts +++ b/src/awst_build/eb/biguint-expression-builder.ts @@ -4,14 +4,15 @@ import { nodeFactory } from '../../awst/node-factory' import type { Expression } from '../../awst/nodes' import { BigUIntBinaryOperator, BigUIntPostfixUnaryOperator, IntegerConstant, NumericComparison } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' -import { bytesWType } from '../../awst/wtypes' +import { wtypes } from '../../awst/wtypes' + import { NotSupported } from '../../errors' import { logger } from '../../logger' import { tryConvertEnum } from '../../util' import type { InstanceType, PType } from '../ptypes' import { BigUintFunction, biguintPType, boolPType, bytesPType, stringPType, uint64PType } from '../ptypes' import { instanceEb } from '../type-registry' -import type { InstanceBuilder } from './index' +import type { InstanceBuilder, NodeBuilder } from './index' import { BuilderBinaryOp, BuilderComparisonOp, BuilderUnaryOp, FunctionBuilder, InstanceExpressionBuilder } from './index' import { UInt64ExpressionBuilder } from './uint64-expression-builder' import { requireExpressionOfType } from './util' @@ -20,7 +21,7 @@ import { parseFunctionArgs } from './util/arg-parsing' export class BigUintFunctionBuilder extends FunctionBuilder { readonly ptype = BigUintFunction - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [initialValue], } = parseFunctionArgs({ @@ -197,17 +198,7 @@ export class BigUintExpressionBuilder extends InstanceExpressionBuilder, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [value], } = parseFunctionArgs({ diff --git a/src/awst_build/eb/bytes-expression-builder.ts b/src/awst_build/eb/bytes-expression-builder.ts index c617db63..b3001b6f 100644 --- a/src/awst_build/eb/bytes-expression-builder.ts +++ b/src/awst_build/eb/bytes-expression-builder.ts @@ -1,11 +1,12 @@ import type { awst } from '../../awst' -import { wtypes } from '../../awst' + import { intrinsicFactory } from '../../awst/intrinsic-factory' import { nodeFactory } from '../../awst/node-factory' import type { Expression } from '../../awst/nodes' import { BytesBinaryOperator, BytesConstant, BytesEncoding, BytesUnaryOperator, IntegerConstant, StringConstant } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' -import { stringWType } from '../../awst/wtypes' +import { wtypes } from '../../awst/wtypes' + import { CodeError, wrapInCodeError } from '../../errors' import { logger } from '../../logger' import { base32ToUint8Array, base64ToUint8Array, hexToUint8Array, uint8ArrayToUtf8, utf8ToUint8Array } from '../../util' @@ -69,7 +70,7 @@ export class BytesFunctionBuilder extends FunctionBuilder { return new BytesExpressionBuilder(result) } - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [initialValue], } = parseFunctionArgs({ @@ -148,7 +149,8 @@ class FromEncodingBuilder extends FunctionBuilder { ) { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const [value] = requireExpressionsOfType(args, [stringPType], sourceLocation) if (value instanceof StringConstant) { @@ -232,7 +234,7 @@ export class BytesExpressionBuilder extends InstanceExpressionBuilder, typeArgs: ReadonlyArray, sourceLocation: SourceLocation) { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const [other] = requireExpressionsOfType(args, [bytesPType], sourceLocation) return new BytesExpressionBuilder( intrinsicFactory.bytesConcat({ diff --git a/src/awst_build/eb/contract-builder.ts b/src/awst_build/eb/contract-builder.ts index 384274cb..0ec6538e 100644 --- a/src/awst_build/eb/contract-builder.ts +++ b/src/awst_build/eb/contract-builder.ts @@ -2,7 +2,7 @@ import { nodeFactory } from '../../awst/node-factory' import type { Expression, LValue } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' -import { voidWType } from '../../awst/wtypes' +import { wtypes } from '../../awst/wtypes' import { Constants } from '../../constants' import { CodeError } from '../../errors' import { codeInvariant } from '../../util' @@ -12,7 +12,7 @@ import { arc4BaseContractType, baseContractType, StorageProxyPType } from '../pt import { instanceEb } from '../type-registry' -import { ContractMethodExpressionBuilder } from './free-subroutine-expression-builder' +import { BaseContractMethodExpressionBuilder, ContractMethodExpressionBuilder } from './free-subroutine-expression-builder' import type { NodeBuilder } from './index' import { InstanceBuilder } from './index' import { VoidExpressionBuilder } from './void-expression-builder' @@ -28,7 +28,7 @@ export class ContractThisBuilder extends InstanceBuilder { constructor( ptype: ContractClassPType, sourceLocation: SourceLocation, - private context: AwstBuildContext, + protected context: AwstBuildContext, ) { super(sourceLocation) this.#ptype = ptype @@ -60,7 +60,7 @@ export class ContractSuperBuilder extends ContractThisBuilder { super(ptype, sourceLocation, context) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { if (this.ptype.equals(baseContractType) || this.ptype.equals(arc4BaseContractType)) { // Contract base types have no code to execute so we can just return void return new VoidExpressionBuilder(nodeFactory.voidConstant({ sourceLocation })) @@ -74,8 +74,16 @@ export class ContractSuperBuilder extends ContractThisBuilder { }), args: [], sourceLocation, - wtype: voidWType, + wtype: wtypes.voidWType, }), ) } + + memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder { + const method = this.ptype.methods[name] + if (method) { + return new BaseContractMethodExpressionBuilder(sourceLocation, method, this.ptype) + } + return super.memberAccess(name, sourceLocation) + } } diff --git a/src/awst_build/eb/ensure-budget.ts b/src/awst_build/eb/ensure-budget.ts index 3861a337..6564ccfb 100644 --- a/src/awst_build/eb/ensure-budget.ts +++ b/src/awst_build/eb/ensure-budget.ts @@ -1,10 +1,10 @@ import { nodeFactory } from '../../awst/node-factory' import { PuyaLibFunction } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' -import { voidWType } from '../../awst/wtypes' +import { wtypes } from '../../awst/wtypes' import type { PType } from '../ptypes' import { ensureBudgetFunction, opUpFeeSourceType, uint64PType } from '../ptypes' -import type { InstanceBuilder, NodeBuilder } from './index' +import type { NodeBuilder } from './index' import { FunctionBuilder } from './index' import { requireExpressionOfType } from './util' import { parseFunctionArgs } from './util/arg-parsing' @@ -12,7 +12,8 @@ import { VoidExpressionBuilder } from './void-expression-builder' export class EnsureBudgetFunctionBuilder extends FunctionBuilder { readonly ptype = ensureBudgetFunction - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [budget, feeSource], } = parseFunctionArgs({ @@ -40,7 +41,7 @@ export class EnsureBudgetFunctionBuilder extends FunctionBuilder { }), ], sourceLocation, - wtype: voidWType, + wtype: wtypes.voidWType, }), ) } diff --git a/src/awst_build/eb/free-subroutine-expression-builder.ts b/src/awst_build/eb/free-subroutine-expression-builder.ts index f239fc98..d030c9ce 100644 --- a/src/awst_build/eb/free-subroutine-expression-builder.ts +++ b/src/awst_build/eb/free-subroutine-expression-builder.ts @@ -5,7 +5,7 @@ import { InternalError } from '../../errors' import type { ContractClassPType, PType } from '../ptypes' import { FunctionPType } from '../ptypes' import { typeRegistry } from '../type-registry' -import type { InstanceBuilder } from './index' +import type { NodeBuilder } from './index' import { FunctionBuilder } from './index' import { parseFunctionArgs } from './util/arg-parsing' @@ -18,7 +18,7 @@ abstract class SubroutineExpressionBuilder extends FunctionBuilder { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: mappedArgs } = parseFunctionArgs({ args, typeArgs, diff --git a/src/awst_build/eb/index.ts b/src/awst_build/eb/index.ts index ff65eead..3a84b5d2 100644 --- a/src/awst_build/eb/index.ts +++ b/src/awst_build/eb/index.ts @@ -58,13 +58,13 @@ export abstract class NodeBuilder { return this.constructor.name } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { throw new NotSupported(`Calling ${this.typeDescription}`, { sourceLocation, }) } - newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + newCall(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { throw new NotSupported(`Calling ${this.typeDescription} with the new keyword`, { sourceLocation }) } @@ -74,6 +74,10 @@ export abstract class NodeBuilder { }) } + hasProperty(_name: string): boolean { + throw new NotSupported(`Has property checks on ${this.typeDescription}`) + } + memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder { throw new NotSupported(`Accessing member ${name} on ${this.typeDescription}`, { sourceLocation, @@ -106,7 +110,7 @@ export abstract class InstanceBuilder extends Node } resolveToPType(ptype: PTypeOrClass): InstanceBuilder { - if (this.resolvableToPType(ptype)) { + if (this.ptype.equalsOrInstanceOf(ptype)) { return this } throw CodeError.cannotResolveToType({ sourceType: this.ptype, targetType: ptype, sourceLocation: this.sourceLocation }) @@ -172,10 +176,6 @@ export abstract class InstanceBuilder extends Node sourceLocation, }) } - - hasProperty(_name: string): boolean { - throw new NotSupported(`Has property checks on ${this.typeDescription}`) - } } export abstract class FunctionBuilder extends NodeBuilder { @@ -185,7 +185,7 @@ export abstract class FunctionBuilder extends NodeBuilder { super(location) } - abstract call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder + abstract call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder } export abstract class ParameterlessFunctionBuilder extends FunctionBuilder { @@ -196,7 +196,7 @@ export abstract class ParameterlessFunctionBuilder extends FunctionBuilder { super(expression.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { if (args.length) logger.error(sourceLocation, 'Function expects no arguments') if (typeArgs.length) logger.error(sourceLocation, 'Function expects type arguments') return this.definition(this.expression, sourceLocation) diff --git a/src/awst_build/eb/literal-expression-builder.ts b/src/awst_build/eb/literal-expression-builder.ts index 7c6d00fd..3df240c8 100644 --- a/src/awst_build/eb/literal-expression-builder.ts +++ b/src/awst_build/eb/literal-expression-builder.ts @@ -29,10 +29,6 @@ export abstract class LiteralExpressionBuilder extends InstanceBuilder { this.throwInvalidExpression() } - assign(other: InstanceBuilder, sourceLocation: SourceLocation): InstanceBuilder { - this.throwInvalidExpression() - } - binaryOp(other: InstanceBuilder, op: BuilderBinaryOp, sourceLocation: SourceLocation): InstanceBuilder { this.throwInvalidExpression() } @@ -41,7 +37,7 @@ export abstract class LiteralExpressionBuilder extends InstanceBuilder { this.throwInvalidExpression() } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { this.throwInvalidExpression() } diff --git a/src/awst_build/eb/literal/conditional-expression-builder.ts b/src/awst_build/eb/literal/conditional-expression-builder.ts index 92b14364..f1903c02 100644 --- a/src/awst_build/eb/literal/conditional-expression-builder.ts +++ b/src/awst_build/eb/literal/conditional-expression-builder.ts @@ -1,7 +1,8 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import { boolWType } from '../../../awst/wtypes' +import { wtypes } from '../../../awst/wtypes' + import type { PType, PTypeOrClass } from '../../ptypes' import { typeRegistry } from '../../type-registry' import type { InstanceBuilder } from '../index' @@ -24,7 +25,7 @@ export class ConditionalExpressionBuilder extends LiteralExpressionBuilder { falseExpr: this.whenFalse.boolEval(sourceLocation, negate), trueExpr: this.whenTrue.boolEval(sourceLocation, negate), condition: this.condition, - wtype: boolWType, + wtype: wtypes.boolWType, }) } diff --git a/src/awst_build/eb/literal/object-expression-builder.ts b/src/awst_build/eb/literal/object-expression-builder.ts index 8d2105e2..79fb29a5 100644 --- a/src/awst_build/eb/literal/object-expression-builder.ts +++ b/src/awst_build/eb/literal/object-expression-builder.ts @@ -23,10 +23,11 @@ export class ObjectExpressionBuilder extends InstanceExpressionBuilder requireExpressionOfType(base.memberAccess(prop, this.sourceLocation), propType)), + wtype: ptype.wtype, }), ptype, ) diff --git a/src/awst_build/eb/literal/object-literal-expression-builder.ts b/src/awst_build/eb/literal/object-literal-expression-builder.ts index d97d612d..dbcf1723 100644 --- a/src/awst_build/eb/literal/object-literal-expression-builder.ts +++ b/src/awst_build/eb/literal/object-literal-expression-builder.ts @@ -2,7 +2,6 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression, LValue } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' import { CodeError } from '../../../errors' -import { codeInvariant } from '../../../util' import type { PTypeOrClass } from '../../ptypes' import { ObjectPType } from '../../ptypes' import type { InstanceBuilder } from '../index' @@ -44,6 +43,7 @@ export class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder { return nodeFactory.tupleExpression({ items: this.ptype.orderedProperties().map(([p, propPType]) => this.memberAccess(p, this.sourceLocation).resolveLValue()), sourceLocation: this.sourceLocation, + wtype: this.ptype.wtype, }) } memberAccess(name: string, sourceLocation: SourceLocation): InstanceBuilder { @@ -66,15 +66,40 @@ export class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder { } private toTuple(ptype: ObjectPType): Expression { + let base: InstanceBuilder + if (this.ptype.equals(ptype)) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + base = this + } else { + // Resolve this object to a tuple using declared order but using the target property types. + // This will resolve numeric literals to algo-ts types if available + const tempType = new ObjectPType({ + name: undefined, + properties: Object.fromEntries(this.ptype.orderedProperties().map(([p]) => [p, ptype.getPropertyType(p)] as const)), + }) + + base = new ObjectExpressionBuilder( + nodeFactory.tupleExpression({ + items: tempType + .orderedProperties() + .map(([p, propType]) => requireExpressionOfType(this.memberAccess(p, this.sourceLocation), propType)), + sourceLocation: this.sourceLocation, + wtype: tempType.wtype, + }), + tempType, + ).singleEvaluation() + } + // Reorder properties to the target type return nodeFactory.tupleExpression({ items: ptype .orderedProperties() - .map(([p, propPType]) => requireExpressionOfType(this.memberAccess(p, this.sourceLocation), propPType)), + .map(([p, propPType]) => requireExpressionOfType(base.memberAccess(p, this.sourceLocation), propPType)), sourceLocation: this.sourceLocation, + wtype: ptype.wtype, }) } - resolvableToPType(ptype: PTypeOrClass): boolean { + resolvableToPType(ptype: PTypeOrClass): ptype is ObjectPType { if (!(ptype instanceof ObjectPType)) return false for (const [prop, propPType] of ptype.orderedProperties()) { if (!this.hasProperty(prop)) return false @@ -85,32 +110,8 @@ export class ObjectLiteralExpressionBuilder extends LiteralExpressionBuilder { } resolveToPType(ptype: PTypeOrClass): InstanceBuilder { - codeInvariant(ptype instanceof ObjectPType, `Object literal cannot be resolved to type ${ptype}`, this.sourceLocation) + if (!this.resolvableToPType(ptype)) + throw new CodeError(`${this.typeDescription} cannot be resolved to ${ptype}`, { sourceLocation: this.sourceLocation }) return new ObjectExpressionBuilder(this.toTuple(ptype), ptype) } - - assign(other: InstanceBuilder, sourceLocation: SourceLocation): InstanceBuilder { - const sourceType = other.ptype - codeInvariant(sourceType instanceof ObjectPType, 'Assignment source must be an object type') - const source = other.resolve() - - const targets: LValue[] = [] - for (const [sourceProp, sourcePropType] of sourceType.orderedProperties()) { - if (this.hasProperty(sourceProp)) { - targets.push(this.memberAccess(sourceProp, sourceLocation).resolveLValue()) - } else { - targets.push( - nodeFactory.varExpression({ name: this.generateDiscardedVarName(), sourceLocation, wtype: sourcePropType.wtypeOrThrow }), - ) - } - } - return new ObjectExpressionBuilder( - nodeFactory.assignmentExpression({ - target: nodeFactory.tupleExpression({ items: targets, sourceLocation }), - value: source, - sourceLocation, - }), - sourceType, - ) - } } diff --git a/src/awst_build/eb/log-function-builder.ts b/src/awst_build/eb/log-function-builder.ts index 2bf82935..f30f064a 100644 --- a/src/awst_build/eb/log-function-builder.ts +++ b/src/awst_build/eb/log-function-builder.ts @@ -1,18 +1,19 @@ import type { awst } from '../../awst' -import { wtypes } from '../../awst' + import { intrinsicFactory } from '../../awst/intrinsic-factory' import { nodeFactory } from '../../awst/node-factory' import type { Expression } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' +import { wtypes } from '../../awst/wtypes' import { CodeError, InternalError, throwError } from '../../errors' import type { PType } from '../ptypes' -import type { InstanceBuilder } from './index' +import type { NodeBuilder } from './index' import { FunctionBuilder } from './index' import { requireInstanceBuilder } from './util' import { VoidExpressionBuilder } from './void-expression-builder' export class LogFunctionBuilder extends FunctionBuilder { - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const argsExps = args.map((a) => requireInstanceBuilder(a)) let logBytes: awst.Expression diff --git a/src/awst_build/eb/op-module-builder.ts b/src/awst_build/eb/op-module-builder.ts index b27080c4..13617dcc 100644 --- a/src/awst_build/eb/op-module-builder.ts +++ b/src/awst_build/eb/op-module-builder.ts @@ -8,8 +8,7 @@ import { OP_METADATA } from '../op-metadata' import type { PType } from '../ptypes' import { IntrinsicEnumType, IntrinsicFunctionGroupType, IntrinsicFunctionType, stringPType } from '../ptypes' import { typeRegistry } from '../type-registry' -import type { InstanceBuilder } from './index' -import { FunctionBuilder, NodeBuilder } from './index' +import { FunctionBuilder, InstanceExpressionBuilder, NodeBuilder } from './index' import { requestConstantOfType, requestExpressionOfType } from './util' export class IntrinsicOpGroupBuilder extends NodeBuilder { @@ -23,6 +22,11 @@ export class IntrinsicOpGroupBuilder extends NodeBuilder { invariant(metaData.type === 'op-grouping', 'ptype must map to op-grouping') this.opGrouping = metaData } + + hasProperty(name: string): boolean { + return Object.hasOwn(this.opGrouping.ops, name) + } + memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder { if (!Object.hasOwn(this.opGrouping.ops, name)) { return super.memberAccess(name, sourceLocation) @@ -68,7 +72,7 @@ abstract class IntrinsicOpBuilderBase extends FunctionBuilder { super(sourceLocation) } - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { signatureLoop: for (const [index, sig] of enumerate(this.opMapping.signatures)) { const isLastSig = index + 1 >= this.opMapping.signatures.length if (args.length !== sig.argNames.length) { @@ -158,3 +162,14 @@ export class GroupedIntrinsicOpBuilder extends IntrinsicOpBuilderBase { super(sourceLocation, opMapping) } } + +/** + * Builder for expressions which have the 'type' of an intrinsic function or group but are not the singleton instance + * imported from @algorandfoundat/algorand-typescript. This is not supported. + */ +export class IntrinsicOpGroupOrFunctionTypeBuilder extends InstanceExpressionBuilder { + constructor(expr: Expression, ptype: PType) { + super(expr, ptype) + throw new CodeError('Invalid alias of op function or group type', { sourceLocation: expr.sourceLocation }) + } +} diff --git a/src/awst_build/eb/reference/account.ts b/src/awst_build/eb/reference/account.ts index 9b6f300f..712a41ef 100644 --- a/src/awst_build/eb/reference/account.ts +++ b/src/awst_build/eb/reference/account.ts @@ -1,7 +1,7 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import { boolWType, bytesWType, uint64WType, WTuple } from '../../../awst/wtypes' +import { wtypes } from '../../../awst/wtypes' import type { PType } from '../../ptypes' import { accountPType, applicationPType, assetPType, bytesPType, uint64PType } from '../../ptypes' import { BooleanExpressionBuilder } from '../boolean-expression-builder' @@ -13,7 +13,7 @@ import { compareBytes } from '../util/compare-bytes' import { ReferenceTypeExpressionBuilder } from './base' export class AccountFunctionBuilder extends FunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [addressBytes], } = parseFunctionArgs({ @@ -86,7 +86,7 @@ export class AccountExpressionBuilder extends ReferenceTypeExpressionBuilder { toBytes(sourceLocation: SourceLocation): Expression { return nodeFactory.reinterpretCast({ expr: this._expr, - wtype: bytesWType, + wtype: wtypes.bytesWType, sourceLocation, }) } @@ -100,7 +100,7 @@ class IsOptedInFunctionBuilder extends FunctionBuilder { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [applicationOrAsset], } = parseFunctionArgs({ @@ -119,7 +119,7 @@ class IsOptedInFunctionBuilder extends FunctionBuilder { opCode: 'asset_holding_get', immediates: ['AssetBalance'], stackArgs: [this.expr, applicationOrAsset.resolve()], - wtype: new WTuple({ types: [uint64WType, boolWType], immutable: true }), + wtype: new wtypes.WTuple({ types: [wtypes.uint64WType, wtypes.boolWType], immutable: true }), sourceLocation, }), index: 1n, @@ -132,7 +132,7 @@ class IsOptedInFunctionBuilder extends FunctionBuilder { opCode: 'app_opted_in', stackArgs: [this.expr, applicationOrAsset.resolve()], sourceLocation, - wtype: boolWType, + wtype: wtypes.boolWType, immediates: [], }), ) diff --git a/src/awst_build/eb/reference/application.ts b/src/awst_build/eb/reference/application.ts index 3d198697..76a4a32f 100644 --- a/src/awst_build/eb/reference/application.ts +++ b/src/awst_build/eb/reference/application.ts @@ -3,13 +3,13 @@ import type { Expression } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' import type { PType } from '../../ptypes' import { accountPType, applicationPType, bytesPType, uint64PType } from '../../ptypes' -import type { InstanceBuilder, NodeBuilder } from '../index' +import type { NodeBuilder } from '../index' import { FunctionBuilder } from '../index' import { parseFunctionArgs } from '../util/arg-parsing' import { Uint64BackedReferenceTypeExpressionBuilder } from './base' export class ApplicationFunctionBuilder extends FunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [applicationId], } = parseFunctionArgs({ diff --git a/src/awst_build/eb/reference/asset.ts b/src/awst_build/eb/reference/asset.ts index d47594f3..4354bbcd 100644 --- a/src/awst_build/eb/reference/asset.ts +++ b/src/awst_build/eb/reference/asset.ts @@ -1,18 +1,18 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import { boolWType, WTuple } from '../../../awst/wtypes' +import { wtypes } from '../../../awst/wtypes' import type { PType } from '../../ptypes' import { accountPType, assetPType, boolPType, bytesPType, uint64PType } from '../../ptypes' import { instanceEb } from '../../type-registry' -import type { InstanceBuilder, NodeBuilder } from '../index' +import type { NodeBuilder } from '../index' import { FunctionBuilder } from '../index' import { parseFunctionArgs } from '../util/arg-parsing' import type { FieldMapping } from './base' import { Uint64BackedReferenceTypeExpressionBuilder } from './base' export class AssetFunctionBuilder extends FunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [assetId], } = parseFunctionArgs({ @@ -47,7 +47,7 @@ class AssetHoldingExpressionBuilder extends FunctionBuilder { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [holder], } = parseFunctionArgs({ @@ -63,7 +63,7 @@ class AssetHoldingExpressionBuilder extends FunctionBuilder { opCode: 'asset_holding_get', immediates: [immediate], stackArgs: [holder.resolve(), this.asset], - wtype: new WTuple({ types: [resultType.wtypeOrThrow, boolWType], immutable: true }), + wtype: new wtypes.WTuple({ types: [resultType.wtypeOrThrow, wtypes.boolWType], immutable: true }), sourceLocation, }) return instanceEb(nodeFactory.checkedMaybe({ expr: op, comment: `account opted into asset` }), resultType) diff --git a/src/awst_build/eb/reference/base.ts b/src/awst_build/eb/reference/base.ts index fc1a2dc8..83d61016 100644 --- a/src/awst_build/eb/reference/base.ts +++ b/src/awst_build/eb/reference/base.ts @@ -2,7 +2,7 @@ import { intrinsicFactory } from '../../../awst/intrinsic-factory' import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import { boolWType, WTuple } from '../../../awst/wtypes' +import { wtypes } from '../../../awst/wtypes' import type { PType } from '../../ptypes' import { uint64PType } from '../../ptypes' import { instanceEb } from '../../type-registry' @@ -45,7 +45,7 @@ export abstract class ReferenceTypeExpressionBuilder extends InstanceExpressionB opCode: this.options.fieldOpCode, immediates: [immediate], stackArgs: [this.resolve()], - wtype: new WTuple({ types: [resultType.wtypeOrThrow, boolWType], immutable: true }), + wtype: new wtypes.WTuple({ types: [resultType.wtypeOrThrow, wtypes.boolWType], immutable: true }), sourceLocation, }) return instanceEb(nodeFactory.checkedMaybe({ expr: op, comment: this.options.fieldBoolComment }), resultType) @@ -84,7 +84,7 @@ export abstract class Uint64BackedReferenceTypeExpressionBuilder extends Referen return nodeFactory.reinterpretCast({ sourceLocation, expr: this.resolve(), - wtype: boolWType, + wtype: wtypes.boolWType, }) } diff --git a/src/awst_build/eb/shared/at-function-builder.ts b/src/awst_build/eb/shared/at-function-builder.ts index 7b6da689..0d0e9c37 100644 --- a/src/awst_build/eb/shared/at-function-builder.ts +++ b/src/awst_build/eb/shared/at-function-builder.ts @@ -2,25 +2,27 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import { UInt64BinaryOperator } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import type { WType } from '../../../awst/wtypes' +import type { wtypes } from '../../../awst/wtypes' + import { logger } from '../../../logger' import type { PType } from '../../ptypes' import { numberPType, uint64PType } from '../../ptypes' import { instanceEb } from '../../type-registry' -import { FunctionBuilder, type InstanceBuilder } from '../index' +import type { NodeBuilder } from '../index' +import { FunctionBuilder } from '../index' import { parseFunctionArgs } from '../util/arg-parsing' import { getBigIntOrUint64Expr } from '../util/get-bigint-or-uint64-expr' export class AtFunctionBuilder extends FunctionBuilder { constructor( private expr: Expression, - private itemPType: PType & { wtype: WType }, + private itemPType: PType & { wtype: wtypes.WType }, private exprLength: Expression | bigint, ) { super(expr.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation) { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [index], } = parseFunctionArgs({ @@ -39,7 +41,7 @@ export class AtFunctionBuilder extends FunctionBuilder { if (typeof this.exprLength === 'bigint') { let indexValue = indexParam < 0 ? this.exprLength + indexParam : indexParam if (indexValue < 0n || indexValue >= this.exprLength) { - logger.warn(index.sourceLocation, 'Index access out of bounds') + logger.error(index.sourceLocation, 'Index access out of bounds') indexValue = 0n } indexExpr = nodeFactory.uInt64Constant({ diff --git a/src/awst_build/eb/shared/slice-function-builder.ts b/src/awst_build/eb/shared/slice-function-builder.ts index 751b5e5f..29695951 100644 --- a/src/awst_build/eb/shared/slice-function-builder.ts +++ b/src/awst_build/eb/shared/slice-function-builder.ts @@ -1,24 +1,25 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import type { WType } from '../../../awst/wtypes' +import type { wtypes } from '../../../awst/wtypes' + import type { PType } from '../../ptypes' import { numberPType, uint64PType } from '../../ptypes' import { instanceEb } from '../../type-registry' import type { NodeBuilder } from '../index' -import { FunctionBuilder, type InstanceBuilder } from '../index' +import { FunctionBuilder } from '../index' import { parseFunctionArgs } from '../util/arg-parsing' import { getBigIntOrUint64Expr } from '../util/get-bigint-or-uint64-expr' export class SliceFunctionBuilder extends FunctionBuilder { constructor( private base: Expression, - private resultPType: PType & { wtype: WType }, + private resultPType: PType & { wtype: wtypes.WType }, ) { super(base.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [start, stop], } = parseFunctionArgs({ diff --git a/src/awst_build/eb/storage/box/base.ts b/src/awst_build/eb/storage/box/base.ts index 8041c4ce..c00886e0 100644 --- a/src/awst_build/eb/storage/box/base.ts +++ b/src/awst_build/eb/storage/box/base.ts @@ -5,9 +5,7 @@ import { codeInvariant } from '../../../../util' import { AppStorageDeclaration } from '../../../contract-data' import type { BoxPType, BoxRefPType } from '../../../ptypes' import { BoxMapPType, type ContractClassPType, type PType } from '../../../ptypes' -import { typeRegistry } from '../../../type-registry' -import { type InstanceBuilder, InstanceExpressionBuilder } from '../../index' -import { requireExpressionOfType } from '../../util' +import { InstanceExpressionBuilder } from '../../index' import { ValueProxy } from '../value-proxy' export abstract class BoxProxyExpressionBuilder< @@ -40,17 +38,6 @@ export class BoxValueExpressionBuilder extends ValueProxy { constructor(boxValue: BoxValueExpression, ptype: PType) { super(boxValue, ptype) } - assign(other: InstanceBuilder, sourceLocation: SourceLocation): InstanceBuilder { - const value = requireExpressionOfType(other, this.ptype) - return typeRegistry.getInstanceEb( - nodeFactory.assignmentExpression({ - target: this.resolveLValue(), - value, - sourceLocation, - }), - this.ptype, - ) - } } export function boxValue({ diff --git a/src/awst_build/eb/storage/box/box-map.ts b/src/awst_build/eb/storage/box/box-map.ts index 4553224d..9cb27f6b 100644 --- a/src/awst_build/eb/storage/box/box-map.ts +++ b/src/awst_build/eb/storage/box/box-map.ts @@ -2,20 +2,21 @@ import { intrinsicFactory } from '../../../../awst/intrinsic-factory' import { nodeFactory } from '../../../../awst/node-factory' import type { BoxValueExpression, Expression } from '../../../../awst/nodes' import type { SourceLocation } from '../../../../awst/source-location' -import { boolWType, boxKeyWType, uint64WType, voidWType, WTuple } from '../../../../awst/wtypes' +import { wtypes } from '../../../../awst/wtypes' + import { invariant } from '../../../../util' import type { PType } from '../../../ptypes' import { boolPType, BoxMapPType, bytesPType, stringPType, TuplePType, uint64PType } from '../../../ptypes' import { instanceEb } from '../../../type-registry' import { BooleanExpressionBuilder } from '../../boolean-expression-builder' -import { FunctionBuilder, type InstanceBuilder, type NodeBuilder } from '../../index' +import { FunctionBuilder, type NodeBuilder } from '../../index' import { parseFunctionArgs } from '../../util/arg-parsing' import { VoidExpressionBuilder } from '../../void-expression-builder' import { extractKey } from '../util' import { BoxProxyExpressionBuilder, BoxValueExpressionBuilder } from './base' export class BoxMapFunctionBuilder extends FunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { ptypes: [keySuffixType, contentPType], args: [{ keyPrefix }], @@ -29,7 +30,7 @@ export class BoxMapFunctionBuilder extends FunctionBuilder { }) const ptype = new BoxMapPType({ content: contentPType, keyType: keySuffixType }) - return new BoxMapExpressionBuilder(extractKey(keyPrefix, boxKeyWType), ptype) + return new BoxMapExpressionBuilder(extractKey(keyPrefix, wtypes.boxKeyWType), ptype) } } @@ -87,7 +88,7 @@ abstract class BoxMapFunctionBuilderBase extends FunctionBuilder { } } class BoxMapHasFunctionBuilder extends BoxMapFunctionBuilderBase { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [key], } = parseFunctionArgs({ @@ -100,7 +101,7 @@ class BoxMapHasFunctionBuilder extends BoxMapFunctionBuilderBase { }) return new BooleanExpressionBuilder( nodeFactory.stateExists({ - wtype: boolWType, + wtype: wtypes.boolWType, field: this.boxValueExpression(key.resolve()), sourceLocation, }), @@ -109,7 +110,7 @@ class BoxMapHasFunctionBuilder extends BoxMapFunctionBuilderBase { } class BoxMapGetFunctionBuilder extends BoxMapFunctionBuilderBase { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [key, { default: defaultValue }], } = parseFunctionArgs({ @@ -137,7 +138,7 @@ class BoxMapGetFunctionBuilder extends BoxMapFunctionBuilderBase { } } class BoxMapSetFunctionBuilder extends BoxMapFunctionBuilderBase { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [key, value], } = parseFunctionArgs({ @@ -160,7 +161,7 @@ class BoxMapSetFunctionBuilder extends BoxMapFunctionBuilderBase { } } class BoxMapMaybeFunctionBuilder extends BoxMapFunctionBuilderBase { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [key], } = parseFunctionArgs({ @@ -184,7 +185,7 @@ class BoxMapMaybeFunctionBuilder extends BoxMapFunctionBuilderBase { } } class BoxMapLengthFunctionBuilder extends BoxMapFunctionBuilderBase { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [key], } = parseFunctionArgs({ @@ -201,7 +202,7 @@ class BoxMapLengthFunctionBuilder extends BoxMapFunctionBuilderBase { expr: nodeFactory.intrinsicCall({ opCode: 'box_len', stackArgs: [this.boxValueExpression(key.resolve())], - wtype: new WTuple({ types: [uint64WType, boolWType], immutable: true }), + wtype: new wtypes.WTuple({ types: [wtypes.uint64WType, wtypes.boolWType], immutable: true }), immediates: [], sourceLocation, }), @@ -212,7 +213,7 @@ class BoxMapLengthFunctionBuilder extends BoxMapFunctionBuilderBase { } } class BoxMapDeleteFunctionBuilder extends BoxMapFunctionBuilderBase { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [key], } = parseFunctionArgs({ @@ -228,7 +229,7 @@ class BoxMapDeleteFunctionBuilder extends BoxMapFunctionBuilderBase { nodeFactory.stateDelete({ field: this.boxValueExpression(key.resolve()), sourceLocation, - wtype: voidWType, + wtype: wtypes.voidWType, }), ) } diff --git a/src/awst_build/eb/storage/box/box-ref.ts b/src/awst_build/eb/storage/box/box-ref.ts index 5206e8d8..5fbcc619 100644 --- a/src/awst_build/eb/storage/box/box-ref.ts +++ b/src/awst_build/eb/storage/box/box-ref.ts @@ -1,18 +1,19 @@ import { nodeFactory } from '../../../../awst/node-factory' import type { BoxValueExpression, Expression } from '../../../../awst/nodes' import type { SourceLocation } from '../../../../awst/source-location' -import { boolWType, boxKeyWType, bytesWType, uint64WType, voidWType, WTuple } from '../../../../awst/wtypes' +import { wtypes } from '../../../../awst/wtypes' + import { invariant } from '../../../../util' import type { PType } from '../../../ptypes' import { boolPType, BoxRefPType, boxRefType, bytesPType, stringPType, uint64PType, voidPType } from '../../../ptypes' import { instanceEb } from '../../../type-registry' -import { FunctionBuilder, type InstanceBuilder, type NodeBuilder } from '../../index' +import { FunctionBuilder, type NodeBuilder } from '../../index' import { parseFunctionArgs } from '../../util/arg-parsing' import { extractKey } from '../util' import { BoxProxyExpressionBuilder, boxValue, BoxValueExpressionBuilder } from './base' export class BoxRefFunctionBuilder extends FunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [{ key }], } = parseFunctionArgs({ @@ -24,7 +25,7 @@ export class BoxRefFunctionBuilder extends FunctionBuilder { argSpec: (a) => [a.obj({ key: a.required(bytesPType, stringPType) })], }) - return new BoxRefExpressionBuilder(extractKey(key, boxKeyWType), boxRefType) + return new BoxRefExpressionBuilder(extractKey(key, wtypes.boxKeyWType), boxRefType) } } @@ -58,7 +59,7 @@ export class BoxRefExpressionBuilder extends BoxProxyExpressionBuilder, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [{ size }], } = parseFunctionArgs({ @@ -110,7 +111,7 @@ export class BoxRefCreateFunctionBuilder extends BoxRefBaseFunctionBuilder { nodeFactory.intrinsicCall({ opCode: 'box_create', stackArgs: [this.boxValue, size.resolve()], - wtype: boolWType, + wtype: wtypes.boolWType, immediates: [], sourceLocation, }), @@ -119,7 +120,7 @@ export class BoxRefCreateFunctionBuilder extends BoxRefBaseFunctionBuilder { } } export class BoxRefResizeFunctionBuilder extends BoxRefBaseFunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [size], } = parseFunctionArgs({ @@ -134,7 +135,7 @@ export class BoxRefResizeFunctionBuilder extends BoxRefBaseFunctionBuilder { nodeFactory.intrinsicCall({ opCode: 'box_resize', stackArgs: [this.boxValue, size.resolve()], - wtype: voidWType, + wtype: wtypes.voidWType, immediates: [], sourceLocation, }), @@ -143,7 +144,7 @@ export class BoxRefResizeFunctionBuilder extends BoxRefBaseFunctionBuilder { } } export class BoxRefExtractFunctionBuilder extends BoxRefBaseFunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [start, length], } = parseFunctionArgs({ @@ -158,7 +159,7 @@ export class BoxRefExtractFunctionBuilder extends BoxRefBaseFunctionBuilder { nodeFactory.intrinsicCall({ opCode: 'box_extract', stackArgs: [this.boxValue, start.resolve(), length.resolve()], - wtype: bytesWType, + wtype: wtypes.bytesWType, immediates: [], sourceLocation, }), @@ -167,7 +168,7 @@ export class BoxRefExtractFunctionBuilder extends BoxRefBaseFunctionBuilder { } } export class BoxRefReplaceFunctionBuilder extends BoxRefBaseFunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [start, value], } = parseFunctionArgs({ @@ -182,7 +183,7 @@ export class BoxRefReplaceFunctionBuilder extends BoxRefBaseFunctionBuilder { nodeFactory.intrinsicCall({ opCode: 'box_replace', stackArgs: [this.boxValue, start.resolve(), value.resolve()], - wtype: voidWType, + wtype: wtypes.voidWType, immediates: [], sourceLocation, }), @@ -192,7 +193,7 @@ export class BoxRefReplaceFunctionBuilder extends BoxRefBaseFunctionBuilder { } export class BoxRefPutFunctionBuilder extends BoxRefBaseFunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [value], } = parseFunctionArgs({ @@ -207,7 +208,7 @@ export class BoxRefPutFunctionBuilder extends BoxRefBaseFunctionBuilder { nodeFactory.intrinsicCall({ opCode: 'box_put', stackArgs: [this.boxValue, value.resolve()], - wtype: voidWType, + wtype: wtypes.voidWType, immediates: [], sourceLocation, }), @@ -216,7 +217,7 @@ export class BoxRefPutFunctionBuilder extends BoxRefBaseFunctionBuilder { } } export class BoxRefSpliceFunctionBuilder extends BoxRefBaseFunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [start, stop, value], } = parseFunctionArgs({ @@ -231,7 +232,7 @@ export class BoxRefSpliceFunctionBuilder extends BoxRefBaseFunctionBuilder { nodeFactory.intrinsicCall({ opCode: 'box_splice', stackArgs: [this.boxValue, start.resolve(), stop.resolve(), value.resolve()], - wtype: voidWType, + wtype: wtypes.voidWType, immediates: [], sourceLocation, }), diff --git a/src/awst_build/eb/storage/box/box.ts b/src/awst_build/eb/storage/box/box.ts index da25d2e7..ddaa9e04 100644 --- a/src/awst_build/eb/storage/box/box.ts +++ b/src/awst_build/eb/storage/box/box.ts @@ -1,20 +1,20 @@ import { nodeFactory } from '../../../../awst/node-factory' import type { BoxValueExpression, Expression } from '../../../../awst/nodes' import type { SourceLocation } from '../../../../awst/source-location' -import { boolWType, boxKeyWType, uint64WType, voidWType, WTuple } from '../../../../awst/wtypes' +import { wtypes } from '../../../../awst/wtypes' import { invariant } from '../../../../util' import type { PType } from '../../../ptypes' import { boolPType, BoxPType, bytesPType, stringPType, TuplePType, uint64PType } from '../../../ptypes' import { instanceEb } from '../../../type-registry' import { BooleanExpressionBuilder } from '../../boolean-expression-builder' -import { FunctionBuilder, type InstanceBuilder, type NodeBuilder, ParameterlessFunctionBuilder } from '../../index' +import { FunctionBuilder, type NodeBuilder, ParameterlessFunctionBuilder } from '../../index' import { parseFunctionArgs } from '../../util/arg-parsing' import { VoidExpressionBuilder } from '../../void-expression-builder' import { extractKey } from '../util' import { BoxProxyExpressionBuilder, boxValue, BoxValueExpressionBuilder } from './base' export class BoxFunctionBuilder extends FunctionBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { ptypes: [contentPType], args: [{ key }], @@ -28,7 +28,7 @@ export class BoxFunctionBuilder extends FunctionBuilder { }) const ptype = new BoxPType({ content: contentPType }) - return new BoxExpressionBuilder(extractKey(key, boxKeyWType), ptype) + return new BoxExpressionBuilder(extractKey(key, wtypes.boxKeyWType), ptype) } } @@ -52,7 +52,7 @@ export class BoxExpressionBuilder extends BoxProxyExpressionBuilder { nodeFactory.stateExists({ field: boxValueExpr, sourceLocation, - wtype: boolWType, + wtype: wtypes.boolWType, }), ) case 'length': @@ -61,7 +61,7 @@ export class BoxExpressionBuilder extends BoxProxyExpressionBuilder { expr: nodeFactory.intrinsicCall({ opCode: 'box_len', stackArgs: [boxValueExpr], - wtype: new WTuple({ types: [uint64WType, boolWType], immutable: true }), + wtype: new wtypes.WTuple({ types: [wtypes.uint64WType, wtypes.boolWType], immutable: true }), immediates: [], sourceLocation, }), @@ -89,7 +89,7 @@ class BoxDeleteFunctionBuilder extends ParameterlessFunctionBuilder { nodeFactory.stateDelete({ sourceLocation, field: boxValue, - wtype: voidWType, + wtype: wtypes.voidWType, }), ), ) @@ -105,7 +105,7 @@ class BoxGetFunctionBuilder extends FunctionBuilder { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [{ default: defaultValue }], } = parseFunctionArgs({ @@ -140,7 +140,8 @@ class BoxMaybeFunctionBuilder extends FunctionBuilder { ) { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { parseFunctionArgs({ args, typeArgs, diff --git a/src/awst_build/eb/storage/global-state.ts b/src/awst_build/eb/storage/global-state.ts index 3b963afc..8aa51054 100644 --- a/src/awst_build/eb/storage/global-state.ts +++ b/src/awst_build/eb/storage/global-state.ts @@ -2,7 +2,8 @@ import { nodeFactory } from '../../../awst/node-factory' import type { AppStateExpression, Expression, LValue } from '../../../awst/nodes' import { BytesConstant } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import { stateKeyWType } from '../../../awst/wtypes' +import { wtypes } from '../../../awst/wtypes' + import { CodeError } from '../../../errors' import { codeInvariant, invariant } from '../../../util' import { AppStorageDeclaration } from '../../contract-data' @@ -20,7 +21,7 @@ export class GlobalStateFunctionBuilder extends FunctionBuilder { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const [contentPType] = typeArgs const { args: [{ initialValue, key }], @@ -39,7 +40,7 @@ export class GlobalStateFunctionBuilder extends FunctionBuilder { }) const ptype = new GlobalStateType({ content: contentPType }) - return new GlobalStateFunctionResultBuilder(extractKey(key, stateKeyWType), ptype, { + return new GlobalStateFunctionResultBuilder(extractKey(key, wtypes.stateKeyWType), ptype, { initialValue: initialValue?.resolve(), sourceLocation, }) diff --git a/src/awst_build/eb/storage/local-state.ts b/src/awst_build/eb/storage/local-state.ts index 8c6c818a..9e14123c 100644 --- a/src/awst_build/eb/storage/local-state.ts +++ b/src/awst_build/eb/storage/local-state.ts @@ -2,12 +2,12 @@ import { nodeFactory } from '../../../awst/node-factory' import type { AppAccountStateExpression, AppStateExpression, Expression, LValue } from '../../../awst/nodes' import { BytesConstant } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' -import { stateKeyWType, voidWType } from '../../../awst/wtypes' +import { wtypes } from '../../../awst/wtypes' import { CodeError } from '../../../errors' import { codeInvariant, invariant } from '../../../util' import { AppStorageDeclaration } from '../../contract-data' import type { ContractClassPType, PType } from '../../ptypes' -import { accountPType, bytesPType, LocalStateType, stringPType } from '../../ptypes' +import { accountPType, boolPType, bytesPType, LocalStateType, stringPType } from '../../ptypes' import { instanceEb } from '../../type-registry' import { FunctionBuilder, InstanceBuilder, InstanceExpressionBuilder, NodeBuilder } from '../index' import { parseFunctionArgs } from '../util/arg-parsing' @@ -19,7 +19,7 @@ export class LocalStateFunctionBuilder extends FunctionBuilder { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const [contentPType] = typeArgs const { args: [{ key }], @@ -36,7 +36,7 @@ export class LocalStateFunctionBuilder extends FunctionBuilder { callLocation: sourceLocation, }) const ptype = new LocalStateType({ content: contentPType }) - return new LocalStateFunctionResultBuilder(extractKey(key, stateKeyWType), ptype, { sourceLocation }) + return new LocalStateFunctionResultBuilder(extractKey(key, wtypes.stateKeyWType), ptype, { sourceLocation }) } } @@ -46,7 +46,7 @@ export class LocalStateExpressionBuilder extends InstanceExpressionBuilder, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [account], } = parseFunctionArgs({ @@ -85,7 +85,6 @@ export class LocalStateForAccountExpressionBuilder extends NodeBuilder { memberAccess(name: string, sourceLocation: SourceLocation): NodeBuilder { switch (name) { case 'value': - // TODO: use value proxy return instanceEb( nodeFactory.appAccountStateExpression({ ...this.key, @@ -93,6 +92,15 @@ export class LocalStateForAccountExpressionBuilder extends NodeBuilder { }), this.contentType, ) + case 'hasValue': + return instanceEb( + nodeFactory.stateExists({ + field: this.key, + sourceLocation, + wtype: wtypes.boolWType, + }), + boolPType, + ) case 'delete': return new LocalStateDeleteFunctionBuilder(this.key, sourceLocation) } @@ -108,7 +116,7 @@ class LocalStateDeleteFunctionBuilder extends FunctionBuilder { super(sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { parseFunctionArgs({ args, typeArgs, @@ -121,7 +129,7 @@ class LocalStateDeleteFunctionBuilder extends FunctionBuilder { nodeFactory.stateDelete({ field: this.key, sourceLocation, - wtype: voidWType, + wtype: wtypes.voidWType, }), ) } diff --git a/src/awst_build/eb/storage/util.ts b/src/awst_build/eb/storage/util.ts index d5b2d101..c77cabf5 100644 --- a/src/awst_build/eb/storage/util.ts +++ b/src/awst_build/eb/storage/util.ts @@ -1,12 +1,12 @@ import { nodeFactory } from '../../../awst/node-factory' import type { Expression } from '../../../awst/nodes' import { BytesConstant } from '../../../awst/nodes' -import type { WType } from '../../../awst/wtypes' +import type { wtypes } from '../../../awst/wtypes' import type { InstanceBuilder } from '../index' -export function extractKey(key: InstanceBuilder, keyWType: WType): Expression -export function extractKey(key: InstanceBuilder | undefined, keyWType: WType): Expression | undefined -export function extractKey(key: InstanceBuilder | undefined, keyWType: WType): Expression | undefined { +export function extractKey(key: InstanceBuilder, keyWType: wtypes.WType): Expression +export function extractKey(key: InstanceBuilder | undefined, keyWType: wtypes.WType): Expression | undefined +export function extractKey(key: InstanceBuilder | undefined, keyWType: wtypes.WType): Expression | undefined { if (!key) return undefined const keyBytes = key.toBytes(key.sourceLocation) diff --git a/src/awst_build/eb/storage/value-proxy.ts b/src/awst_build/eb/storage/value-proxy.ts index 322a5c41..74e8bf3a 100644 --- a/src/awst_build/eb/storage/value-proxy.ts +++ b/src/awst_build/eb/storage/value-proxy.ts @@ -34,7 +34,8 @@ export abstract class ValueProxy extends InstanceExpressio postfixUnaryOp(op: BuilderUnaryOp, sourceLocation: SourceLocation): InstanceBuilder { return this.proxied.postfixUnaryOp(op, sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { return this.proxied.call(args, typeArgs, sourceLocation) } compare(other: InstanceBuilder, op: BuilderComparisonOp, sourceLocation: SourceLocation): InstanceBuilder { diff --git a/src/awst_build/eb/string-expression-builder.ts b/src/awst_build/eb/string-expression-builder.ts index 8d9fdbe8..7bf2f8b8 100644 --- a/src/awst_build/eb/string-expression-builder.ts +++ b/src/awst_build/eb/string-expression-builder.ts @@ -1,10 +1,11 @@ -import { awst, wtypes } from '../../awst' +import { awst } from '../../awst' import { intrinsicFactory } from '../../awst/intrinsic-factory' import { nodeFactory } from '../../awst/node-factory' import type { Expression } from '../../awst/nodes' import { BytesBinaryOperator, BytesEncoding, EqualityComparison } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' -import { CodeError, NotSupported } from '../../errors' +import { wtypes } from '../../awst/wtypes' +import { NotSupported } from '../../errors' import { tryConvertEnum, utf8ToUint8Array } from '../../util' import type { InstanceType, PType, PTypeOrClass } from '../ptypes' import { boolPType, bytesPType, stringPType } from '../ptypes' @@ -46,8 +47,19 @@ export class StringFunctionBuilder extends FunctionBuilder { return new StringExpressionBuilder(result) } - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { - if (args.length === 0) { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + const { + args: [value], + } = parseFunctionArgs({ + args, + typeArgs, + callLocation: sourceLocation, + funcName: 'String', + genericTypeArgs: 0, + argSpec: (a) => [a.optional(bytesPType)], + }) + + if (!value) { return new StringExpressionBuilder( nodeFactory.stringConstant({ sourceLocation, @@ -55,20 +67,14 @@ export class StringFunctionBuilder extends FunctionBuilder { }), ) } - if (args.length === 1) { - const [arg0] = args - if (arg0.ptype.equals(bytesPType)) { - return new StringExpressionBuilder( - nodeFactory.reinterpretCast({ - expr: arg0.resolve(), - sourceLocation, - wtype: wtypes.stringWType, - }), - ) - } - } - throw CodeError.unexpectedUnhandledArgs({ sourceLocation }) + return new StringExpressionBuilder( + nodeFactory.reinterpretCast({ + expr: value.resolve(), + sourceLocation, + wtype: wtypes.stringWType, + }), + ) } } @@ -173,7 +179,7 @@ export class ConcatExpressionBuilder extends FunctionBuilder { super(expr.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation) { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: others } = parseFunctionArgs({ args, typeArgs, diff --git a/src/awst_build/eb/transactions/group-transactions.ts b/src/awst_build/eb/transactions/group-transactions.ts index 040dae8a..38777221 100644 --- a/src/awst_build/eb/transactions/group-transactions.ts +++ b/src/awst_build/eb/transactions/group-transactions.ts @@ -7,7 +7,7 @@ import { invariant } from '../../../util' import type { PType } from '../../ptypes' import { GroupTransactionPType, TransactionFunctionType, uint64PType } from '../../ptypes' import { instanceEb } from '../../type-registry' -import type { InstanceBuilder, NodeBuilder } from '../index' +import type { NodeBuilder } from '../index' import { FunctionBuilder, InstanceExpressionBuilder } from '../index' import { parseFunctionArgs } from '../util/arg-parsing' import { anyTxnFields, txnKindToFields } from './txn-fields' @@ -57,7 +57,8 @@ export class GroupTransactionFunctionBuilder extends FunctionBuilder { invariant(ptype instanceof TransactionFunctionType, 'ptype must be instance of TransactionFunctionType') this.ptype = ptype } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [groupIndex], } = parseFunctionArgs({ @@ -88,7 +89,8 @@ class IndexedTransactionFieldFunctionBuilder extends FunctionBuilder { ) { super(gtxn.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [index], } = parseFunctionArgs({ diff --git a/src/awst_build/eb/transactions/inner-transaction-params.ts b/src/awst_build/eb/transactions/inner-transaction-params.ts index 94dabe0f..e2a6d40d 100644 --- a/src/awst_build/eb/transactions/inner-transaction-params.ts +++ b/src/awst_build/eb/transactions/inner-transaction-params.ts @@ -27,7 +27,7 @@ export class ItxnParamsFactoryFunctionBuilder extends FunctionBuilder { this.ptype = ptype } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [initialFields], } = parseFunctionArgs({ @@ -116,7 +116,7 @@ abstract class InnerTxnFieldsMethodBuilder extends FunctionBuilder { } class SubmitInnerTxnMethodBuilder extends InnerTxnFieldsMethodBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { parseFunctionArgs({ args, typeArgs, @@ -139,7 +139,8 @@ class SubmitInnerTxnMethodBuilder extends InnerTxnFieldsMethodBuilder { export class SubmitItxnGroupFunctionBuilder extends FunctionBuilder { ptype = submitGroupItxnFunction - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: itxnParams } = parseFunctionArgs({ args, typeArgs, @@ -167,7 +168,7 @@ export class SubmitItxnGroupFunctionBuilder extends FunctionBuilder { } class SetInnerTxnMethodBuilder extends InnerTxnFieldsMethodBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [updatedFields], } = parseFunctionArgs({ @@ -196,7 +197,7 @@ class SetInnerTxnMethodBuilder extends InnerTxnFieldsMethodBuilder { } } class CopyInnerTxnMethodBuilder extends InnerTxnFieldsMethodBuilder { - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { parseFunctionArgs({ args, typeArgs, diff --git a/src/awst_build/eb/transactions/inner-transactions.ts b/src/awst_build/eb/transactions/inner-transactions.ts index b9606bd3..fc2f2fd9 100644 --- a/src/awst_build/eb/transactions/inner-transactions.ts +++ b/src/awst_build/eb/transactions/inner-transactions.ts @@ -6,7 +6,7 @@ import { invariant } from '../../../util' import type { PType } from '../../ptypes' import { InnerTransactionPType, uint64PType } from '../../ptypes' import { instanceEb } from '../../type-registry' -import type { InstanceBuilder, NodeBuilder } from '../index' +import type { NodeBuilder } from '../index' import { FunctionBuilder, InstanceExpressionBuilder } from '../index' import { parseFunctionArgs } from '../util/arg-parsing' import { anyTxnFields, txnKindToFields } from './txn-fields' @@ -54,7 +54,8 @@ class IndexedTransactionFieldFunctionBuilder extends FunctionBuilder { ) { super(gtxn.sourceLocation) } - call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [index], } = parseFunctionArgs({ diff --git a/src/awst_build/eb/uint64-enum-type-builder.ts b/src/awst_build/eb/uint64-enum-type-builder.ts index fb6870ac..5cf3e63d 100644 --- a/src/awst_build/eb/uint64-enum-type-builder.ts +++ b/src/awst_build/eb/uint64-enum-type-builder.ts @@ -1,9 +1,12 @@ import { nodeFactory } from '../../awst/node-factory' import type { Expression } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' +import { wtypes } from '../../awst/wtypes' import { invariant } from '../../util' -import type { PType } from '../ptypes' -import { Uint64EnumMemberType, Uint64EnumType } from '../ptypes' +import type { PType, PTypeOrClass } from '../ptypes' +import { Uint64EnumMemberType, Uint64EnumType, uint64PType } from '../ptypes' +import { instanceEb } from '../type-registry' +import type { InstanceBuilder } from './index' import { InstanceExpressionBuilder, NodeBuilder } from './index' export class Uint64EnumTypeBuilder extends NodeBuilder { @@ -33,4 +36,21 @@ export class Uint64EnumMemberExpressionBuilder extends InstanceExpressionBuilder invariant(ptype instanceof Uint64EnumMemberType, 'ptype must be Uint64EnumType') super(expr, ptype) } + + resolvableToPType(ptype: PTypeOrClass): boolean { + return ptype.equals(this.ptype) || ptype.equals(uint64PType) + } + resolveToPType(ptype: PTypeOrClass): InstanceBuilder { + if (ptype.equals(uint64PType)) { + return instanceEb( + nodeFactory.reinterpretCast({ + expr: this._expr, + wtype: wtypes.uint64WType, + sourceLocation: this.sourceLocation, + }), + uint64PType, + ) + } + return super.resolveToPType(ptype) + } } diff --git a/src/awst_build/eb/uint64-expression-builder.ts b/src/awst_build/eb/uint64-expression-builder.ts index 35c234be..ab0c3ac3 100644 --- a/src/awst_build/eb/uint64-expression-builder.ts +++ b/src/awst_build/eb/uint64-expression-builder.ts @@ -4,12 +4,13 @@ import { nodeFactory } from '../../awst/node-factory' import type { Expression } from '../../awst/nodes' import { BoolConstant, UInt64BinaryOperator, UInt64PostfixUnaryOperator, UInt64UnaryOperator } from '../../awst/nodes' import type { SourceLocation } from '../../awst/source-location' -import { boolWType, uint64WType } from '../../awst/wtypes' +import { wtypes } from '../../awst/wtypes' + import { NotSupported } from '../../errors' import { tryConvertEnum } from '../../util' import type { InstanceType, PType } from '../ptypes' import { boolPType, Uint64Function, uint64PType } from '../ptypes' -import type { BuilderComparisonOp, InstanceBuilder } from './index' +import type { BuilderComparisonOp, InstanceBuilder, NodeBuilder } from './index' import { BuilderBinaryOp, BuilderUnaryOp, FunctionBuilder, InstanceExpressionBuilder } from './index' import { requireExpressionOfType } from './util' import { parseFunctionArgs } from './util/arg-parsing' @@ -18,7 +19,7 @@ import { compareUint64 } from './util/compare-uint64' export class UInt64FunctionBuilder extends FunctionBuilder { readonly ptype = Uint64Function - call(args: Array, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): InstanceBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: [value], } = parseFunctionArgs({ @@ -51,7 +52,7 @@ export class UInt64FunctionBuilder extends FunctionBuilder { return new UInt64ExpressionBuilder( nodeFactory.reinterpretCast({ expr, - wtype: uint64WType, + wtype: wtypes.uint64WType, sourceLocation, }), ) @@ -69,7 +70,7 @@ export class UInt64ExpressionBuilder extends InstanceExpressionBuilder, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { + call(args: ReadonlyArray, typeArgs: ReadonlyArray, sourceLocation: SourceLocation): NodeBuilder { const { args: uArgs } = parseFunctionArgs({ args, typeArgs, @@ -26,7 +26,7 @@ export class UrangeFunctionBuilder extends FunctionBuilder { stop: uArgs[0].resolve(), step: nodeFactory.uInt64Constant({ value: 1n, sourceLocation }), sourceLocation, - wtype: uint64RangeWType, + wtype: wtypes.uint64RangeWType, }) } else if (uArgs.length === 2) { expr = nodeFactory.range({ @@ -34,7 +34,7 @@ export class UrangeFunctionBuilder extends FunctionBuilder { stop: uArgs[1].resolve(), step: nodeFactory.uInt64Constant({ value: 0n, sourceLocation }), sourceLocation, - wtype: uint64RangeWType, + wtype: wtypes.uint64RangeWType, }) } else { expr = nodeFactory.range({ @@ -42,7 +42,7 @@ export class UrangeFunctionBuilder extends FunctionBuilder { stop: uArgs[1].resolve(), step: uArgs[2].resolve(), sourceLocation, - wtype: uint64RangeWType, + wtype: wtypes.uint64RangeWType, }) } return new IterableIteratorExpressionBuilder(expr, IterableIteratorType.parameterise([uint64PType])) diff --git a/src/awst_build/eb/util/arg-parsing.ts b/src/awst_build/eb/util/arg-parsing.ts index 33a3aae7..0a4a4625 100644 --- a/src/awst_build/eb/util/arg-parsing.ts +++ b/src/awst_build/eb/util/arg-parsing.ts @@ -1,10 +1,9 @@ -import type { Expression } from '../../../awst/nodes' import type { SourceLocation } from '../../../awst/source-location' import { CodeError } from '../../../errors' import { logger } from '../../../logger' import type { DeliberateAny, Tuple } from '../../../typescript-helpers' import type { PType, PTypeOrClass } from '../../ptypes' -import type { InstanceBuilder } from '../index' +import type { InstanceBuilder, NodeBuilder } from '../index' import { requestBuilderOfType, requireInstanceBuilder } from './index' function parseTypeArgs( @@ -30,15 +29,21 @@ const ArgSpecDiscriminator = Symbol('_specType') /** * Optional arg spec - * Will be mapped to `Expression | undefined` + * Will be mapped to `InstanceBuilder | undefined` */ -type OptionalArg = { t: PTypeOrClass[]; required: false; [ArgSpecDiscriminator]: 'arg' } +type OptionalArg = { t: PTypeOrClass[]; [ArgSpecDiscriminator]: 'arg'; type: 'optional' } /** * Required arg spec - * Will be mapped to `Expression` + * Will be mapped to `InstanceBuilder` */ -type RequiredArg = { t: PTypeOrClass[]; required: true; [ArgSpecDiscriminator]: 'arg' } -type ArgSpec = OptionalArg | RequiredArg +type RequiredArg = { t: PTypeOrClass[]; type: 'required'; [ArgSpecDiscriminator]: 'arg' } + +/** + * Passthrough arg spec + * Will be mapped to NodeBuilder | undefined + */ +type PassthroughArg = { type: 'passthrough'; [ArgSpecDiscriminator]: 'arg' } +type ArgSpec = OptionalArg | RequiredArg | PassthroughArg /** * Object arg spec @@ -65,11 +70,13 @@ type ArgMap = ArgSpec | ObjArgSpec */ type ArgFor = T extends ObjArgSpec ? ArgsForObjSpec - : T extends OptionalArg - ? InstanceBuilder | undefined - : T extends RequiredArg - ? InstanceBuilder - : never + : T extends PassthroughArg + ? NodeBuilder | undefined + : T extends OptionalArg + ? InstanceBuilder | undefined + : T extends RequiredArg + ? InstanceBuilder + : never /** * Maps each arg to an expected output type */ @@ -82,7 +89,7 @@ type ParsedArgs = T extends [infer T1 extends Ar : never function parseObjArg( - arg: InstanceBuilder | undefined, + arg: NodeBuilder | undefined, sourceLocation: SourceLocation, subject: string, argMap: T, @@ -91,6 +98,10 @@ function parseObjArg( (acc, [property, spec]) => { if (arg?.hasProperty(property)) { const builder = arg.memberAccess(property, sourceLocation) + if (spec.type === 'passthrough') { + acc[property] = builder + return acc + } if (spec.t.length === 0) { acc[property] = requireInstanceBuilder(builder) } else { @@ -110,14 +121,14 @@ function parseObjArg( } return acc } - if (spec.required) { + if (spec.type === 'required') { throw new CodeError(`${subject} is missing required property ${property}`, { sourceLocation: arg?.sourceLocation ?? sourceLocation, }) } return acc }, - {} as Record, + {} as Record, ) as ArgsForObjSpec } @@ -127,14 +138,14 @@ const argSpecFactory = { * @param ptypes */ required(...ptypes: PTypeOrClass[]): RequiredArg { - return { t: ptypes, required: true, [ArgSpecDiscriminator]: 'arg' } + return { t: ptypes, type: 'required', [ArgSpecDiscriminator]: 'arg' } }, /** * An optional arg with one of the specified types * @param ptypes */ optional(...ptypes: PTypeOrClass[]): OptionalArg { - return { t: ptypes, required: false, [ArgSpecDiscriminator]: 'arg' } + return { t: ptypes, type: 'optional', [ArgSpecDiscriminator]: 'arg' } }, /** * An object map arg, if all properties are optional - the arg itself becomes optional @@ -146,6 +157,12 @@ const argSpecFactory = { [ArgSpecDiscriminator]: 'obj', } }, + passthrough(): PassthroughArg { + return { + type: 'passthrough', + [ArgSpecDiscriminator]: 'arg', + } + }, } export type ArgSpecFactory = typeof argSpecFactory @@ -161,7 +178,7 @@ export function parseFunctionArgs + args: ReadonlyArray /** * Raw typeArgs array passed to call function */ @@ -197,8 +214,11 @@ export function parseFunctionArgs { - const source: InstanceBuilder | undefined = args[i] + const source: NodeBuilder | undefined = args[i] if (a[ArgSpecDiscriminator] === 'arg') { + if (a.type === 'passthrough') { + return source + } if (source) { if (a.t.length === 0) { return source @@ -214,7 +234,7 @@ export function parseFunctionArgs( - builders: ReadonlyArray, + builders: ReadonlyArray, ptypes: TPTypes, sourceLocation: SourceLocation, ): Array { diff --git a/src/awst_build/function-visitor.ts b/src/awst_build/function-visitor.ts index 4d458cfe..b40e7fe0 100644 --- a/src/awst_build/function-visitor.ts +++ b/src/awst_build/function-visitor.ts @@ -4,7 +4,7 @@ import type * as awst from '../awst/nodes' import type { Block } from '../awst/nodes' import { AssignmentExpression, Goto, ReturnStatement } from '../awst/nodes' import type { SourceLocation } from '../awst/source-location' -import { AwstBuildFailureError, CodeError, InternalError, NotSupported, TodoError } from '../errors' +import { AwstBuildFailureError, CodeError, InternalError, NotSupported } from '../errors' import { logger } from '../logger' import { codeInvariant, enumerate, instanceOfAny, invariant } from '../util' import type { Statements } from '../visitor/syntax-names' @@ -22,6 +22,7 @@ import { TupleExpressionBuilder } from './eb/tuple-expression-builder' import { requireExpressionOfType, requireInstanceBuilder } from './eb/util' import type { PType } from './ptypes' import { FunctionPType, ObjectPType } from './ptypes' +import { getSequenceItemType } from './ptypes/util' import { typeRegistry } from './type-registry' // noinspection JSUnusedGlobalSymbols @@ -68,7 +69,7 @@ export class FunctionVisitor } } - buildAssignmentTarget(bindingName: ts.BindingName, sourceLocation: SourceLocation): InstanceBuilder { + visitBindingName(bindingName: ts.BindingName, sourceLocation: SourceLocation): InstanceBuilder { switch (bindingName.kind) { case ts.SyntaxKind.ObjectBindingPattern: { const props = Array<[string, InstanceBuilder]>() @@ -82,7 +83,7 @@ export class FunctionVisitor codeInvariant(!element.dotDotDotToken, 'Spread operator is not supported', sourceLocation) codeInvariant(!element.initializer, 'Initializer on object binding pattern is not supported', sourceLocation) - props.push([propertyName, this.buildAssignmentTarget(element.name, sourceLocation)]) + props.push([propertyName, this.visitBindingName(element.name, sourceLocation)]) } const ptype = ObjectPType.anonymous(props.map(([name, builder]): [string, PType] => [name, builder.ptype])) return new ObjectLiteralExpressionBuilder( @@ -104,7 +105,7 @@ export class FunctionVisitor codeInvariant(!element.propertyName, 'Property name on array binding expression is not supported', sourceLocation) if (element.dotDotDotToken) { - const spreadResult = this.buildAssignmentTarget(element.name, sourceLocation) + const spreadResult = this.visitBindingName(element.name, sourceLocation) if (spreadResult instanceof NativeArrayExpressionBuilder) { throw new CodeError( 'Spread operator is not supported in assignment expressions where the resulting type is a variadic array', @@ -116,7 +117,7 @@ export class FunctionVisitor throw InternalError.shouldBeUnreachable() } } else { - items.push(this.buildAssignmentTarget(element.name, sourceLocation)) + items.push(this.visitBindingName(element.name, sourceLocation)) } } } @@ -146,7 +147,7 @@ export class FunctionVisitor paramPType, ) - assignments.push(this.handleAssignmentStatement(this.buildAssignmentTarget(p.name, sourceLocation), paramBuilder, sourceLocation)) + assignments.push(this.handleAssignmentStatement(this.visitBindingName(p.name, sourceLocation), paramBuilder, sourceLocation)) } } @@ -187,7 +188,7 @@ export class FunctionVisitor const source = requireInstanceBuilder(this.accept(d.initializer)) - return this.handleAssignmentStatement(this.buildAssignmentTarget(d.name, sourceLocation), source, sourceLocation) + return this.handleAssignmentStatement(this.visitBindingName(d.name, sourceLocation), source, sourceLocation) }) } @@ -238,15 +239,18 @@ export class FunctionVisitor visitForOfStatement(node: ts.ForOfStatement): awst.Statement | awst.Statement[] { const sourceLocation = this.sourceLocation(node) + const sequenceLocation = this.sourceLocation(node.expression) + const initializerLocation = this.sourceLocation(node.initializer) + const sequenceType = this.context.getPTypeForNode(node.expression) + const itemType = getSequenceItemType(sequenceType, sequenceLocation) let items: awst.LValue if (ts.isExpression(node.initializer)) { items = requireInstanceBuilder(this.accept(node.initializer)).resolveLValue() } else { - const initializerSource = this.sourceLocation(node.initializer) - codeInvariant(node.initializer.declarations.length === 1, 'For of loops can only declare a single loop variable', initializerSource) + codeInvariant(node.initializer.declarations.length === 1, 'For of loops can only declare a single loop variable', initializerLocation) const [declaration] = node.initializer.declarations - items = this.buildAssignmentTarget(declaration.name, initializerSource).resolveLValue() + items = this.buildLValue(this.visitBindingName(declaration.name, initializerLocation), itemType, initializerLocation) } using ctx = this.context.switchLoopCtx.enterLoop(node, sourceLocation) return nodeFactory.block( @@ -271,7 +275,7 @@ export class FunctionVisitor }) } visitEmptyStatement(node: ts.EmptyStatement): awst.Statement | awst.Statement[] { - throw new TodoError('EmptyStatement') + return nodeFactory.block({ sourceLocation: this.sourceLocation(node), comment: 'Empty statement' }) } visitExpressionStatement(node: ts.ExpressionStatement): awst.Statement | awst.Statement[] { const expr = requireInstanceBuilder(this.accept(node.expression)).resolve() diff --git a/src/awst_build/index.ts b/src/awst_build/index.ts index 908ad2c3..bb0a70c9 100644 --- a/src/awst_build/index.ts +++ b/src/awst_build/index.ts @@ -1,5 +1,4 @@ import { jsonSerializeAwst } from '../awst/json-serialize-awst' -import type { CompilationSet } from '../awst/models' import type { AWST } from '../awst/nodes' import { SourceLocation } from '../awst/source-location' import { ToCodeVisitor } from '../awst/to-code-visitor' @@ -10,11 +9,13 @@ import type { CreateProgramResult } from '../parser' import { ArtifactKind, writeArtifact } from '../write-artifact' import { buildContextForProgram } from './context/awst-build-context' import { buildLibAwst } from './lib' +import type { CompilationSet } from './models' import { SourceFileVisitor } from './source-file-visitor' export function buildAwst({ program, sourceFiles }: CreateProgramResult, options: CompileOptions): [AWST[], CompilationSet] { const awstBuildContext = buildContextForProgram(program) - const moduleAwst: AWST[] = [...buildLibAwst()] + buildLibAwst(awstBuildContext) + const moduleAwst: AWST[] = [] for (const [sourcePath, sourceFile] of Object.entries(sourceFiles)) { try { const visitor = new SourceFileVisitor(awstBuildContext.createChildContext(), sourceFile) diff --git a/src/awst_build/lib/index.ts b/src/awst_build/lib/index.ts index c0faacfc..a9322cb8 100644 --- a/src/awst_build/lib/index.ts +++ b/src/awst_build/lib/index.ts @@ -1,117 +1,110 @@ -import { intrinsicFactory } from '../../awst/intrinsic-factory' import { ContractReference } from '../../awst/models' import { nodeFactory } from '../../awst/node-factory' -import type { AWST } from '../../awst/nodes' import { SourceLocation } from '../../awst/source-location' -import { boolWType } from '../../awst/wtypes' +import { wtypes } from '../../awst/wtypes' import { Constants } from '../../constants' +import type { AwstBuildContext } from '../context/awst-build-context' +import { Index } from '../models' import { arc4BaseContractType, baseContractType } from '../ptypes' -export function buildLibAwst(): AWST[] { - const sourceLocationArc4 = new SourceLocation({ - file: Constants.arc4ModuleName, - line: 1, - endLine: 1, - column: 0, - endColumn: 1, - }) - const sourceLocationBase = new SourceLocation({ - file: Constants.baseContractModuleName, - line: 1, - endLine: 1, - column: 0, - endColumn: 1, - }) +export function buildLibAwst(context: AwstBuildContext) { const contractCref = ContractReference.fromPType(arc4BaseContractType) const baseContractCref = ContractReference.fromPType(baseContractType) - const baseContract = nodeFactory.contractFragment({ - id: baseContractCref, - name: baseContractType.name, - bases: [], - init: null, - subroutines: [], - appState: new Map(), - stateTotals: null, - docstring: null, - sourceLocation: sourceLocationBase, - reservedScratchSpace: new Set(), - approvalProgram: nodeFactory.contractMethod({ - memberName: Constants.approvalProgramMethodName, - cref: baseContractCref, + const baseContract = new Index({ + type: baseContractType, + isAbstract: true, + propertyInitialization: [], + ctor: nodeFactory.contractMethod({ + memberName: Constants.constructorMethodName, + cref: contractCref, args: [], - arc4MethodConfig: null, - sourceLocation: sourceLocationBase, - returnType: boolWType, - synthetic: true, - inheritable: true, + sourceLocation: SourceLocation.None, documentation: nodeFactory.methodDocumentation(), body: nodeFactory.block( - { - sourceLocation: sourceLocationBase, - }, + { sourceLocation: SourceLocation.None }, nodeFactory.expressionStatement({ - expr: intrinsicFactory.err({ - comment: 'Approval program not implemented', - sourceLocation: sourceLocationBase, + expr: nodeFactory.subroutineCallExpression({ + args: [], + wtype: wtypes.voidWType, + target: nodeFactory.instanceMethodTarget({ + memberName: Constants.constructorMethodName, + }), + sourceLocation: SourceLocation.None, }), }), ), + returnType: wtypes.voidWType, + arc4MethodConfig: null, }), + bases: [], + methods: [], + appState: [], + stateTotals: null, + description: null, + sourceLocation: SourceLocation.None, + reservedScratchSpace: new Set(), + approvalProgram: null, clearProgram: nodeFactory.contractMethod({ memberName: Constants.clearStateProgramMethodName, cref: baseContractCref, args: [], arc4MethodConfig: null, - sourceLocation: sourceLocationBase, - returnType: boolWType, - synthetic: true, - inheritable: true, + sourceLocation: SourceLocation.None, + returnType: wtypes.boolWType, documentation: nodeFactory.methodDocumentation(), body: nodeFactory.block( { - sourceLocation: sourceLocationBase, + sourceLocation: SourceLocation.None, }, nodeFactory.returnStatement({ - sourceLocation: sourceLocationBase, - value: nodeFactory.boolConstant({ value: true, sourceLocation: sourceLocationBase }), + sourceLocation: SourceLocation.None, + value: nodeFactory.boolConstant({ value: true, sourceLocation: SourceLocation.None }), }), ), }), }) - const contract = nodeFactory.contractFragment({ - id: contractCref, - name: arc4BaseContractType.name, - bases: [baseContractCref], - init: null, - subroutines: [], - appState: new Map(), + context.addToCompilationSet(baseContractCref, baseContract) + const contract = new Index({ + type: arc4BaseContractType, + isAbstract: true, + propertyInitialization: [], + ctor: nodeFactory.contractMethod({ + memberName: Constants.constructorMethodName, + cref: contractCref, + args: [], + sourceLocation: SourceLocation.None, + documentation: nodeFactory.methodDocumentation(), + body: nodeFactory.block({ sourceLocation: SourceLocation.None }), + returnType: wtypes.voidWType, + arc4MethodConfig: null, + }), + methods: [], + appState: [], stateTotals: null, - docstring: null, - sourceLocation: sourceLocationArc4, + description: null, + bases: [baseContractCref], + clearProgram: null, + sourceLocation: SourceLocation.None, reservedScratchSpace: new Set(), approvalProgram: nodeFactory.contractMethod({ memberName: Constants.approvalProgramMethodName, cref: contractCref, args: [], arc4MethodConfig: null, - sourceLocation: sourceLocationArc4, - returnType: boolWType, - synthetic: true, - inheritable: true, + sourceLocation: SourceLocation.None, + returnType: wtypes.boolWType, documentation: nodeFactory.methodDocumentation(), body: nodeFactory.block( { - sourceLocation: sourceLocationArc4, + sourceLocation: SourceLocation.None, }, nodeFactory.returnStatement({ - sourceLocation: sourceLocationArc4, - value: nodeFactory.aRC4Router({ sourceLocation: sourceLocationArc4, wtype: boolWType }), + sourceLocation: SourceLocation.None, + value: nodeFactory.aRC4Router({ sourceLocation: SourceLocation.None, wtype: wtypes.boolWType }), }), ), }), - clearProgram: null, }) - - return [baseContract, contract] + context.addToCompilationSet(contractCref, contract) } diff --git a/src/awst_build/models/index.ts b/src/awst_build/models/index.ts new file mode 100644 index 00000000..877e7922 --- /dev/null +++ b/src/awst_build/models/index.ts @@ -0,0 +1,188 @@ +import type { awst } from '../../awst' +import type { LogicSigReference } from '../../awst/models' +import { ARC4BareMethodConfig, ARC4CreateOption, ContractReference, OnCompletionAction } from '../../awst/models' +import { nodeFactory } from '../../awst/node-factory' +import type { AppStorageDefinition, ContractMethod, Statement, StateTotals } from '../../awst/nodes' +import { SourceLocation } from '../../awst/source-location' +import { wtypes } from '../../awst/wtypes' +import { Constants } from '../../constants' +import { logger } from '../../logger' +import type { Props } from '../../typescript-helpers' +import { codeInvariant, invariant, isIn } from '../../util' +import { CustomKeyMap } from '../../util/custom-key-map' +import type { ContractClassPType } from '../ptypes' + +export class Index { + public readonly isAbstract: boolean + public get id(): ContractReference { + return ContractReference.fromPType(this.type) + } + public readonly type: ContractClassPType + public get name(): string { + return this.type.name + } + public readonly description: string | null + public readonly bases: Array + public readonly propertyInitialization: Array + public readonly approvalProgram: ContractMethod | null + public readonly clearProgram: ContractMethod | null + public readonly ctor: ContractMethod + public readonly methods: Array + public readonly appState: Array + public readonly stateTotals: StateTotals | null + public readonly reservedScratchSpace: Set + public readonly sourceLocation: SourceLocation + constructor(props: Props>) { + this.isAbstract = props.isAbstract + this.type = props.type + this.description = props.description + this.propertyInitialization = props.propertyInitialization + this.bases = props.bases + this.ctor = props.ctor + this.approvalProgram = props.approvalProgram + this.clearProgram = props.clearProgram + this.methods = props.methods + this.appState = props.appState + this.stateTotals = props.stateTotals + this.sourceLocation = props.sourceLocation + this.reservedScratchSpace = props.reservedScratchSpace + } + + buildContract(compilationSet: CompilationSet): awst.Contract { + let approvalProgram: ContractMethod | null = this.approvalProgram + let clearProgram: ContractMethod | null = this.clearProgram + const methods: ContractMethod[] = [...this.methods, this.ctor] + const methodResolutionOrder: ContractReference[] = [] + for (const baseType of this.type.allBases()) { + const cref = ContractReference.fromPType(baseType) + const baseClass = compilationSet.getContractClass(cref) + methodResolutionOrder.push(cref) + approvalProgram ??= baseClass.approvalProgram + clearProgram ??= baseClass.clearProgram + if (baseClass.approvalProgram && baseClass.approvalProgram !== approvalProgram) methods.push(baseClass.approvalProgram) + if (baseClass.clearProgram && baseClass.clearProgram !== clearProgram) methods.push(baseClass.clearProgram) + for (const method of baseClass.methods) { + // Maybe need validation?? + methods.push(method) + } + methods.push(baseClass.ctor) + } + if (this.type.isARC4) { + const hasCreate = methods.some((m) => isIn(m.arc4MethodConfig?.create, [ARC4CreateOption.Allow, ARC4CreateOption.Require])) + const hasBareNoop = methods.some( + (m) => m.arc4MethodConfig?.isBare === true && isIn(OnCompletionAction.NoOp, m.arc4MethodConfig.allowedCompletionTypes), + ) + + if (!hasCreate) { + if (hasBareNoop) { + logger.error( + this.sourceLocation, + `Non-abstract ARC4 contract has no methods which can be called to create the contract. ` + + `An implicit one could not be inserted as there is already a bare method handling the NoOp on completion action. ` + + `In order to allow creating the contract specify { onCreate: 'allow' } or { onCreate: 'require' } in an @abimethod or @baremethod decorator above the chosen method.`, + ) + } else { + methods.push(this.makeDefaultCreate()) + } + } + } + + codeInvariant(approvalProgram, 'must have approval') + codeInvariant(clearProgram, 'must have clear') + return nodeFactory.contract({ + name: this.name, + id: this.id, + description: this.description, + approvalProgram: this.patchApprovalToCallCtor(approvalProgram), + clearProgram, + methodResolutionOrder, + methods, + appState: this.appState, // TODO: Tally from base + stateTotals: this.stateTotals, // TODO: Tally + reservedScratchSpace: this.reservedScratchSpace, + sourceLocation: this.sourceLocation, + }) + } + + private patchApprovalToCallCtor(approval: ContractMethod): ContractMethod { + const callCtorIfNew = nodeFactory.ifElse({ + condition: nodeFactory.not({ + expr: nodeFactory.reinterpretCast({ + expr: nodeFactory.intrinsicCall({ + opCode: 'txn', + immediates: ['ApplicationID'], + stackArgs: [], + sourceLocation: SourceLocation.None, + wtype: wtypes.uint64WType, + }), + sourceLocation: SourceLocation.None, + wtype: wtypes.boolWType, + }), + sourceLocation: SourceLocation.None, + }), + ifBranch: nodeFactory.block( + { sourceLocation: SourceLocation.None }, + nodeFactory.expressionStatement({ + expr: nodeFactory.subroutineCallExpression({ + args: [], + wtype: wtypes.voidWType, + target: nodeFactory.instanceMethodTarget({ + memberName: Constants.constructorMethodName, + }), + sourceLocation: SourceLocation.None, + }), + }), + ), + sourceLocation: SourceLocation.None, + elseBranch: null, + }) + + return nodeFactory.contractMethod({ + ...approval, + body: nodeFactory.block({ sourceLocation: SourceLocation.None }, callCtorIfNew, approval.body), + }) + } + + private makeDefaultCreate() { + return nodeFactory.contractMethod({ + memberName: Constants.defaultCreateMethodName, + cref: ContractReference.fromPType(this.type), + args: [], + arc4MethodConfig: new ARC4BareMethodConfig({ + allowedCompletionTypes: [OnCompletionAction.NoOp], + create: ARC4CreateOption.Require, + sourceLocation: this.sourceLocation, + }), + returnType: wtypes.voidWType, + documentation: nodeFactory.methodDocumentation({ + description: 'Implicitly generated create method', + }), + sourceLocation: this.sourceLocation, + body: nodeFactory.block({ + sourceLocation: this.sourceLocation, + }), + }) + } +} + +export class LogicSig { + public readonly isForOutput: boolean = true +} + +export class CompilationSet extends CustomKeyMap { + constructor() { + super((x) => x.toString()) + } + + get compilationOutputSet() { + return Array.from(this.entries()) + .filter(([, meta]) => (meta instanceof Index ? !meta.isAbstract : false)) + .map(([ref]) => ref) + } + + getContractClass(cref: ContractReference) { + const maybeClass = this.get(cref) + invariant(maybeClass instanceof Index, 'Contract reference must resolve to a contract class') + return maybeClass + } +} diff --git a/src/awst_build/ptypes/arc4-types.ts b/src/awst_build/ptypes/arc4-types.ts index 214d22e4..89933a66 100644 --- a/src/awst_build/ptypes/arc4-types.ts +++ b/src/awst_build/ptypes/arc4-types.ts @@ -1,17 +1,117 @@ import type { SourceLocation } from '../../awst/source-location' -import type { ARC4Type } from '../../awst/wtypes' -import { ARC4DynamicArray, ARC4StaticArray, ARC4UIntN } from '../../awst/wtypes' +import { wtypes } from '../../awst/wtypes' import { Constants } from '../../constants' -import { codeInvariant } from '../../util' +import { codeInvariant, zipStrict } from '../../util' import { PType } from './base' import { LibFunctionType, NumericLiteralPType } from './index' +import ARC4StaticArray = wtypes.ARC4StaticArray export const UintNConstructor = new LibFunctionType({ name: 'UintN', module: Constants.arc4EncodedTypesModuleName, }) +export const ByteConstructor = new LibFunctionType({ + name: 'Byte', + module: Constants.arc4EncodedTypesModuleName, +}) export abstract class ARC4EncodedType extends PType { - abstract get wtype(): ARC4Type + abstract readonly wtype: wtypes.ARC4Type +} + +export class ARC4InstanceType extends ARC4EncodedType { + readonly wtype: wtypes.ARC4Type + readonly name: string + readonly module = Constants.arc4ModuleName + readonly singleton = false + constructor({ wtype, name }: { wtype: wtypes.ARC4Type; name: string }) { + super() + this.wtype = wtype + this.name = name + } +} + +export const ARC4BooleanType = new ARC4InstanceType({ + name: 'Boolean', + wtype: wtypes.arc4BooleanWType, +}) + +export const ARC4StringType = new ARC4InstanceType({ + name: 'String', + wtype: wtypes.arc4StringAliasWType, +}) + +export class ARC4StructType extends ARC4EncodedType { + readonly name: string + readonly module: string + readonly singleton = false + readonly fields: Record + readonly sourceLocation: SourceLocation | undefined + constructor({ + name, + module, + fields, + sourceLocation, + }: { + name: string + module: string + fields: Record + sourceLocation?: SourceLocation + }) { + super() + this.name = name + this.module = module + this.fields = fields + this.sourceLocation = sourceLocation + } + + get wtype(): wtypes.ARC4Struct { + return new wtypes.ARC4Struct({ + name: this.name, + fields: Object.fromEntries(Object.entries(this.fields).map(([f, t]) => [f, t.wtype])), + sourceLocation: this.sourceLocation, + }) + } + + equals(other: PType): boolean { + if (!(other instanceof ARC4StructType)) return false + const thisProps = Object.entries(this.fields) + const otherProps = Object.entries(other.fields) + return ( + this.name === other.name && + thisProps.length === otherProps.length && + zipStrict(thisProps, otherProps).every( + ([[left_prop, left_type], [right_prop, right_type]]) => left_prop === right_prop && left_type.equals(right_type), + ) + ) + } +} + +export class ARC4TupleType extends ARC4EncodedType { + readonly name = 'Tuple' + readonly module = Constants.arc4ModuleName + readonly singleton = false + readonly types: ARC4EncodedType[] + readonly sourceLocation: SourceLocation | undefined + constructor({ types, sourceLocation }: { types: ARC4EncodedType[]; sourceLocation?: SourceLocation }) { + super() + this.types = types + this.sourceLocation = sourceLocation + } + + get wtype(): wtypes.ARC4Tuple { + return new wtypes.ARC4Tuple({ + types: this.types.map((t) => t.wtype), + sourceLocation: this.sourceLocation, + }) + } + + equals(other: PType): boolean { + return ( + other instanceof ARC4TupleType && + this.types.length === other.types.length && + zipStrict(this.types, other.types).every(([a, b]) => a.equals(b)) + ) + } } export class UintNType extends ARC4EncodedType { @@ -21,15 +121,14 @@ export class UintNType extends ARC4EncodedType { readonly name: string readonly singleton = false - get wtype(): ARC4UIntN { - return new ARC4UIntN({ n: this.n }) - } + readonly wtype: wtypes.ARC4UIntN - constructor({ n }: { n: bigint }) { + constructor({ n, wtype, name }: { n: bigint; wtype?: wtypes.ARC4UIntN; name?: string }) { super() codeInvariant(n >= 8n && n <= 512n && n % 8n === 0n, 'n must be between 8 and 512, and a multiple of 8') this.n = n - this.name = `UIntN<${n}>` + this.name = name ?? `UIntN<${n}>` + this.wtype = wtype ?? new wtypes.ARC4UIntN({ n: this.n }) } static parameterise(typeArgs: PType[]): UintNType { @@ -48,6 +147,8 @@ export class UintNType extends ARC4EncodedType { } } +export const arc4ByteAlias = new UintNType({ n: 8n, wtype: wtypes.arc4ByteAliasWType, name: 'Byte' }) + export const DynamicArrayConstructor = new LibFunctionType({ name: 'DynamicArray', module: Constants.arc4EncodedTypesModuleName, @@ -56,16 +157,22 @@ export class DynamicArrayType extends ARC4EncodedType { static baseFullName = `${Constants.arc4EncodedTypesModuleName}::DynamicArray` readonly module = Constants.arc4EncodedTypesModuleName readonly elementType: ARC4EncodedType + readonly immutable: boolean readonly name: string readonly singleton = false readonly sourceLocation: SourceLocation | undefined - get wtype(): ARC4DynamicArray { - return new ARC4DynamicArray({ elementType: this.elementType.wtype, sourceLocation: this.sourceLocation }) + get wtype(): wtypes.ARC4DynamicArray { + return new wtypes.ARC4DynamicArray({ + elementType: this.elementType.wtype, + sourceLocation: this.sourceLocation, + immutable: this.immutable, + }) } constructor({ elementType, sourceLocation }: { elementType: ARC4EncodedType; sourceLocation?: SourceLocation }) { super() + this.immutable = false this.elementType = elementType this.name = `DynamicArray<${elementType}>` this.sourceLocation = sourceLocation @@ -95,27 +202,34 @@ export class StaticArrayType extends ARC4EncodedType { readonly module = Constants.arc4EncodedTypesModuleName readonly elementType: ARC4EncodedType readonly arraySize: bigint + readonly immutable: boolean readonly name: string readonly singleton = false readonly sourceLocation: SourceLocation | undefined - get wtype(): ARC4StaticArray { - return new ARC4StaticArray({ elementType: this.elementType.wtype, arraySize: this.arraySize }) - } + readonly wtype: wtypes.ARC4StaticArray constructor({ elementType, arraySize, sourceLocation, + wtype, + name, + immutable, }: { + immutable?: boolean elementType: ARC4EncodedType arraySize: bigint sourceLocation?: SourceLocation + wtype?: ARC4StaticArray + name?: string }) { super() - this.elementType = elementType + ;(this.immutable = immutable ?? false), (this.elementType = elementType) this.arraySize = arraySize - this.name = `StaticArray<${elementType}>` + this.name = name ?? `StaticArray<${elementType}>` this.sourceLocation = sourceLocation + this.wtype = + wtype ?? new wtypes.ARC4StaticArray({ elementType: this.elementType.wtype, arraySize: this.arraySize, immutable: this.immutable }) } static parameterise(typeArgs: PType[]): StaticArrayType { @@ -137,3 +251,15 @@ export class StaticArrayType extends ARC4EncodedType { return [this.elementType, new NumericLiteralPType({ literalValue: this.arraySize })] } } +export const arc4AddressAlias = new StaticArrayType({ + arraySize: BigInt(Constants.encodedAddressLength), + elementType: arc4ByteAlias, + wtype: wtypes.arc4AddressAliasWType, + immutable: true, + name: 'Address', +}) + +export const AddressConstructor = new LibFunctionType({ + name: 'Address', + module: Constants.arc4EncodedTypesModuleName, +}) diff --git a/src/awst_build/ptypes/base.ts b/src/awst_build/ptypes/base.ts index e57dc0a4..ed463909 100644 --- a/src/awst_build/ptypes/base.ts +++ b/src/awst_build/ptypes/base.ts @@ -1,4 +1,4 @@ -import type { wtypes } from '../../awst' +import type { wtypes } from '../../awst/wtypes' import type { DeliberateAny } from '../../typescript-helpers' import { codeInvariant } from '../../util' diff --git a/src/awst_build/ptypes/index.ts b/src/awst_build/ptypes/index.ts index 440ff00f..a2e9664d 100644 --- a/src/awst_build/ptypes/index.ts +++ b/src/awst_build/ptypes/index.ts @@ -1,10 +1,10 @@ -import { wtypes } from '../../awst' import { TransactionKind } from '../../awst/models' -import type { WType } from '../../awst/wtypes' -import { uint64WType, WArray, WEnumeration, WGroupTransaction, WInnerTransaction, WInnerTransactionFields, WTuple } from '../../awst/wtypes' +import { SourceLocation } from '../../awst/source-location' +import { wtypes } from '../../awst/wtypes' + import { Constants } from '../../constants' import { CodeError, InternalError, NotSupported } from '../../errors' -import { codeInvariant, distinct, sortBy } from '../../util' +import { codeInvariant, distinctByEquality, sortBy, zipStrict } from '../../util' import { PType } from './base' import { transientTypeErrors } from './transient-type-errors' @@ -43,11 +43,11 @@ export abstract class TransientType extends PType { this.expressionMessage = expressionMessage } - get wtype(): WType | undefined { + get wtype(): wtypes.WType | undefined { return undefined } - get wtypeOrThrow(): WType { + get wtypeOrThrow(): wtypes.WType { throw new CodeError(this.typeMessage) } } @@ -70,7 +70,7 @@ export class UnsupportedType extends PType { return this.#fullName ?? super.fullName } - get wtypeOrThrow(): WType { + get wtypeOrThrow(): wtypes.WType { throw new NotSupported(`The type ${this.fullName} is not supported`) } } @@ -83,6 +83,7 @@ export class ContractClassPType extends PType { readonly methods: Record readonly singleton = true readonly baseTypes: ContractClassPType[] + readonly sourceLocation: SourceLocation constructor(props: { module: string @@ -90,6 +91,7 @@ export class ContractClassPType extends PType { properties: Record methods: Record baseTypes: ContractClassPType[] + sourceLocation: SourceLocation }) { super() this.name = props.name @@ -97,11 +99,19 @@ export class ContractClassPType extends PType { this.properties = props.properties this.methods = props.methods this.baseTypes = props.baseTypes + this.sourceLocation = props.sourceLocation } get isARC4(): boolean { return this.baseTypes.some((b) => b.isARC4) } + + *allBases(): IterableIterator { + for (const b of this.baseTypes) { + yield b + yield* b.allBases() + } + } } export class BaseContractClassType extends ContractClassPType { @@ -120,6 +130,7 @@ export class BaseContractClassType extends ContractClassPType { properties: Record methods: Record baseTypes: ContractClassPType[] + sourceLocation: SourceLocation }) { super(rest) this._isArc4 = isArc4 @@ -128,7 +139,7 @@ export class BaseContractClassType extends ContractClassPType { export class UnionPType extends TransientType { get fullName() { - return this.types.map((t) => t.fullName).join(' | ') + return this.types.map((t) => t).join(' | ') } readonly singleton = false readonly types: PType[] @@ -136,7 +147,7 @@ export class UnionPType extends TransientType { private constructor({ types }: { types: PType[] }) { let typeMessage: string let expressionMessage: string - const name = types.map((t) => t.name).join(' | ') + const name = types.map((t) => t).join(' | ') const transientType = types.find((t) => t instanceof TransientType) if (transientType) { if (transientType instanceof NativeNumericType) { @@ -164,7 +175,7 @@ export class UnionPType extends TransientType { if (types.length === 0) { throw new InternalError('Cannot create union of zero types') } - const distinctTypes = types.filter(distinct((t) => t.fullName)).toSorted(sortBy((t) => t.fullName)) + const distinctTypes = types.filter(distinctByEquality((a, b) => a.equals(b))).toSorted(sortBy((t) => t.fullName)) if (distinctTypes.length === 1) { return distinctTypes[0] } @@ -175,11 +186,11 @@ export class UnionPType extends TransientType { } export abstract class StorageProxyPType extends PType { - readonly wtype: WType + readonly wtype: wtypes.WType readonly contentType: PType readonly singleton = false - protected constructor(props: { content: PType; keyWType: WType }) { + protected constructor(props: { content: PType; keyWType: wtypes.WType }) { super() this.wtype = props.keyWType this.contentType = props.content @@ -388,6 +399,17 @@ export class IntrinsicFunctionGroupType extends PType { this.name = name } } +export class IntrinsicFunctionGroupTypeType extends PType { + readonly wtype: undefined + readonly name: string + readonly module: string = Constants.opTypesModuleName + readonly singleton = false + + constructor({ name }: { name: string }) { + super() + this.name = name + } +} export class IntrinsicFunctionType extends PType { readonly wtype: undefined readonly name: string @@ -399,6 +421,17 @@ export class IntrinsicFunctionType extends PType { this.name = name } } +export class IntrinsicFunctionTypeType extends PType { + readonly wtype: undefined + readonly name: string + readonly module: string = Constants.opTypesModuleName + readonly singleton = false + + constructor({ name }: { name: string }) { + super() + this.name = name + } +} export class NamespacePType extends PType { readonly wtype: undefined @@ -440,7 +473,7 @@ export class FunctionPType extends PType { } export class ArrayLiteralPType extends TransientType { get fullName() { - return `${this.module}::[${this.items.map((i) => i.fullName).join(', ')}]` + return `${this.module}::[${this.items.map((i) => i).join(', ')}]` } readonly items: PType[] @@ -471,6 +504,14 @@ export class ArrayLiteralPType extends TransientType { items: this.items, }) } + + equals(other: PType): boolean { + return ( + other instanceof ArrayLiteralPType && + this.items.length === other.items.length && + zipStrict(this.items, other.items).every(([a, b]) => a.equals(b)) + ) + } } export class TuplePType extends PType { @@ -491,20 +532,25 @@ export class TuplePType extends PType { this.immutable = true } - get wtype(): WTuple { - return new WTuple({ + get wtype(): wtypes.WTuple { + return new wtypes.WTuple({ types: this.items.map((i) => i.wtypeOrThrow), immutable: this.immutable, }) } + + equals(other: PType): boolean { + return ( + other instanceof TuplePType && + this.items.length === other.items.length && + zipStrict(this.items, other.items).every(([a, b]) => a.equals(b)) + ) + } } export class ArrayPType extends TransientType { readonly itemType: PType readonly immutable: boolean - // get name() { - // return - // } get fullName() { return `${this.module}::Array<${this.itemType.fullName}>` } @@ -522,22 +568,26 @@ export class ArrayPType extends TransientType { } get wtype() { - return new WArray({ + return new wtypes.WArray({ itemType: this.itemType.wtypeOrThrow, immutable: this.immutable, }) } + + equals(other: PType): boolean { + return other instanceof ArrayPType && this.immutable === other.immutable && this.itemType.equals(other.itemType) + } } export class ObjectPType extends PType { - #name: string + readonly name: string readonly module: string readonly properties: Record readonly singleton = false constructor(props: { module?: string; name?: string; properties: Record }) { super() - this.#name = props.name ?? '' + this.name = props.name ?? '' this.module = props.module ?? '' this.properties = props.properties } @@ -549,23 +599,26 @@ export class ObjectPType extends PType { }) } - get wtype(): WTuple { - const tupleTypes: WType[] = [] + get wtype(): wtypes.WTuple { + const tupleTypes: wtypes.WType[] = [] + const tupleNames: string[] = [] for (const [propName, propType] of this.orderedProperties()) { if (propType instanceof TransientType) { throw new CodeError(`Property '${propName}' of ${this.name} has an unsupported type: ${propType.typeMessage}`) } tupleTypes.push(propType.wtypeOrThrow) + tupleNames.push(propName) } - return new WTuple({ + return new wtypes.WTuple({ + name: this.name, + names: tupleNames, types: tupleTypes, - immutable: false, + immutable: true, }) } orderedProperties() { - // TODO: Respect declaration order - return Object.entries(this.properties).toSorted(sortBy(([key]) => key)) + return Object.entries(this.properties) //.toSorted(sortBy(([key]) => key)) } getPropertyType(name: string): PType { @@ -583,18 +636,22 @@ export class ObjectPType extends PType { return this.hasProperty(name) && this.properties[name].equals(type) } - get name(): string { - // TODO: Include name in identity - return `{${this.orderedProperties() - .map((p) => `${p[0]}:${p[1].name}`) - .join(',')}}` + equals(other: PType): boolean { + if (!(other instanceof ObjectPType)) return false + const thisProps = this.orderedProperties() + const otherProps = other.orderedProperties() + return ( + this.name === other.name && + thisProps.length === otherProps.length && + zipStrict(thisProps, otherProps).every( + ([[left_prop, left_type], [right_prop, right_type]]) => left_prop === right_prop && left_type.equals(right_type), + ) + ) } - get fullName(): string { - //const alias = [this.module, this.#name].filter(Boolean).join('::') - // TODO: include name in identity + toString(): string { return `{${this.orderedProperties() - .map((p) => `${p[0]}:${p[1].fullName}`) + .map((p) => `${p[0]}:${p[1].name}`) .join(',')}}` } } @@ -809,6 +866,7 @@ export const baseContractType = new BaseContractClassType({ properties: {}, baseTypes: [], isArc4: false, + sourceLocation: SourceLocation.None, }) export const arc4BaseContractType = new BaseContractClassType({ module: Constants.arc4ModuleName, @@ -820,6 +878,7 @@ export const arc4BaseContractType = new BaseContractClassType({ properties: {}, baseTypes: [baseContractType], isArc4: true, + sourceLocation: SourceLocation.None, }) export const arc4BareMethodDecorator = new LibFunctionType({ @@ -833,7 +892,7 @@ export const arc4AbiMethodDecorator = new LibFunctionType({ export class GroupTransactionPType extends PType { get wtype() { - return new WGroupTransaction({ + return new wtypes.WGroupTransaction({ transactionType: this.kind, }) } @@ -928,7 +987,7 @@ export const assertMatchFunction = new LibFunctionType({ }) export class Uint64EnumMemberType extends PType { - readonly wtype = uint64WType + readonly wtype = wtypes.uint64WType readonly name: string readonly module: string readonly singleton = false @@ -946,7 +1005,7 @@ export class Uint64EnumType extends PType { get memberType(): Uint64EnumMemberType { return new Uint64EnumMemberType(this) } - readonly wtype = uint64WType + readonly wtype = wtypes.uint64WType readonly name: string readonly module: string readonly singleton = true @@ -1023,14 +1082,16 @@ export class IterableIteratorType extends TransientType { return `${GlobalStateType.baseFullName}<${this.itemType.fullName}>` } static parameterise(typeArgs: PType[]): IterableIteratorType { - codeInvariant(typeArgs.length === 1, 'IterableIterator type expects exactly one type parameter') + codeInvariant(typeArgs.length >= 1 && typeArgs.length <= 3, 'IterableIterator type expects 1-3 type parameters') + // Currently ignoring return and next types + const [yieldType, _returnType, _nextType] = typeArgs return new IterableIteratorType({ - itemType: typeArgs[0], + itemType: yieldType, }) } - get wtype(): WEnumeration { - return new WEnumeration({ sequenceType: this.itemType.wtypeOrThrow }) + get wtype(): wtypes.WEnumeration { + return new wtypes.WEnumeration({ sequenceType: this.itemType.wtypeOrThrow }) } getGenericArgs(): PType[] { @@ -1071,7 +1132,7 @@ export const applicationCallItxnFn = new TransactionFunctionType({ export class InnerTransactionPType extends PType { get wtype() { - return new WInnerTransaction({ + return new wtypes.WInnerTransaction({ transactionType: this.kind, }) } @@ -1088,7 +1149,7 @@ export class InnerTransactionPType extends PType { } export class ItxnParamsPType extends PType { get wtype() { - return new WInnerTransactionFields({ + return new wtypes.WInnerTransactionFields({ transactionType: this.kind, }) } diff --git a/src/awst_build/ptypes/register.ts b/src/awst_build/ptypes/register.ts index dcef756f..8eb1e67f 100644 --- a/src/awst_build/ptypes/register.ts +++ b/src/awst_build/ptypes/register.ts @@ -1,11 +1,13 @@ import { Arc4AbiMethodDecoratorBuilder, Arc4BareMethodDecoratorBuilder } from '../eb/arc4-bare-method-decorator-builder' import { + AddressConstructorBuilder, + AddressExpressionBuilder, DynamicArrayConstructorBuilder, DynamicArrayExpressionBuilder, StaticArrayConstructorBuilder, StaticArrayExpressionBuilder, } from '../eb/arc4/arrays' -import { UintNConstructorBuilder, UintNExpressionBuilder } from '../eb/arc4/uint-n-constructor-builder' +import { ByteConstructorBuilder, UintNConstructorBuilder, UintNExpressionBuilder } from '../eb/arc4/uint-n-constructor-builder' import { AssertFunctionBuilder, ErrFunctionBuilder } from '../eb/assert-function-builder' import { AssertMatchFunctionBuilder } from '../eb/assert-match-function-builder' import { BigUintExpressionBuilder, BigUintFunctionBuilder } from '../eb/biguint-expression-builder' @@ -19,7 +21,7 @@ import { ObjectExpressionBuilder } from '../eb/literal/object-expression-builder import { LogFunctionBuilder } from '../eb/log-function-builder' import { NamespaceBuilder } from '../eb/namespace-builder' import { NativeArrayExpressionBuilder } from '../eb/native-array-expression-builder' -import { FreeIntrinsicOpBuilder, IntrinsicOpGroupBuilder } from '../eb/op-module-builder' +import { FreeIntrinsicOpBuilder, IntrinsicOpGroupBuilder, IntrinsicOpGroupOrFunctionTypeBuilder } from '../eb/op-module-builder' import { AccountExpressionBuilder, AccountFunctionBuilder } from '../eb/reference/account' import { ApplicationExpressionBuilder, ApplicationFunctionBuilder } from '../eb/reference/application' import { AssetExpressionBuilder, AssetFunctionBuilder } from '../eb/reference/asset' @@ -49,6 +51,10 @@ import { VoidExpressionBuilder } from '../eb/void-expression-builder' import { OP_METADATA } from '../op-metadata' import type { TypeRegistry } from '../type-registry' import { + AddressConstructor, + arc4AddressAlias, + arc4ByteAlias, + ByteConstructor, DynamicArrayConstructor, DynamicArrayType, StaticArrayConstructor, @@ -107,7 +113,9 @@ import { GlobalStateFunction, GlobalStateType, IntrinsicFunctionGroupType, + IntrinsicFunctionGroupTypeType, IntrinsicFunctionType, + IntrinsicFunctionTypeType, IterableIteratorType, keyRegistrationGtxnType, keyRegistrationItxnFn, @@ -172,6 +180,12 @@ export function registerPTypes(typeRegistry: TypeRegistry) { }), singletonEb: IntrinsicOpGroupBuilder, }) + typeRegistry.register({ + ptype: new IntrinsicFunctionGroupTypeType({ + name: `${name}Type`, + }), + instanceEb: IntrinsicOpGroupOrFunctionTypeBuilder, + }) } else { typeRegistry.register({ ptype: new IntrinsicFunctionType({ @@ -179,6 +193,12 @@ export function registerPTypes(typeRegistry: TypeRegistry) { }), singletonEb: FreeIntrinsicOpBuilder, }) + typeRegistry.register({ + ptype: new IntrinsicFunctionTypeType({ + name: `${name}Type`, + }), + instanceEb: IntrinsicOpGroupOrFunctionTypeBuilder, + }) } } @@ -201,11 +221,15 @@ export function registerPTypes(typeRegistry: TypeRegistry) { typeRegistry.register({ ptype: AccountFunction, singletonEb: AccountFunctionBuilder }) typeRegistry.register({ ptype: accountPType, instanceEb: AccountExpressionBuilder }) typeRegistry.register({ ptype: UintNConstructor, singletonEb: UintNConstructorBuilder }) + typeRegistry.register({ ptype: ByteConstructor, singletonEb: ByteConstructorBuilder }) typeRegistry.registerGeneric({ ptype: UintNType, instanceEb: UintNExpressionBuilder }) + typeRegistry.register({ ptype: arc4ByteAlias, instanceEb: UintNExpressionBuilder }) typeRegistry.register({ ptype: DynamicArrayConstructor, singletonEb: DynamicArrayConstructorBuilder }) typeRegistry.registerGeneric({ ptype: DynamicArrayType, instanceEb: DynamicArrayExpressionBuilder }) typeRegistry.register({ ptype: StaticArrayConstructor, singletonEb: StaticArrayConstructorBuilder }) typeRegistry.registerGeneric({ ptype: StaticArrayType, instanceEb: StaticArrayExpressionBuilder }) + typeRegistry.register({ ptype: arc4AddressAlias, instanceEb: AddressExpressionBuilder }) + typeRegistry.register({ ptype: AddressConstructor, singletonEb: AddressConstructorBuilder }) typeRegistry.register({ ptype: ApplicationFunctionType, singletonEb: ApplicationFunctionBuilder }) typeRegistry.register({ ptype: applicationPType, instanceEb: ApplicationExpressionBuilder }) diff --git a/src/awst_build/ptypes/util.ts b/src/awst_build/ptypes/util.ts new file mode 100644 index 00000000..dfdb76f9 --- /dev/null +++ b/src/awst_build/ptypes/util.ts @@ -0,0 +1,23 @@ +import type { SourceLocation } from '../../awst/source-location' +import { CodeError } from '../../errors' +import { codeInvariant } from '../../util' +import { DynamicArrayType, StaticArrayType } from './arc4-types' +import type { PType } from './base' +import { ArrayPType, IterableIteratorType, TuplePType, UnionPType } from './index' + +export const getSequenceItemType = (sequence: PType, sequenceLocation: SourceLocation) => { + if (sequence instanceof IterableIteratorType) return sequence.itemType + if (sequence instanceof ArrayPType) return sequence.itemType + if (sequence instanceof TuplePType) { + codeInvariant( + sequence.items.every((i) => i.equals(sequence.items[0])), + `Tuples are only iterable if all item types are the same type. Item type is ${UnionPType.fromTypes(sequence.items)}`, + sequenceLocation, + ) + return sequence.items[0] + } + if (sequence instanceof DynamicArrayType || sequence instanceof StaticArrayType) { + return sequence.elementType + } + throw new CodeError('Target is not iterable', { sourceLocation: sequenceLocation }) +} diff --git a/src/awst_build/source-file-visitor.ts b/src/awst_build/source-file-visitor.ts index 838aee03..62eb1580 100644 --- a/src/awst_build/source-file-visitor.ts +++ b/src/awst_build/source-file-visitor.ts @@ -82,7 +82,6 @@ export class SourceFileVisitor extends BaseVisitor implements Visitor logPuyaExceptions(() => ContractVisitor.buildContract(this.context, node), sourceLocation) + return () => logPuyaExceptions(() => ContractVisitor.buildContract(this.context, node, ptype), sourceLocation) } else { logger.warn(sourceLocation, `Ignoring class declaration ${ptype.fullName}`) return [] diff --git a/src/awst_build/type-resolver.ts b/src/awst_build/type-resolver.ts index f0f507c5..1b2e2ed5 100644 --- a/src/awst_build/type-resolver.ts +++ b/src/awst_build/type-resolver.ts @@ -1,5 +1,5 @@ import ts from 'typescript' -import type { SourceLocation } from '../awst/source-location' +import { SourceLocation } from '../awst/source-location' import { Constants } from '../constants' import { CodeError, InternalError } from '../errors' import { logger } from '../logger' @@ -204,7 +204,10 @@ export class TypeResolver { if (baseType instanceof ContractClassPType) { return this.reflectContractType(typeName, tsType, baseType, sourceLocation) } - throw new CodeError('Classes must extend "Contract" or "BaseContract" base classes to be considered a contract', { sourceLocation }) + throw new CodeError( + `${typeName.fullName} cannot be mapped to an algo ts type. Classes must extend "Contract" or "BaseContract" base classes to be considered a contract`, + { sourceLocation }, + ) } const callSignatures = this.checker.getSignaturesOfType(tsType, ts.SignatureKind.Call) if (callSignatures.length) { @@ -260,7 +263,7 @@ export class TypeResolver { const returnType = this.resolveType(sig.getReturnType(), sourceLocation) const parameters = sig.getParameters().map((p) => { const paramType = this.checker.getTypeOfSymbol(p) - return [p.name, this.resolveType(paramType, sourceLocation)] as const + return [p.name, this.resolveType(paramType, this.getLocationOfSymbol(p) ?? sourceLocation)] as const }) return new FunctionPType({ returnType, @@ -280,7 +283,7 @@ export class TypeResolver { const methods: Record = {} for (const prop of tsType.getProperties()) { const type = this.checker.getTypeOfSymbol(prop) - const ptype = this.resolveType(type, sourceLocation) + const ptype = this.resolveType(type, this.getLocationOfSymbol(prop) ?? sourceLocation) if (ptype instanceof StorageProxyPType) { properties[prop.name] = ptype } else if (ptype instanceof FunctionPType) { @@ -293,6 +296,7 @@ export class TypeResolver { name: typeName.name, module: typeName.module, baseTypes: [baseType], + sourceLocation, }) } @@ -307,7 +311,20 @@ export class TypeResolver { return this.getSymbolFullName(type.symbol, sourceLocation) } + private getLocationOfSymbol(symbol: ts.Symbol): SourceLocation | undefined { + const declaration = symbol.getDeclarations()?.[0] + + return declaration && SourceLocation.fromNode(declaration, this.programDirectory) + } + + private tryGetLocalSymbolName(symbol: ts.Symbol): string | undefined { + const dec = symbol.getDeclarations()?.[0] as undefined | { localSymbol?: ts.Symbol } + return dec?.localSymbol?.name + } + private getSymbolFullName(symbol: ts.Symbol, sourceLocation: SourceLocation): SymbolName { + const symbolName = symbol.name === 'default' ? (this.tryGetLocalSymbolName(symbol) ?? symbol.name) : symbol.name + const declaration = symbol?.declarations?.[0] if (declaration) { if ( @@ -319,7 +336,7 @@ export class TypeResolver { name: '*', }) } - return new SymbolName({ module: normalisePath(declaration.getSourceFile().fileName, this.programDirectory), name: symbol.name }) + return new SymbolName({ module: normalisePath(declaration.getSourceFile().fileName, this.programDirectory), name: symbolName }) } throw new InternalError(`Symbol does not have a declaration`, { sourceLocation }) } diff --git a/src/compile-options.ts b/src/compile-options.ts index 3e6021a9..adb9aef5 100644 --- a/src/compile-options.ts +++ b/src/compile-options.ts @@ -45,6 +45,7 @@ export const buildCompileOptions = ({ if (p.endsWith('.algo.ts')) { if (fs.existsSync(p)) { const actualPath = normalisePath(p, workingDirectory) + filePaths.push({ matchedInput: p, sourceFile: actualPath, @@ -75,10 +76,21 @@ export const buildCompileOptions = ({ } return { - filePaths, + filePaths: filePaths.map(replaceOutDirTokens), ...rest, getFileFromSource(sourceFile: string): AlgoFile | undefined { - return filePaths.find((p) => p.sourceFile === sourceFile) + return this.filePaths.find((p) => p.sourceFile === sourceFile) }, } } + +function replaceOutDirTokens(algoFile: AlgoFile): AlgoFile { + const replacements = { + name: upath.basename(algoFile.sourceFile).replace('.algo.ts', ''), + } + + return { + ...algoFile, + outDir: algoFile.outDir.replaceAll('[name]', replacements.name), + } +} diff --git a/src/constants.ts b/src/constants.ts index 5c84f32d..4888bfd6 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -6,6 +6,7 @@ export const Constants = { algoTsPackage, arc4ModuleName: `${algoTsPackage}/arc4/index.d.ts`, opModuleName: `${algoTsPackage}/op.d.ts`, + opTypesModuleName: `${algoTsPackage}/op-types.d.ts`, baseContractModuleName: `${algoTsPackage}/base-contract.d.ts`, utilModuleName: `${algoTsPackage}/util.d.ts`, referenceModuleName: `${algoTsPackage}/reference.d.ts`, @@ -18,6 +19,9 @@ export const Constants = { arc4EncodedTypesModuleName: `${algoTsPackage}/arc4/encoded-types.d.ts`, arc4BareDecoratorName: 'arc4.baremethod', arc4AbiDecoratorName: 'arc4.abimethod', - constructorMethodName: 'constructor', + defaultCreateMethodName: '__algots__.defaultCreate', + addressLength: 32, + encodedAddressLength: 58, + zeroAddressEncoded: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ', } as const diff --git a/src/index.ts b/src/index.ts index 29ed4bf1..df2cdf1e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import type ts from 'typescript' -import type { CompilationSet } from './awst/models' import type { AWST } from './awst/nodes' import { buildAwst } from './awst_build' +import type { CompilationSet } from './awst_build/models' import { registerPTypes } from './awst_build/ptypes/register' import { typeRegistry } from './awst_build/type-registry' import type { CompileOptions } from './compile-options' diff --git a/src/logger/sinks/console-log-sink.ts b/src/logger/sinks/console-log-sink.ts index ab99663e..fa1cdccf 100644 --- a/src/logger/sinks/console-log-sink.ts +++ b/src/logger/sinks/console-log-sink.ts @@ -32,8 +32,8 @@ export class ConsoleLogSink implements LogSink { } getSourceSummary(sourceLocation: SourceLocation, indent: number): string { - const sourceFile = LoggingContext.current.sourcesByPath[sourceLocation.file] - if (!sourceFile) return '' + const sourceFile = sourceLocation.file && LoggingContext.current.sourcesByPath[sourceLocation.file] + if (!sourceFile || sourceLocation.scope === 'file') return '' const line = sourceFile[sourceLocation.line - 1] const trimmedLine = line.trimStart() diff --git a/src/puya/build-compilation-set-mapping.ts b/src/puya/build-compilation-set-mapping.ts index d8b53978..53e6e175 100644 --- a/src/puya/build-compilation-set-mapping.ts +++ b/src/puya/build-compilation-set-mapping.ts @@ -1,5 +1,5 @@ -import type { CompilationSet } from '../awst/models' import type { AWST } from '../awst/nodes' +import type { CompilationSet } from '../awst_build/models' import type { AlgoFile } from '../compile-options' import { mkDirIfNotExists } from '../util' import type { CompilationSetMapping } from './options' @@ -13,7 +13,7 @@ export function buildCompilationSetMapping({ inputPaths: AlgoFile[] compilationSet: CompilationSet }): CompilationSetMapping { - const setIds = new Set(compilationSet.map((s) => s.id)) + const setIds = new Set(compilationSet.compilationOutputSet.map((s) => s.id)) return awst.reduce((acc, cur) => { if (setIds.has(cur.id.toString())) { diff --git a/src/puya/index.ts b/src/puya/index.ts index 258d3784..6802befd 100644 --- a/src/puya/index.ts +++ b/src/puya/index.ts @@ -1,6 +1,6 @@ import { AwstSerializer, SnakeCaseSerializer } from '../awst/json-serialize-awst' -import type { CompilationSet } from '../awst/models' import type { AWST } from '../awst/nodes' +import type { CompilationSet } from '../awst_build/models' import type { CompileOptions } from '../compile-options' import { logger, LogLevel } from '../logger' import type { SourceFileMapping } from '../parser' diff --git a/src/util/custom-key-map.ts b/src/util/custom-key-map.ts new file mode 100644 index 00000000..f72ee7d4 --- /dev/null +++ b/src/util/custom-key-map.ts @@ -0,0 +1,56 @@ +import type { DeliberateAny } from '../typescript-helpers' + +type Primitive = number | bigint | string | boolean + +export abstract class CustomKeyMap implements Map { + #keySerializer: (key: TKey) => Primitive + #map = new Map() + + constructor(keySerializer: (key: TKey) => number | bigint | string) { + this.#keySerializer = keySerializer + } + + clear(): void { + this.#map.clear() + } + delete(key: TKey): boolean { + return this.#map.delete(this.#keySerializer(key)) + } + forEach(callbackfn: (value: TValue, key: TKey, map: Map) => void, thisArg?: DeliberateAny): void { + for (const [key, value] of this.#map.values()) { + callbackfn.call(thisArg ?? this, value, key, this) + } + } + get(key: TKey): TValue | undefined { + return this.#map.get(this.#keySerializer(key))?.[1] + } + has(key: TKey): boolean { + return this.#map.has(this.#keySerializer(key)) + } + set(key: TKey, value: TValue): this { + this.#map.set(this.#keySerializer(key), [key, value]) + return this + } + get size(): number { + return this.#map.size + } + entries(): MapIterator<[TKey, TValue]> { + return this.#map.values() + } + *keys(): MapIterator { + for (const [key] of this.#map.values()) { + yield key + } + } + *values(): MapIterator { + for (const [, value] of this.#map.values()) { + yield value + } + } + [Symbol.iterator](): MapIterator<[TKey, TValue]> { + return this.#map.values() + } + get [Symbol.toStringTag](): string { + return this.constructor.name + } +} diff --git a/src/util/generate-temp-file.ts b/src/util/generate-temp-file.ts index cc04b063..cd3b0a8c 100644 --- a/src/util/generate-temp-file.ts +++ b/src/util/generate-temp-file.ts @@ -1,8 +1,10 @@ import { randomUUID } from 'crypto' import fs from 'fs' +import { globIterateSync } from 'glob' import type { WriteFileOptions } from 'node:fs' -import path from 'node:path' import os from 'os' +import upath from 'upath' +import { mkDirIfNotExists } from './index' export type TempFile = { writeFileSync(data: NodeJS.ArrayBufferView, options?: WriteFileOptions): void @@ -11,14 +13,14 @@ export type TempFile = { } & Disposable function ensureTempDir(): string { - const tempDir = path.join(os.tmpdir(), 'puya-ts') - if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir) + const tempDir = upath.join(os.tmpdir(), 'puya-ts') + mkDirIfNotExists(tempDir) return tempDir } export function generateTempFile(options?: { ext?: string }): TempFile { const { ext = 'tmp' } = options ?? {} - const filePath = path.join(ensureTempDir(), `${randomUUID()}.${ext}`) + const filePath = upath.join(ensureTempDir(), `${randomUUID()}.${ext}`) return { get filePath() { @@ -32,3 +34,28 @@ export function generateTempFile(options?: { ext?: string }): TempFile { }, } } +export type TempDir = { + readonly dirPath: string + files(): IterableIterator +} & Disposable + +export function generateTempDir(): TempDir { + const dirPath = upath.join(ensureTempDir(), `${randomUUID()}`) + mkDirIfNotExists(dirPath) + + return { + get dirPath() { + return dirPath + }, + *files(): IterableIterator { + for (const p of globIterateSync(upath.join(dirPath, '**'), { + nodir: true, + })) { + yield p + } + }, + [Symbol.dispose]() { + fs.rmSync(dirPath, { recursive: true, force: true }) + }, + } +} diff --git a/src/util/index.ts b/src/util/index.ts index af563481..7d42bb08 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -199,8 +199,26 @@ export const distinct = (keySelector?: (item: T) => unknown) => { } } +export const distinctByEquality = (areEqual: (a: T, b: T) => boolean) => { + const set: T[] = [] + return (item: T) => { + if (set.some((s) => areEqual(s, item))) return false + set.push(item) + return true + } +} + export function mkDirIfNotExists(dir: string) { if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }) } } + +export const zipStrict = (array1: T1[], array2: T2[]): [T1, T2][] => { + invariant(array1.length === array2.length, 'Array lengths must match') + return array1.map((t1, idx) => [t1, array2[idx]]) +} + +export function isIn(subject: TSubject, items: TItem[]): subject is TItem { + return items.some((i) => i === subject) +} diff --git a/src/write-artifact.ts b/src/write-artifact.ts index b21cac69..ec5bda42 100644 --- a/src/write-artifact.ts +++ b/src/write-artifact.ts @@ -1,6 +1,7 @@ import * as fs from 'node:fs' import upath from 'upath' import { logger } from './logger' +import { mkDirIfNotExists } from './util' export enum ArtifactKind { Awst, @@ -33,5 +34,6 @@ export function writeArtifact({ const content = buildArtifact(obj) logger.info(undefined, `Writing ${outFilePath}`) + mkDirIfNotExists(upath.dirname(outFilePath)) fs.writeFileSync(outFilePath, content, 'utf-8') } diff --git a/tests/approvals/_run.spec.ts b/tests/approvals/_run.spec.ts index afc72422..d4506919 100644 --- a/tests/approvals/_run.spec.ts +++ b/tests/approvals/_run.spec.ts @@ -12,7 +12,7 @@ describe('Approvals', () => { outputAwstJson: false, outputAwst: false, paths: ['tests/approvals'], - outDir: 'out', + outDir: 'out/[name]', dryRun: false, logLevel: LogLevel.Warn, }), diff --git a/tests/approvals/arc4-types.algo.ts b/tests/approvals/arc4-types.algo.ts index efcddaab..ae7bd2ab 100644 --- a/tests/approvals/arc4-types.algo.ts +++ b/tests/approvals/arc4-types.algo.ts @@ -1,31 +1,64 @@ import type { biguint, uint64 } from '@algorandfoundation/algorand-typescript' -import { BaseContract } from '@algorandfoundation/algorand-typescript' -import { DynamicArray, StaticArray, UintN } from '@algorandfoundation/algorand-typescript/arc4' +import { assert, BaseContract, Bytes, Txn } from '@algorandfoundation/algorand-typescript' +import { Address, Byte, DynamicArray, StaticArray, UintN } from '@algorandfoundation/algorand-typescript/arc4' function test(n: uint64, b: biguint, c: UintN<256>) { const x = new UintN<8>(4) + assert(x.bytes.length === 1) const x2 = new UintN<8>(255n) + assert(x2.bytes === Bytes.fromHex('ff')) + const y = new UintN<16>() + assert(y.bytes.length === 2) const z = new UintN<8>(n) const z_native = z.native + assert(z_native === n) const a = new UintN<128>(b) const a_native = a.native + assert(a_native === b) } type ARC4Uint64 = UintN<64> -function test_arrays(n: ARC4Uint64) { +function testArrays(n: ARC4Uint64) { const myArray = new DynamicArray(n, n, n) + myArray.push(n) + const myStatic = new StaticArray(n, n) - const myStatic2 = new StaticArray(n, n, n) + assert(myStatic[0].equals(myArray.pop())) + + myStatic[1] = new UintN<64>(50) + + // const myStatic2 = new StaticArray(n, n, n) +} + +function testByte() { + const b = new Byte() + const b2 = new Byte(0) + assert(b.equals(b2)) +} + +function testAddress() { + const a = new Address() + const b = new Address(Txn.sender) + + assert(!a.equals(b), 'Zero address should not match sender') + assert(a.equals(new Address()), 'Two zero addresses should match') + assert(a[0].equals(new Byte()), 'Zero address should start with zero byte') } export class Arc4TypesTestContract extends BaseContract { + public getArc4Values(): [Byte, UintN<8>, Address] { + return [new Byte(), new UintN(255), new Address()] + } + public approvalProgram(): boolean { test(1, 2n, new UintN<256>(4)) - test_arrays(new UintN<64>(65)) + testByte() + testArrays(new UintN<64>(65)) + testAddress() return true } diff --git a/tests/approvals/assert-match.algo.ts b/tests/approvals/assert-match.algo.ts index 43efcf4f..116b567e 100644 --- a/tests/approvals/assert-match.algo.ts +++ b/tests/approvals/assert-match.algo.ts @@ -1,5 +1,11 @@ import { assertMatch, BaseContract, Global, gtxn, Txn } from '@algorandfoundation/algorand-typescript' +function testSelf() { + assertMatch(Txn, { + receiver: Global.currentApplicationAddress, + }) +} + function test(x: gtxn.PaymentTxn) { assertMatch(x, { amount: { between: [0, 50000] }, diff --git a/tests/approvals/call-expressions.algo.ts b/tests/approvals/call-expressions.algo.ts index 30cdf595..fe6f3c4a 100644 --- a/tests/approvals/call-expressions.algo.ts +++ b/tests/approvals/call-expressions.algo.ts @@ -1,7 +1,7 @@ import type { uint64 } from '@algorandfoundation/algorand-typescript' -import { Contract } from '@algorandfoundation/algorand-typescript' +import { BaseContract } from '@algorandfoundation/algorand-typescript' -abstract class ExampleBase extends Contract { +abstract class ExampleBase extends BaseContract { protected baseMethod(): uint64 { return 2 } diff --git a/tests/approvals/destructuring-iterators.algo.ts b/tests/approvals/destructuring-iterators.algo.ts new file mode 100644 index 00000000..729a8c34 --- /dev/null +++ b/tests/approvals/destructuring-iterators.algo.ts @@ -0,0 +1,15 @@ +import type { uint64 } from '@algorandfoundation/algorand-typescript' +import { assert, Uint64 } from '@algorandfoundation/algorand-typescript' + +function test() { + const items = [ + { a: Uint64(1), b: Uint64(2) }, + { a: Uint64(2), b: Uint64(2) }, + { a: Uint64(3), b: Uint64(2) }, + ] as const + let total: uint64 = 0 + for (const { a } of items) { + total += a + } + assert(total === 6) +} diff --git a/tests/approvals/global-state.algo.ts b/tests/approvals/global-state.algo.ts index d5068bef..32068a81 100644 --- a/tests/approvals/global-state.algo.ts +++ b/tests/approvals/global-state.algo.ts @@ -1,7 +1,7 @@ import type { bytes, uint64 } from '@algorandfoundation/algorand-typescript' -import { assert, Bytes, Contract, GlobalState, op, Txn, Uint64 } from '@algorandfoundation/algorand-typescript' +import { assert, BaseContract, Bytes, GlobalState, op, Txn, Uint64 } from '@algorandfoundation/algorand-typescript' -export class BaseTestContract extends Contract { +export abstract class BaseTestContract extends BaseContract { baseTestState = GlobalState({ initialValue: 'testing 123' }) } diff --git a/tests/approvals/implicit-create.algo.ts b/tests/approvals/implicit-create.algo.ts new file mode 100644 index 00000000..4ce51ed6 --- /dev/null +++ b/tests/approvals/implicit-create.algo.ts @@ -0,0 +1,23 @@ +import { abimethod, Contract } from '@algorandfoundation/algorand-typescript' +import { baremethod } from '@algorandfoundation/algorand-typescript/arc4' + +export class NoBare extends Contract { + @abimethod({ allowActions: 'NoOp' }) + public handleNoop() {} +} +export class NoNoOp extends Contract { + @baremethod({ allowActions: 'UpdateApplication' }) + public handleUpdate() {} +} + +class BaseWithBareCreate extends Contract { + @baremethod({ onCreate: 'require' }) + public create() {} +} +class BaseWithAbiCreate extends Contract { + @abimethod({ onCreate: 'require' }) + public create() {} +} +export class ExplicitBareCreateFromBase extends BaseWithBareCreate {} + +export class ExplicitAbiCreateFromBase extends BaseWithAbiCreate {} diff --git a/tests/approvals/inheritance-b.algo.ts b/tests/approvals/inheritance-b.algo.ts index 8b245ce7..c364e88a 100644 --- a/tests/approvals/inheritance-b.algo.ts +++ b/tests/approvals/inheritance-b.algo.ts @@ -1,6 +1,6 @@ import type { uint64 } from '@algorandfoundation/algorand-typescript' -import { Contract, op, Txn } from '@algorandfoundation/algorand-typescript' -import { SimpleContract } from './inheritance-a.algo' +import { op, Txn } from '@algorandfoundation/algorand-typescript' +import { Arc4Contract, SimpleContract } from './inheritance-a.algo' export class ConcreteSimpleContract extends SimpleContract { public approvalProgram(): uint64 { @@ -10,4 +10,4 @@ export class ConcreteSimpleContract extends SimpleContract { } } -export class ConcreteArc4Contract extends Contract {} +export class ConcreteArc4Contract extends Arc4Contract {} diff --git a/tests/approvals/out/.gitignore b/tests/approvals/out/.gitignore deleted file mode 100644 index 0e5d3de4..00000000 --- a/tests/approvals/out/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore puya build artifacts for now -*.teal -*.arc32.json -*.ir diff --git a/tests/approvals/out/Arc4TypesTestContract.approval.teal b/tests/approvals/out/Arc4TypesTestContract.approval.teal deleted file mode 100644 index 6fd24013..00000000 --- a/tests/approvals/out/Arc4TypesTestContract.approval.teal +++ /dev/null @@ -1,28 +0,0 @@ -#pragma version 10 - -tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.approvalProgram: - // C:/Source/algorand/puya-ts/tests/approvals/arc4-types.algo.ts:28 - // test(1, 2n, new UintN<256>(4)) - int 1 - byte 0x02 - byte 0x04 - callsub test - // C:/Source/algorand/puya-ts/tests/approvals/arc4-types.algo.ts:31 - // return true - int 1 - return - - -// tests/approvals/arc4-types.algo.ts::test(n: uint64, b: bytes, c: bytes) -> void: -test: - // C:/Source/algorand/puya-ts/tests/approvals/arc4-types.algo.ts:6 - // function test(n: uint64, b: biguint, c: UintN<256>) { - proto 3 0 - // C:/Source/algorand/puya-ts/tests/approvals/arc4-types.algo.ts:12 - // const a = new UintN<128>(b) - frame_dig -2 - len - int 16 - <= - assert // overflow - retsub diff --git a/tests/approvals/out/Arc4TypesTestContract.clear.teal b/tests/approvals/out/Arc4TypesTestContract.clear.teal deleted file mode 100644 index 269c5719..00000000 --- a/tests/approvals/out/Arc4TypesTestContract.clear.teal +++ /dev/null @@ -1,5 +0,0 @@ -#pragma version 10 - -tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.clearStateProgram: - int 1 - return diff --git a/tests/approvals/out/Arc4TypesTestContract.ssa.ir b/tests/approvals/out/Arc4TypesTestContract.ssa.ir deleted file mode 100644 index eb30bd76..00000000 --- a/tests/approvals/out/Arc4TypesTestContract.ssa.ir +++ /dev/null @@ -1,57 +0,0 @@ -contract tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract: - program approval: - subroutine tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.approvalProgram() -> bool: - block@0: // L27 - let app_id%0#0: uint64 = (txn ApplicationID) - goto app_id%0#0 ? block@2 : block@1 - block@1: // on_create_L26 - tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.constructor() - goto block@2 - block@2: // entrypoint_L26 - tests/approvals/arc4-types.algo.ts::test(1u, 2b, 0x04) - tests/approvals/arc4-types.algo.ts::test_arrays(0x41) - return 1u - - subroutine tests/approvals/arc4-types.algo.ts::test(n: uint64, b: biguint, c: bytes) -> void: - block@0: // L6 - let x#0: bytes = 0x04 - let x2#0: bytes = 0xff - let y#0: bytes = 0x00 - let val_as_bytes%0#0: bytes = (itob n#0) - let z#0: bytes = ((extract 7 1) val_as_bytes%0#0) - let z_native#0: uint64 = (btoi z#0) - let len_%0#0: uint64 = (len b#0) - let no_overflow%0#0: bool = (<= len_%0#0 16u) - (assert no_overflow%0#0) // overflow - let b_zeros%0#0: bytes = (bzero 16u) - let a#0: bytes = (b| b#0 b_zeros%0#0) - let reinterpret_biguint%0#0: biguint = a#0 - let a_native#0: biguint = reinterpret_biguint%0#0 - return - - subroutine tests/approvals/arc4-types.algo.ts::test_arrays(n: bytes) -> void: - block@0: // L18 - let result%0#0: bytes = (concat 0x n#0) - let result%1#0: bytes = (concat result%0#0 n#0) - let result%2#0: bytes = (concat result%1#0 n#0) - let array_data%0#0: bytes = (concat 0x0003 result%2#0) - let myArray#0: bytes = array_data%0#0 - let result%3#0: bytes = (concat 0x n#0) - let result%4#0: bytes = (concat result%3#0 n#0) - let array_data%1#0: bytes = (concat 0x result%4#0) - let myStatic#0: bytes = array_data%1#0 - let result%5#0: bytes = (concat 0x n#0) - let result%6#0: bytes = (concat result%5#0 n#0) - let result%7#0: bytes = (concat result%6#0 n#0) - let array_data%2#0: bytes = (concat 0x result%7#0) - let myStatic2#0: bytes = array_data%2#0 - return - - subroutine tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.constructor() -> void: - block@0: // L26 - return - - program clear-state: - subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: - block@0: // L1 - return 1u diff --git a/tests/approvals/out/AssertMatchContract.approval.teal b/tests/approvals/out/AssertMatchContract.approval.teal deleted file mode 100644 index daf957b7..00000000 --- a/tests/approvals/out/AssertMatchContract.approval.teal +++ /dev/null @@ -1,87 +0,0 @@ -#pragma version 10 - -tests/approvals/assert-match.algo.ts::AssertMatchContract.approvalProgram: - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:16 - // const txn = gtxn.PayTxn(1) - int 1 - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:17 - // test(txn) - callsub test - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:18 - // return true - int 1 - return - - -// tests/approvals/assert-match.algo.ts::test(x: uint64) -> void: -test: - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:3 - // function test(x: gtxn.PayTxn) { - proto 1 0 - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - frame_dig -1 - gtxns Amount - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:5 - // amount: { between: [0, 50000] }, - int 50000 - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - <= - bz test_bool_false@8 - frame_dig -1 - gtxns CloseRemainderTo - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:8 - // closeRemainderTo: Global.zeroAddress, - global ZeroAddress - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - == - bz test_bool_false@8 - frame_dig -1 - gtxns FirstValid - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:9 - // firstValid: { greaterThan: 1 }, - int 1 - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - > - bz test_bool_false@8 - frame_dig -1 - gtxns LastValid - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:10 - // lastValid: { lessThan: 2 ** 40 }, - int 1099511627776 - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - < - bz test_bool_false@8 - frame_dig -1 - gtxns Receiver - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:7 - // receiver: Global.currentApplicationAddress, - global CurrentApplicationAddress - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - == - bz test_bool_false@8 - frame_dig -1 - gtxns Sender - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:6 - // sender: Txn.sender, - txn Sender - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - == - bz test_bool_false@8 - int 1 - b test_bool_merge@9 - -test_bool_false@8: - int 0 - -test_bool_merge@9: - // C:/Source/algorand/puya-ts/tests/approvals/assert-match.algo.ts:4 - // assertMatch(x, { - assert // assert target is match for conditions - retsub diff --git a/tests/approvals/out/AssertMatchContract.clear.teal b/tests/approvals/out/AssertMatchContract.clear.teal deleted file mode 100644 index e599c81f..00000000 --- a/tests/approvals/out/AssertMatchContract.clear.teal +++ /dev/null @@ -1,5 +0,0 @@ -#pragma version 10 - -tests/approvals/assert-match.algo.ts::AssertMatchContract.clearStateProgram: - int 1 - return diff --git a/tests/approvals/out/EnsureBudgetContract.approval.teal b/tests/approvals/out/EnsureBudgetContract.approval.teal deleted file mode 100644 index 1883328d..00000000 --- a/tests/approvals/out/EnsureBudgetContract.approval.teal +++ /dev/null @@ -1,69 +0,0 @@ -#pragma version 10 - -tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract.approvalProgram: - // C:/Source/algorand/puya-ts/tests/approvals/ensure-budget.algo.ts:5 - // ensureBudget(100) - int 100 - int 0 - callsub ensure_budget - // C:/Source/algorand/puya-ts/tests/approvals/ensure-budget.algo.ts:6 - // ensureBudget(100, OpUpFeeSource.GroupCredit) - int 100 - int 0 - callsub ensure_budget - // C:/Source/algorand/puya-ts/tests/approvals/ensure-budget.algo.ts:7 - // ensureBudget(100, OpUpFeeSource.AppAccount) - int 100 - int 1 - callsub ensure_budget - // C:/Source/algorand/puya-ts/tests/approvals/ensure-budget.algo.ts:8 - // ensureBudget(100, OpUpFeeSource.Any) - int 100 - int 2 - callsub ensure_budget - // C:/Source/algorand/puya-ts/tests/approvals/ensure-budget.algo.ts:10 - // return true - int 1 - return - - -// _puya_lib.util.ensure_budget(required_budget: uint64, fee_source: uint64) -> void: -ensure_budget: - proto 2 0 - frame_dig -2 - int 10 - + - -ensure_budget_while_top@1: - frame_dig 0 - global OpcodeBudget - > - bz ensure_budget_after_while@7 - itxn_begin - int appl - itxn_field TypeEnum - int DeleteApplication - itxn_field OnCompletion - byte 0x068101 - itxn_field ApprovalProgram - byte 0x068101 - itxn_field ClearStateProgram - frame_dig -1 - switch ensure_budget_switch_case_0@3 ensure_budget_switch_case_1@4 - b ensure_budget_switch_case_next@6 - -ensure_budget_switch_case_0@3: - int 0 - itxn_field Fee - b ensure_budget_switch_case_next@6 - -ensure_budget_switch_case_1@4: - global MinTxnFee - itxn_field Fee - -ensure_budget_switch_case_next@6: - itxn_submit - b ensure_budget_while_top@1 - -ensure_budget_after_while@7: - retsub diff --git a/tests/approvals/out/EnsureBudgetContract.clear.teal b/tests/approvals/out/EnsureBudgetContract.clear.teal deleted file mode 100644 index 89322ed2..00000000 --- a/tests/approvals/out/EnsureBudgetContract.clear.teal +++ /dev/null @@ -1,5 +0,0 @@ -#pragma version 10 - -tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract.clearStateProgram: - int 1 - return diff --git a/tests/approvals/out/abi-decorators/AbiDecorators.arc32.json b/tests/approvals/out/abi-decorators/AbiDecorators.arc32.json new file mode 100644 index 00000000..eb54016c --- /dev/null +++ b/tests/approvals/out/abi-decorators/AbiDecorators.arc32.json @@ -0,0 +1,140 @@ +{ + "hints": { + "justNoop()void": { + "call_config": { + "no_op": "CALL" + } + }, + "createMethod()void": { + "call_config": { + "no_op": "CREATE" + } + }, + "allActions()void": { + "call_config": { + "no_op": "CALL", + "opt_in": "CALL", + "close_out": "CALL", + "delete_application": "CALL", + "update_application": "CALL" + } + }, + "overrideReadonlyName()uint64": { + "read_only": true, + "call_config": { + "no_op": "CALL" + } + }, + "methodWithDefaults(uint64,uint64,uint64)uint64": { + "default_arguments": { + "a": { + "source": "global-state", + "data": "globalValue" + }, + "b": { + "source": "abi-method", + "data": { + "name": "overrideReadonlyName", + "args": [], + "readonly": true, + "returns": { + "type": "uint64" + } + } + } + }, + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvYWJpLWRlY29yYXRvcnMuYWxnby50czo6QWJpRGVjb3JhdG9ycy5hcHByb3ZhbFByb2dyYW06CiAgICBpbnRjYmxvY2sgMSAwCiAgICBieXRlY2Jsb2NrIDB4MTUxZjdjNzUKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9hZnRlcl9pZl9lbHNlQDIKICAgIGNhbGxzdWIgY29uc3RydWN0b3IKCm1haW5fYWZ0ZXJfaWZfZWxzZUAyOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAgcmV0dXJuCgoKLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6OkFiaURlY29yYXRvcnMuY29uc3RydWN0b3IoKSAtPiB2b2lkOgpjb25zdHJ1Y3RvcjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjQKICAgIC8vIGV4cG9ydCBkZWZhdWx0IGNsYXNzIEFiaURlY29yYXRvcnMgZXh0ZW5kcyBDb250cmFjdCB7CiAgICBwcm90byAwIDAKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjE2CiAgICAvLyBnbG9iYWxWYWx1ZSA9IEdsb2JhbFN0YXRlKHsgaW5pdGlhbFZhbHVlOiBVaW50NjQoMTIzKSB9KQogICAgcHVzaGJ5dGVzICJnbG9iYWxWYWx1ZSIKICAgIHB1c2hpbnQgMTIzIC8vIDEyMwogICAgYXBwX2dsb2JhbF9wdXQKICAgIHJldHN1YgoKCi8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjpBYmlEZWNvcmF0b3JzLl9fcHV5YV9hcmM0X3JvdXRlcl9fKCkgLT4gdWludDY0OgpfX3B1eWFfYXJjNF9yb3V0ZXJfXzoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjQKICAgIC8vIGV4cG9ydCBkZWZhdWx0IGNsYXNzIEFiaURlY29yYXRvcnMgZXh0ZW5kcyBDb250cmFjdCB7CiAgICBwcm90byAwIDEKICAgIHR4biBOdW1BcHBBcmdzCiAgICBieiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDEwCiAgICBwdXNoYnl0ZXNzIDB4ZjkwMjBkNWEgMHhlMTc5ZjlkNCAweDYzYzI3YWJhIDB4MTRkMWI2ZWEgMHhjMTM2NzM3NCAvLyBtZXRob2QgImp1c3ROb29wKCl2b2lkIiwgbWV0aG9kICJjcmVhdGVNZXRob2QoKXZvaWQiLCBtZXRob2QgImFsbEFjdGlvbnMoKXZvaWQiLCBtZXRob2QgIm92ZXJyaWRlUmVhZG9ubHlOYW1lKCl1aW50NjQiLCBtZXRob2QgIm1ldGhvZFdpdGhEZWZhdWx0cyh1aW50NjQsdWludDY0LHVpbnQ2NCl1aW50NjQiCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAwCiAgICBtYXRjaCBfX3B1eWFfYXJjNF9yb3V0ZXJfX19qdXN0Tm9vcF9yb3V0ZUAyIF9fcHV5YV9hcmM0X3JvdXRlcl9fX2NyZWF0ZU1ldGhvZF9yb3V0ZUAzIF9fcHV5YV9hcmM0X3JvdXRlcl9fX2FsbEFjdGlvbnNfcm91dGVANCBfX3B1eWFfYXJjNF9yb3V0ZXJfX19vdmVycmlkZVJlYWRvbmx5TmFtZV9yb3V0ZUA1IF9fcHV5YV9hcmM0X3JvdXRlcl9fX21ldGhvZFdpdGhEZWZhdWx0c19yb3V0ZUA2CiAgICBpbnRjXzEgLy8gMAogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19qdXN0Tm9vcF9yb3V0ZUAyOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6NQogICAgLy8gQGFiaW1ldGhvZCh7IGFsbG93QWN0aW9uczogJ05vT3AnIH0pCiAgICB0eG4gT25Db21wbGV0aW9uCiAgICAhCiAgICBhc3NlcnQgLy8gT25Db21wbGV0aW9uIGlzIE5vT3AKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBhc3NlcnQgLy8gaXMgbm90IGNyZWF0aW5nCiAgICBpbnRjXzAgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19jcmVhdGVNZXRob2Rfcm91dGVAMzoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjcKICAgIC8vIEBhYmltZXRob2QoeyBvbkNyZWF0ZTogJ3JlcXVpcmUnIH0pCiAgICB0eG4gT25Db21wbGV0aW9uCiAgICAhCiAgICBhc3NlcnQgLy8gT25Db21wbGV0aW9uIGlzIE5vT3AKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICAhCiAgICBhc3NlcnQgLy8gaXMgY3JlYXRpbmcKICAgIGludGNfMCAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2FsbEFjdGlvbnNfcm91dGVANDoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjkKICAgIC8vIEBhYmltZXRob2QoeyBhbGxvd0FjdGlvbnM6IFsnTm9PcCcsICdPcHRJbicsICdDbG9zZU91dCcsICdEZWxldGVBcHBsaWNhdGlvbicsICdVcGRhdGVBcHBsaWNhdGlvbiddIH0pCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYXNzZXJ0IC8vIGlzIG5vdCBjcmVhdGluZwogICAgaW50Y18wIC8vIDEKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fb3ZlcnJpZGVSZWFkb25seU5hbWVfcm91dGVANToKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjExCiAgICAvLyBAYWJpbWV0aG9kKHsgcmVhZG9ubHk6IHRydWUsIG5hbWU6ICdvdmVycmlkZVJlYWRvbmx5TmFtZScgfSkKICAgIHR4biBPbkNvbXBsZXRpb24KICAgICEKICAgIGFzc2VydCAvLyBPbkNvbXBsZXRpb24gaXMgTm9PcAogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGFzc2VydCAvLyBpcyBub3QgY3JlYXRpbmcKICAgIGNhbGxzdWIgcmVhZG9ubHkKICAgIGl0b2IKICAgIGJ5dGVjXzAgLy8gMHgxNTFmN2M3NQogICAgc3dhcAogICAgY29uY2F0CiAgICBsb2cKICAgIGludGNfMCAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX21ldGhvZFdpdGhEZWZhdWx0c19yb3V0ZUA2OgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6MTgKICAgIC8vIEBhYmltZXRob2QoeyBkZWZhdWx0QXJndW1lbnRzOiB7IGE6IHsgZnJvbTogJ2dsb2JhbFZhbHVlJyB9LCBiOiB7IGZyb206ICdyZWFkb25seScgfSwgYzogeyBjb25zdGFudDogMTQ1IH0gfSB9KQogICAgdHhuIE9uQ29tcGxldGlvbgogICAgIQogICAgYXNzZXJ0IC8vIE9uQ29tcGxldGlvbiBpcyBOb09wCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYXNzZXJ0IC8vIGlzIG5vdCBjcmVhdGluZwogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6NAogICAgLy8gZXhwb3J0IGRlZmF1bHQgY2xhc3MgQWJpRGVjb3JhdG9ycyBleHRlbmRzIENvbnRyYWN0IHsKICAgIHR4bmEgQXBwbGljYXRpb25BcmdzIDEKICAgIGJ0b2kKICAgIHR4bmEgQXBwbGljYXRpb25BcmdzIDIKICAgIGJ0b2kKICAgIHR4bmEgQXBwbGljYXRpb25BcmdzIDMKICAgIGJ0b2kKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hYmktZGVjb3JhdG9ycy5hbGdvLnRzOjE4CiAgICAvLyBAYWJpbWV0aG9kKHsgZGVmYXVsdEFyZ3VtZW50czogeyBhOiB7IGZyb206ICdnbG9iYWxWYWx1ZScgfSwgYjogeyBmcm9tOiAncmVhZG9ubHknIH0sIGM6IHsgY29uc3RhbnQ6IDE0NSB9IH0gfSkKICAgIGNhbGxzdWIgbWV0aG9kV2l0aERlZmF1bHRzCiAgICBpdG9iCiAgICBieXRlY18wIC8vIDB4MTUxZjdjNzUKICAgIHN3YXAKICAgIGNvbmNhdAogICAgbG9nCiAgICBpbnRjXzAgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDEwOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6NAogICAgLy8gZXhwb3J0IGRlZmF1bHQgY2xhc3MgQWJpRGVjb3JhdG9ycyBleHRlbmRzIENvbnRyYWN0IHsKICAgIGludGNfMSAvLyAwCiAgICByZXRzdWIKCgovLyB0ZXN0cy9hcHByb3ZhbHMvYWJpLWRlY29yYXRvcnMuYWxnby50czo6QWJpRGVjb3JhdG9ycy5yZWFkb25seSgpIC0+IHVpbnQ2NDoKcmVhZG9ubHk6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWJpLWRlY29yYXRvcnMuYWxnby50czoxMS0xMgogICAgLy8gQGFiaW1ldGhvZCh7IHJlYWRvbmx5OiB0cnVlLCBuYW1lOiAnb3ZlcnJpZGVSZWFkb25seU5hbWUnIH0pCiAgICAvLyBwdWJsaWMgcmVhZG9ubHkoKTogdWludDY0IHsKICAgIHByb3RvIDAgMQogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6MTMKICAgIC8vIHJldHVybiA1CiAgICBwdXNoaW50IDUgLy8gNQogICAgcmV0c3ViCgoKLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6OkFiaURlY29yYXRvcnMubWV0aG9kV2l0aERlZmF1bHRzKGE6IHVpbnQ2NCwgYjogdWludDY0LCBjOiB1aW50NjQpIC0+IHVpbnQ2NDoKbWV0aG9kV2l0aERlZmF1bHRzOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6MTgtMTkKICAgIC8vIEBhYmltZXRob2QoeyBkZWZhdWx0QXJndW1lbnRzOiB7IGE6IHsgZnJvbTogJ2dsb2JhbFZhbHVlJyB9LCBiOiB7IGZyb206ICdyZWFkb25seScgfSwgYzogeyBjb25zdGFudDogMTQ1IH0gfSB9KQogICAgLy8gcHVibGljIG1ldGhvZFdpdGhEZWZhdWx0cyhhOiB1aW50NjQsIGI6IHVpbnQ2NCwgYzogdWludDY0KTogdWludDY0IHsKICAgIHByb3RvIDMgMQogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FiaS1kZWNvcmF0b3JzLmFsZ28udHM6MjAKICAgIC8vIHJldHVybiBhICogYiArIGMKICAgIGZyYW1lX2RpZyAtMwogICAgZnJhbWVfZGlnIC0yCiAgICAqCiAgICBmcmFtZV9kaWcgLTEKICAgICsKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvYWJpLWRlY29yYXRvcnMuYWxnby50czo6QWJpRGVjb3JhdG9ycy5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 1 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "globalValue": { + "type": "uint64", + "key": "globalValue" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "AbiDecorators", + "methods": [ + { + "name": "justNoop", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + }, + { + "name": "createMethod", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + }, + { + "name": "allActions", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + }, + { + "name": "overrideReadonlyName", + "args": [], + "readonly": true, + "returns": { + "type": "uint64" + } + }, + { + "name": "methodWithDefaults", + "args": [ + { + "type": "uint64", + "name": "a" + }, + { + "type": "uint64", + "name": "b" + }, + { + "type": "uint64", + "name": "c" + } + ], + "readonly": false, + "returns": { + "type": "uint64" + } + } + ], + "networks": {} + }, + "bare_call_config": {} +} \ No newline at end of file diff --git a/tests/approvals/out/abi-decorators/AbiDecorators.ssa.ir b/tests/approvals/out/abi-decorators/AbiDecorators.ssa.ir new file mode 100644 index 00000000..d5ea9aab --- /dev/null +++ b/tests/approvals/out/abi-decorators/AbiDecorators.ssa.ir @@ -0,0 +1,115 @@ +contract tests/approvals/abi-decorators.algo.ts::AbiDecorators: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/abi-decorators.algo.ts::AbiDecorators.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/abi-decorators.algo.ts::AbiDecorators.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/abi-decorators.algo.ts::AbiDecorators.constructor() -> void: + block@0: // L4 + (app_global_put "globalValue" 123u) + return + + subroutine tests/approvals/abi-decorators.algo.ts::AbiDecorators.__puya_arc4_router__() -> bool: + block@0: // L4 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@9 + block@1: // abi_routing_L4 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "justNoop()void" => block@2, method "createMethod()void" => block@3, method "allActions()void" => block@4, method "overrideReadonlyName()uint64" => block@5, method "methodWithDefaults(uint64,uint64,uint64)uint64" => block@6, * => block@7} + block@2: // justNoop_route_L5 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // is not creating + tests/approvals/abi-decorators.algo.ts::AbiDecorators.justNoop() + return 1u + block@3: // createMethod_route_L7 + let tmp%7#0: uint64 = (txn OnCompletion) + let tmp%8#0: bool = (== tmp%7#0 NoOp) + (assert tmp%8#0) // OnCompletion is NoOp + let tmp%9#0: uint64 = (txn ApplicationID) + let tmp%10#0: bool = (== tmp%9#0 0u) + (assert tmp%10#0) // is creating + tests/approvals/abi-decorators.algo.ts::AbiDecorators.createMethod() + return 1u + block@4: // allActions_route_L9 + let tmp%11#0: uint64 = (txn ApplicationID) + let tmp%12#0: bool = (!= tmp%11#0 0u) + (assert tmp%12#0) // is not creating + tests/approvals/abi-decorators.algo.ts::AbiDecorators.allActions() + return 1u + block@5: // overrideReadonlyName_route_L11 + let tmp%13#0: uint64 = (txn OnCompletion) + let tmp%14#0: bool = (== tmp%13#0 NoOp) + (assert tmp%14#0) // OnCompletion is NoOp + let tmp%15#0: uint64 = (txn ApplicationID) + let tmp%16#0: bool = (!= tmp%15#0 0u) + (assert tmp%16#0) // is not creating + let to_encode%0#0: uint64 = tests/approvals/abi-decorators.algo.ts::AbiDecorators.readonly() + let val_as_bytes%0#0: bytes = (itob to_encode%0#0) + let tmp%17#0: bytes = (concat 0x151f7c75 val_as_bytes%0#0) + (log tmp%17#0) + return 1u + block@6: // methodWithDefaults_route_L18 + let tmp%18#0: uint64 = (txn OnCompletion) + let tmp%19#0: bool = (== tmp%18#0 NoOp) + (assert tmp%19#0) // OnCompletion is NoOp + let tmp%20#0: uint64 = (txn ApplicationID) + let tmp%21#0: bool = (!= tmp%20#0 0u) + (assert tmp%21#0) // is not creating + let tmp%22#0: bytes = (txna ApplicationArgs 1) + let tmp%23#0: uint64 = (btoi tmp%22#0) + let tmp%24#0: bytes = (txna ApplicationArgs 2) + let tmp%25#0: uint64 = (btoi tmp%24#0) + let tmp%26#0: bytes = (txna ApplicationArgs 3) + let tmp%27#0: uint64 = (btoi tmp%26#0) + let to_encode%1#0: uint64 = tests/approvals/abi-decorators.algo.ts::AbiDecorators.methodWithDefaults(tmp%23#0, tmp%25#0, tmp%27#0) + let val_as_bytes%1#0: bytes = (itob to_encode%1#0) + let tmp%28#0: bytes = (concat 0x151f7c75 val_as_bytes%1#0) + (log tmp%28#0) + return 1u + block@7: // switch_case_default_L4 + goto block@8 + block@8: // switch_case_next_L4 + goto block@10 + block@9: // bare_routing_L4 + goto block@10 + block@10: // after_if_else_L4 + return 0u + + subroutine tests/approvals/abi-decorators.algo.ts::AbiDecorators.justNoop() -> void: + block@0: // L5 + return + + subroutine tests/approvals/abi-decorators.algo.ts::AbiDecorators.createMethod() -> void: + block@0: // L7 + return + + subroutine tests/approvals/abi-decorators.algo.ts::AbiDecorators.allActions() -> void: + block@0: // L9 + return + + subroutine tests/approvals/abi-decorators.algo.ts::AbiDecorators.readonly() -> uint64: + block@0: // L11 + return 5u + + subroutine tests/approvals/abi-decorators.algo.ts::AbiDecorators.methodWithDefaults(a: uint64, b: uint64, c: uint64) -> uint64: + block@0: // L18 + let tmp%0#0: uint64 = (* a#0 b#0) + let tmp%1#0: uint64 = (+ tmp%0#0 c#0) + return tmp%1#0 + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/abi-decorators.awst b/tests/approvals/out/abi-decorators/abi-decorators.awst similarity index 51% rename from tests/approvals/out/abi-decorators.awst rename to tests/approvals/out/abi-decorators/abi-decorators.awst index 0fe6d559..e42f0290 100644 --- a/tests/approvals/out/abi-decorators.awst +++ b/tests/approvals/out/abi-decorators/abi-decorators.awst @@ -1,12 +1,19 @@ -contract AbiDecorators extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract +contract AbiDecorators { globals { ["globalValue"]: uint64 } - constructor(): void + approvalProgram(): bool { - void - GlobalState["globalValue"]: uint64 = 123 + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True } justNoop(): void @@ -31,4 +38,19 @@ contract AbiDecorators extends @algorandfoundation/algorand-typescript/arc4/inde return a * b + c } + constructor(): void + { + void + GlobalState["globalValue"]: uint64 = 123 + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + } \ No newline at end of file diff --git a/tests/approvals/out/abi-decorators.awst.json b/tests/approvals/out/abi-decorators/abi-decorators.awst.json similarity index 54% rename from tests/approvals/out/abi-decorators.awst.json rename to tests/approvals/out/abi-decorators/abi-decorators.awst.json index df465d9c..47fa1b1b 100644 --- a/tests/approvals/out/abi-decorators.awst.json +++ b/tests/approvals/out/abi-decorators/abi-decorators.awst.json @@ -1,137 +1,285 @@ [ { - "_type": "ContractFragment", + "_type": "Contract", "source_location": { "file": "tests/approvals/abi-decorators.algo.ts", "line": 4, - "end_line": 22, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 53 }, - "id": "tests/approvals/abi-decorators.algo.ts::default", + "id": "tests/approvals/abi-decorators.algo.ts::AbiDecorators", "name": "AbiDecorators", - "bases": [ + "description": null, + "method_resolution_order": [ "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" ], - "init": { + "approval_program": { "_type": "ContractMethod", "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 4, - "end_line": 22, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "args": [], "return_type": { "_type": "WType", - "name": "void", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": null + "scalar_type": 2 }, "body": { "_type": "Block", "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 4, - "end_line": 22, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "body": [ { - "_type": "ExpressionStatement", + "_type": "IfElse", "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 4, - "end_line": 22, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, - "expr": { - "_type": "VoidConstant", + "condition": { + "_type": "Not", "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 4, - "end_line": 22, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "wtype": { "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 16, - "end_line": 16, - "column": 2, - "end_column": 58 - }, - "target": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 16, - "end_line": 16, - "column": 2, - "end_column": 13 - }, - "wtype": { - "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 }, - "key": { - "_type": "BytesConstant", + "expr": { + "_type": "ReinterpretCast", "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 16, - "end_line": 16, - "column": 2, - "end_column": 13 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "wtype": { "_type": "WType", - "name": "state_key", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, - "value": "XKZg`VQf}mY;|P", - "encoding": "utf8" + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, - "exists_assertion_message": null + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "value": { - "_type": "IntegerConstant", + "_type": "BoolConstant", "source_location": { - "file": "tests/approvals/abi-decorators.algo.ts", - "line": 16, - "end_line": 16, - "column": 51, - "end_column": 54 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 }, - "value": "123", - "teal_alias": null + "value": true } } ], @@ -144,15 +292,11 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/abi-decorators.algo.ts::default", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null }, - "approval_program": null, - "clear_program": null, - "subroutines": [ + "methods": [ { "_type": "ContractMethod", "source_location": { @@ -160,7 +304,7 @@ "line": 5, "end_line": 6, "column": 2, - "end_column": 28 + "end_column": 25 }, "args": [], "return_type": { @@ -189,7 +333,7 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/abi-decorators.algo.ts::default", + "cref": "tests/approvals/abi-decorators.algo.ts::AbiDecorators", "member_name": "justNoop", "arc4_method_config": { "_type": "ARC4ABIMethodConfig", @@ -209,9 +353,7 @@ ], "default_args": {}, "structs": {} - }, - "synthetic": false, - "inheritable": true + } }, { "_type": "ContractMethod", @@ -220,7 +362,7 @@ "line": 7, "end_line": 8, "column": 2, - "end_column": 32 + "end_column": 29 }, "args": [], "return_type": { @@ -249,7 +391,7 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/abi-decorators.algo.ts::default", + "cref": "tests/approvals/abi-decorators.algo.ts::AbiDecorators", "member_name": "createMethod", "arc4_method_config": { "_type": "ARC4ABIMethodConfig", @@ -269,9 +411,7 @@ ], "default_args": {}, "structs": {} - }, - "synthetic": false, - "inheritable": true + } }, { "_type": "ContractMethod", @@ -280,7 +420,7 @@ "line": 9, "end_line": 10, "column": 2, - "end_column": 30 + "end_column": 27 }, "args": [], "return_type": { @@ -309,7 +449,7 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/abi-decorators.algo.ts::default", + "cref": "tests/approvals/abi-decorators.algo.ts::AbiDecorators", "member_name": "allActions", "arc4_method_config": { "_type": "ARC4ABIMethodConfig", @@ -333,18 +473,16 @@ ], "default_args": {}, "structs": {} - }, - "synthetic": false, - "inheritable": true + } }, { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/abi-decorators.algo.ts", "line": 11, - "end_line": 14, + "end_line": 12, "column": 2, - "end_column": 3 + "end_column": 27 }, "args": [], "return_type": { @@ -403,7 +541,7 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/abi-decorators.algo.ts::default", + "cref": "tests/approvals/abi-decorators.algo.ts::AbiDecorators", "member_name": "readonly", "arc4_method_config": { "_type": "ARC4ABIMethodConfig", @@ -423,18 +561,16 @@ ], "default_args": {}, "structs": {} - }, - "synthetic": false, - "inheritable": true + } }, { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/abi-decorators.algo.ts", "line": 18, - "end_line": 21, + "end_line": 19, "column": 2, - "end_column": 3 + "end_column": 68 }, "args": [ { @@ -619,7 +755,7 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/abi-decorators.algo.ts::default", + "cref": "tests/approvals/abi-decorators.algo.ts::AbiDecorators", "member_name": "methodWithDefaults", "arc4_method_config": { "_type": "ARC4ABIMethodConfig", @@ -642,13 +778,264 @@ "b": "readonly" }, "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 53 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null }, - "synthetic": false, - "inheritable": true + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 53 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 53 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 53 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 58 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "XKZg`VQf}mY;|P", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/abi-decorators.algo.ts", + "line": 16, + "end_line": 16, + "column": 51, + "end_column": 54 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "123", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/abi-decorators.algo.ts::AbiDecorators", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null } ], - "app_state": { - "globalValue": { + "app_state": [ + { "_type": "AppStorageDefinition", "source_location": { "file": "tests/approvals/abi-decorators.algo.ts", @@ -688,14 +1075,13 @@ }, "description": null } - }, - "reserved_scratch_space": [], + ], "state_totals": { "globalBytes": null, "globalUints": null, "localBytes": null, "localUints": null }, - "docstring": null + "reserved_scratch_space": [] } ] \ No newline at end of file diff --git a/tests/approvals/out/accounts.awst b/tests/approvals/out/accounts.awst deleted file mode 100644 index a3cb439d..00000000 --- a/tests/approvals/out/accounts.awst +++ /dev/null @@ -1,13 +0,0 @@ -contract AccountsContract extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - void - } - - getAccountInfo(): tuple[bytes, uint64, bytes, bool, bool, uint64, uint64, uint64, uint64, uint64, uint64, uint64, uint64, uint64, uint64] - { - return [reinterpret_cast(checked_maybe(acct_params_get(account), comment=account funded)), checked_maybe(acct_params_get(account), comment=account funded), reinterpret_cast(account), app_opted_in(account, global()), asset_holding_get(account, asset).1, checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded), checked_maybe(acct_params_get(account), comment=account funded)] - } - -} \ No newline at end of file diff --git a/tests/approvals/out/accounts/AccountsContract.arc32.json b/tests/approvals/out/accounts/AccountsContract.arc32.json new file mode 100644 index 00000000..7e8a065d --- /dev/null +++ b/tests/approvals/out/accounts/AccountsContract.arc32.json @@ -0,0 +1,126 @@ +{ + "hints": { + "getAccountInfo(account,asset)(byte[],uint64,uint64,byte[],uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,bool,bool)": { + "call_config": { + "no_op": "CALL" + }, + "structs": { + "output": { + "name": "", + "elements": [ + [ + "bytes", + "byte[]" + ], + [ + "balance", + "uint64" + ], + [ + "minBalance", + "uint64" + ], + [ + "authAddress", + "byte[]" + ], + [ + "totalNumUint", + "uint64" + ], + [ + "totalNumByteSlice", + "uint64" + ], + [ + "totalExtraAppPages", + "uint64" + ], + [ + "totalAppsCreated", + "uint64" + ], + [ + "totalAppsOptedIn", + "uint64" + ], + [ + "totalAssetsCreated", + "uint64" + ], + [ + "totalAssets", + "uint64" + ], + [ + "totalBoxes", + "uint64" + ], + [ + "totalBoxBytes", + "uint64" + ], + [ + "isOptInApp", + "bool" + ], + [ + "isOptInAsset", + "bool" + ] + ] + } + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo6QWNjb3VudHNDb250cmFjdC5hcHByb3ZhbFByb2dyYW06CiAgICBpbnRjYmxvY2sgMCAxCiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo6QWNjb3VudHNDb250cmFjdC5fX3B1eWFfYXJjNF9yb3V0ZXJfXygpIC0+IHVpbnQ2NDoKX19wdXlhX2FyYzRfcm91dGVyX186CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo0CiAgICAvLyBleHBvcnQgY2xhc3MgQWNjb3VudHNDb250cmFjdCBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJ6IF9fcHV5YV9hcmM0X3JvdXRlcl9fX2JhcmVfcm91dGluZ0A1CiAgICBwdXNoYnl0ZXMgMHhkZmU5YTAzNSAvLyBtZXRob2QgImdldEFjY291bnRJbmZvKGFjY291bnQsYXNzZXQpKGJ5dGVbXSx1aW50NjQsdWludDY0LGJ5dGVbXSx1aW50NjQsdWludDY0LHVpbnQ2NCx1aW50NjQsdWludDY0LHVpbnQ2NCx1aW50NjQsdWludDY0LHVpbnQ2NCxib29sLGJvb2wpIgogICAgdHhuYSBBcHBsaWNhdGlvbkFyZ3MgMAogICAgbWF0Y2ggX19wdXlhX2FyYzRfcm91dGVyX19fZ2V0QWNjb3VudEluZm9fcm91dGVAMgogICAgaW50Y18wIC8vIDAKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fZ2V0QWNjb3VudEluZm9fcm91dGVAMjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjUKICAgIC8vIHB1YmxpYyBnZXRBY2NvdW50SW5mbyhhY2NvdW50OiBBY2NvdW50LCBhc3NldDogQXNzZXQpIHsKICAgIHR4biBPbkNvbXBsZXRpb24KICAgICEKICAgIGFzc2VydCAvLyBPbkNvbXBsZXRpb24gaXMgTm9PcAogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGFzc2VydCAvLyBpcyBub3QgY3JlYXRpbmcKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjQKICAgIC8vIGV4cG9ydCBjbGFzcyBBY2NvdW50c0NvbnRyYWN0IGV4dGVuZHMgQ29udHJhY3QgewogICAgdHhuYSBBcHBsaWNhdGlvbkFyZ3MgMQogICAgYnRvaQogICAgdHhuYXMgQWNjb3VudHMKICAgIHR4bmEgQXBwbGljYXRpb25BcmdzIDIKICAgIGJ0b2kKICAgIHR4bmFzIEFzc2V0cwogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FjY291bnRzLmFsZ28udHM6NQogICAgLy8gcHVibGljIGdldEFjY291bnRJbmZvKGFjY291bnQ6IEFjY291bnQsIGFzc2V0OiBBc3NldCkgewogICAgY2FsbHN1YiBnZXRBY2NvdW50SW5mbwogICAgZGlnIDE0CiAgICBsZW4KICAgIGl0b2IKICAgIGV4dHJhY3QgNiAyCiAgICB1bmNvdmVyIDE1CiAgICBjb25jYXQKICAgIHVuY292ZXIgMTQKICAgIGl0b2IKICAgIHVuY292ZXIgMTQKICAgIGl0b2IKICAgIGRpZyAxNAogICAgbGVuCiAgICBpdG9iCiAgICBleHRyYWN0IDYgMgogICAgdW5jb3ZlciAxNQogICAgY29uY2F0CiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICB1bmNvdmVyIDE0CiAgICBpdG9iCiAgICBwdXNoYnl0ZXMgMHgwMAogICAgaW50Y18wIC8vIDAKICAgIHVuY292ZXIgMTYKICAgIHNldGJpdAogICAgcHVzaGJ5dGVzIDB4MDAKICAgIGludGNfMCAvLyAwCiAgICB1bmNvdmVyIDE2CiAgICBzZXRiaXQKICAgIGRpZyAxNAogICAgbGVuCiAgICBwdXNoaW50IDkzIC8vIDkzCiAgICArCiAgICBwdXNoYnl0ZXMgMHgwMDVkCiAgICB1bmNvdmVyIDE1CiAgICBjb25jYXQKICAgIHVuY292ZXIgMTQKICAgIGNvbmNhdAogICAgc3dhcAogICAgaXRvYgogICAgZXh0cmFjdCA2IDIKICAgIGNvbmNhdAogICAgdW5jb3ZlciAxMQogICAgY29uY2F0CiAgICB1bmNvdmVyIDEwCiAgICBjb25jYXQKICAgIHVuY292ZXIgOQogICAgY29uY2F0CiAgICB1bmNvdmVyIDgKICAgIGNvbmNhdAogICAgdW5jb3ZlciA3CiAgICBjb25jYXQKICAgIHVuY292ZXIgNgogICAgY29uY2F0CiAgICB1bmNvdmVyIDUKICAgIGNvbmNhdAogICAgdW5jb3ZlciA0CiAgICBjb25jYXQKICAgIHVuY292ZXIgMwogICAgY29uY2F0CiAgICB1bmNvdmVyIDIKICAgIGNvbmNhdAogICAgc3dhcAogICAgaW50Y18wIC8vIDAKICAgIGdldGJpdAogICAgcHVzaGludCA3MzcgLy8gNzM3CiAgICBzd2FwCiAgICBzZXRiaXQKICAgIHVuY292ZXIgMgogICAgY29uY2F0CiAgICBzd2FwCiAgICBjb25jYXQKICAgIHB1c2hieXRlcyAweDE1MWY3Yzc1CiAgICBzd2FwCiAgICBjb25jYXQKICAgIGxvZwogICAgaW50Y18xIC8vIDEKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fYmFyZV9yb3V0aW5nQDU6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo0CiAgICAvLyBleHBvcnQgY2xhc3MgQWNjb3VudHNDb250cmFjdCBleHRlbmRzIENvbnRyYWN0IHsKICAgIHR4biBPbkNvbXBsZXRpb24KICAgIGJueiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDkKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICAhCiAgICBhc3NlcnQgLy8gaXMgY3JlYXRpbmcKICAgIGludGNfMSAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2FmdGVyX2lmX2Vsc2VAOToKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjQKICAgIC8vIGV4cG9ydCBjbGFzcyBBY2NvdW50c0NvbnRyYWN0IGV4dGVuZHMgQ29udHJhY3QgewogICAgaW50Y18wIC8vIDAKICAgIHJldHN1YgoKCi8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjpBY2NvdW50c0NvbnRyYWN0LmdldEFjY291bnRJbmZvKGFjY291bnQ6IGJ5dGVzLCBhc3NldDogdWludDY0KSAtPiBieXRlcywgdWludDY0LCB1aW50NjQsIGJ5dGVzLCB1aW50NjQsIHVpbnQ2NCwgdWludDY0LCB1aW50NjQsIHVpbnQ2NCwgdWludDY0LCB1aW50NjQsIHVpbnQ2NCwgdWludDY0LCB1aW50NjQsIHVpbnQ2NDoKZ2V0QWNjb3VudEluZm86CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo1CiAgICAvLyBwdWJsaWMgZ2V0QWNjb3VudEluZm8oYWNjb3VudDogQWNjb3VudCwgYXNzZXQ6IEFzc2V0KSB7CiAgICBwcm90byAyIDE1CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo4CiAgICAvLyBiYWxhbmNlOiBhY2NvdW50LmJhbGFuY2UsCiAgICBmcmFtZV9kaWcgLTIKICAgIGFjY3RfcGFyYW1zX2dldCBBY2N0QmFsYW5jZQogICAgYXNzZXJ0IC8vIGFjY291bnQgZnVuZGVkCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo5CiAgICAvLyBtaW5CYWxhbmNlOiBhY2NvdW50Lm1pbkJhbGFuY2UsCiAgICBmcmFtZV9kaWcgLTIKICAgIGFjY3RfcGFyYW1zX2dldCBBY2N0TWluQmFsYW5jZQogICAgYXNzZXJ0IC8vIGFjY291bnQgZnVuZGVkCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czoxMAogICAgLy8gYXV0aEFkZHJlc3M6IGFjY291bnQuYXV0aEFkZHJlc3MuYnl0ZXMsCiAgICBmcmFtZV9kaWcgLTIKICAgIGFjY3RfcGFyYW1zX2dldCBBY2N0QXV0aEFkZHIKICAgIGFzc2VydCAvLyBhY2NvdW50IGZ1bmRlZAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FjY291bnRzLmFsZ28udHM6MTEKICAgIC8vIHRvdGFsTnVtVWludDogYWNjb3VudC50b3RhbE51bVVpbnQsCiAgICBmcmFtZV9kaWcgLTIKICAgIGFjY3RfcGFyYW1zX2dldCBBY2N0VG90YWxOdW1VaW50CiAgICBhc3NlcnQgLy8gYWNjb3VudCBmdW5kZWQKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjEyCiAgICAvLyB0b3RhbE51bUJ5dGVTbGljZTogYWNjb3VudC50b3RhbE51bUJ5dGVTbGljZSwKICAgIGZyYW1lX2RpZyAtMgogICAgYWNjdF9wYXJhbXNfZ2V0IEFjY3RUb3RhbE51bUJ5dGVTbGljZQogICAgYXNzZXJ0IC8vIGFjY291bnQgZnVuZGVkCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czoxMwogICAgLy8gdG90YWxFeHRyYUFwcFBhZ2VzOiBhY2NvdW50LnRvdGFsRXh0cmFBcHBQYWdlcywKICAgIGZyYW1lX2RpZyAtMgogICAgYWNjdF9wYXJhbXNfZ2V0IEFjY3RUb3RhbEV4dHJhQXBwUGFnZXMKICAgIGFzc2VydCAvLyBhY2NvdW50IGZ1bmRlZAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FjY291bnRzLmFsZ28udHM6MTQKICAgIC8vIHRvdGFsQXBwc0NyZWF0ZWQ6IGFjY291bnQudG90YWxBcHBzQ3JlYXRlZCwKICAgIGZyYW1lX2RpZyAtMgogICAgYWNjdF9wYXJhbXNfZ2V0IEFjY3RUb3RhbEFwcHNDcmVhdGVkCiAgICBhc3NlcnQgLy8gYWNjb3VudCBmdW5kZWQKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjE1CiAgICAvLyB0b3RhbEFwcHNPcHRlZEluOiBhY2NvdW50LnRvdGFsQXBwc09wdGVkSW4sCiAgICBmcmFtZV9kaWcgLTIKICAgIGFjY3RfcGFyYW1zX2dldCBBY2N0VG90YWxBcHBzT3B0ZWRJbgogICAgYXNzZXJ0IC8vIGFjY291bnQgZnVuZGVkCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czoxNgogICAgLy8gdG90YWxBc3NldHNDcmVhdGVkOiBhY2NvdW50LnRvdGFsQXNzZXRzQ3JlYXRlZCwKICAgIGZyYW1lX2RpZyAtMgogICAgYWNjdF9wYXJhbXNfZ2V0IEFjY3RUb3RhbEFzc2V0c0NyZWF0ZWQKICAgIGFzc2VydCAvLyBhY2NvdW50IGZ1bmRlZAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FjY291bnRzLmFsZ28udHM6MTcKICAgIC8vIHRvdGFsQXNzZXRzOiBhY2NvdW50LnRvdGFsQXNzZXRzLAogICAgZnJhbWVfZGlnIC0yCiAgICBhY2N0X3BhcmFtc19nZXQgQWNjdFRvdGFsQXNzZXRzCiAgICBhc3NlcnQgLy8gYWNjb3VudCBmdW5kZWQKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjE4CiAgICAvLyB0b3RhbEJveGVzOiBhY2NvdW50LnRvdGFsQm94ZXMsCiAgICBmcmFtZV9kaWcgLTIKICAgIGFjY3RfcGFyYW1zX2dldCBBY2N0VG90YWxCb3hlcwogICAgYXNzZXJ0IC8vIGFjY291bnQgZnVuZGVkCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czoxOQogICAgLy8gdG90YWxCb3hCeXRlczogYWNjb3VudC50b3RhbEJveEJ5dGVzLAogICAgZnJhbWVfZGlnIC0yCiAgICBhY2N0X3BhcmFtc19nZXQgQWNjdFRvdGFsQm94Qnl0ZXMKICAgIGFzc2VydCAvLyBhY2NvdW50IGZ1bmRlZAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2FjY291bnRzLmFsZ28udHM6MjAKICAgIC8vIGlzT3B0SW5BcHA6IGFjY291bnQuaXNPcHRlZEluKEdsb2JhbC5jdXJyZW50QXBwbGljYXRpb25JZCksCiAgICBmcmFtZV9kaWcgLTIKICAgIGdsb2JhbCBDdXJyZW50QXBwbGljYXRpb25JRAogICAgYXBwX29wdGVkX2luCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czoyMQogICAgLy8gaXNPcHRJbkFzc2V0OiBhY2NvdW50LmlzT3B0ZWRJbihhc3NldCksCiAgICBmcmFtZV9kaWcgLTIKICAgIGZyYW1lX2RpZyAtMQogICAgYXNzZXRfaG9sZGluZ19nZXQgQXNzZXRCYWxhbmNlCiAgICBidXJ5IDEKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9hY2NvdW50cy5hbGdvLnRzOjYtMjIKICAgIC8vIHJldHVybiB7CiAgICAvLyAgIGJ5dGVzOiBhY2NvdW50LmJ5dGVzLAogICAgLy8gICBiYWxhbmNlOiBhY2NvdW50LmJhbGFuY2UsCiAgICAvLyAgIG1pbkJhbGFuY2U6IGFjY291bnQubWluQmFsYW5jZSwKICAgIC8vICAgYXV0aEFkZHJlc3M6IGFjY291bnQuYXV0aEFkZHJlc3MuYnl0ZXMsCiAgICAvLyAgIHRvdGFsTnVtVWludDogYWNjb3VudC50b3RhbE51bVVpbnQsCiAgICAvLyAgIHRvdGFsTnVtQnl0ZVNsaWNlOiBhY2NvdW50LnRvdGFsTnVtQnl0ZVNsaWNlLAogICAgLy8gICB0b3RhbEV4dHJhQXBwUGFnZXM6IGFjY291bnQudG90YWxFeHRyYUFwcFBhZ2VzLAogICAgLy8gICB0b3RhbEFwcHNDcmVhdGVkOiBhY2NvdW50LnRvdGFsQXBwc0NyZWF0ZWQsCiAgICAvLyAgIHRvdGFsQXBwc09wdGVkSW46IGFjY291bnQudG90YWxBcHBzT3B0ZWRJbiwKICAgIC8vICAgdG90YWxBc3NldHNDcmVhdGVkOiBhY2NvdW50LnRvdGFsQXNzZXRzQ3JlYXRlZCwKICAgIC8vICAgdG90YWxBc3NldHM6IGFjY291bnQudG90YWxBc3NldHMsCiAgICAvLyAgIHRvdGFsQm94ZXM6IGFjY291bnQudG90YWxCb3hlcywKICAgIC8vICAgdG90YWxCb3hCeXRlczogYWNjb3VudC50b3RhbEJveEJ5dGVzLAogICAgLy8gICBpc09wdEluQXBwOiBhY2NvdW50LmlzT3B0ZWRJbihHbG9iYWwuY3VycmVudEFwcGxpY2F0aW9uSWQpLAogICAgLy8gICBpc09wdEluQXNzZXQ6IGFjY291bnQuaXNPcHRlZEluKGFzc2V0KSwKICAgIC8vIH0KICAgIGZyYW1lX2RpZyAtMgogICAgY292ZXIgMTQKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvYWNjb3VudHMuYWxnby50czo6QWNjb3VudHNDb250cmFjdC5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "AccountsContract", + "methods": [ + { + "name": "getAccountInfo", + "args": [ + { + "type": "account", + "name": "account" + }, + { + "type": "asset", + "name": "asset" + } + ], + "readonly": false, + "returns": { + "type": "(byte[],uint64,uint64,byte[],uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,bool,bool)" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/accounts/AccountsContract.ssa.ir b/tests/approvals/out/accounts/AccountsContract.ssa.ir new file mode 100644 index 00000000..9def3d5e --- /dev/null +++ b/tests/approvals/out/accounts/AccountsContract.ssa.ir @@ -0,0 +1,150 @@ +contract tests/approvals/accounts.algo.ts::AccountsContract: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/accounts.algo.ts::AccountsContract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/accounts.algo.ts::AccountsContract.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/accounts.algo.ts::AccountsContract.constructor() -> void: + block@0: // L4 + return + + subroutine tests/approvals/accounts.algo.ts::AccountsContract.__puya_arc4_router__() -> bool: + block@0: // L4 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L4 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "getAccountInfo(account,asset)(byte[],uint64,uint64,byte[],uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64,bool,bool)" => block@2, * => block@3} + block@2: // getAccountInfo_route_L5 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // is not creating + let tmp%7#0: bytes = (txna ApplicationArgs 1) + let tmp%8#0: uint64 = (btoi tmp%7#0) + let tmp%9#0: bytes = ((txnas Accounts) tmp%8#0) + let tmp%10#0: bytes = (txna ApplicationArgs 2) + let tmp%11#0: uint64 = (btoi tmp%10#0) + let tmp%12#0: uint64 = ((txnas Assets) tmp%11#0) + let (elements_to_encode%0#0: bytes, elements_to_encode%1#0: uint64, elements_to_encode%2#0: uint64, elements_to_encode%3#0: bytes, elements_to_encode%4#0: uint64, elements_to_encode%5#0: uint64, elements_to_encode%6#0: uint64, elements_to_encode%7#0: uint64, elements_to_encode%8#0: uint64, elements_to_encode%9#0: uint64, elements_to_encode%10#0: uint64, elements_to_encode%11#0: uint64, elements_to_encode%12#0: uint64, elements_to_encode%13#0: bool, elements_to_encode%14#0: bool) = tests/approvals/accounts.algo.ts::AccountsContract.getAccountInfo(tmp%9#0, tmp%12#0) + let length%0#0: uint64 = (len elements_to_encode%0#0) + let as_bytes%0#0: bytes = (itob length%0#0) + let length_uint16%0#0: bytes = ((extract 6 2) as_bytes%0#0) + let encoded_value%0#0: bytes = (concat length_uint16%0#0 elements_to_encode%0#0) + let val_as_bytes%0#0: bytes = (itob elements_to_encode%1#0) + let val_as_bytes%1#0: bytes = (itob elements_to_encode%2#0) + let length%1#0: uint64 = (len elements_to_encode%3#0) + let as_bytes%1#0: bytes = (itob length%1#0) + let length_uint16%1#0: bytes = ((extract 6 2) as_bytes%1#0) + let encoded_value%1#0: bytes = (concat length_uint16%1#0 elements_to_encode%3#0) + let val_as_bytes%2#0: bytes = (itob elements_to_encode%4#0) + let val_as_bytes%3#0: bytes = (itob elements_to_encode%5#0) + let val_as_bytes%4#0: bytes = (itob elements_to_encode%6#0) + let val_as_bytes%5#0: bytes = (itob elements_to_encode%7#0) + let val_as_bytes%6#0: bytes = (itob elements_to_encode%8#0) + let val_as_bytes%7#0: bytes = (itob elements_to_encode%9#0) + let val_as_bytes%8#0: bytes = (itob elements_to_encode%10#0) + let val_as_bytes%9#0: bytes = (itob elements_to_encode%11#0) + let val_as_bytes%10#0: bytes = (itob elements_to_encode%12#0) + let encoded_bool%0#0: bytes = (setbit 0x00 0u elements_to_encode%13#0) + let encoded_bool%1#0: bytes = (setbit 0x00 0u elements_to_encode%14#0) + let current_tail_offset%0#0: uint64 = 93u + let encoded_tuple_buffer%0#0: bytes = 0x + let as_bytes%2#0: bytes = (itob current_tail_offset%0#0) + let offset_as_uint16%0#0: bytes = ((extract 6 2) as_bytes%2#0) + let encoded_tuple_buffer%1#0: bytes = (concat encoded_tuple_buffer%0#0 offset_as_uint16%0#0) + let data_length%0#0: uint64 = (len encoded_value%0#0) + let current_tail_offset%1#0: uint64 = (+ current_tail_offset%0#0 data_length%0#0) + let encoded_tuple_buffer%2#0: bytes = (concat encoded_tuple_buffer%1#0 val_as_bytes%0#0) + let encoded_tuple_buffer%3#0: bytes = (concat encoded_tuple_buffer%2#0 val_as_bytes%1#0) + let as_bytes%3#0: bytes = (itob current_tail_offset%1#0) + let offset_as_uint16%1#0: bytes = ((extract 6 2) as_bytes%3#0) + let encoded_tuple_buffer%4#0: bytes = (concat encoded_tuple_buffer%3#0 offset_as_uint16%1#0) + let data_length%1#0: uint64 = (len encoded_value%1#0) + let current_tail_offset%2#0: uint64 = (+ current_tail_offset%1#0 data_length%1#0) + let encoded_tuple_buffer%5#0: bytes = (concat encoded_tuple_buffer%4#0 val_as_bytes%2#0) + let encoded_tuple_buffer%6#0: bytes = (concat encoded_tuple_buffer%5#0 val_as_bytes%3#0) + let encoded_tuple_buffer%7#0: bytes = (concat encoded_tuple_buffer%6#0 val_as_bytes%4#0) + let encoded_tuple_buffer%8#0: bytes = (concat encoded_tuple_buffer%7#0 val_as_bytes%5#0) + let encoded_tuple_buffer%9#0: bytes = (concat encoded_tuple_buffer%8#0 val_as_bytes%6#0) + let encoded_tuple_buffer%10#0: bytes = (concat encoded_tuple_buffer%9#0 val_as_bytes%7#0) + let encoded_tuple_buffer%11#0: bytes = (concat encoded_tuple_buffer%10#0 val_as_bytes%8#0) + let encoded_tuple_buffer%12#0: bytes = (concat encoded_tuple_buffer%11#0 val_as_bytes%9#0) + let encoded_tuple_buffer%13#0: bytes = (concat encoded_tuple_buffer%12#0 val_as_bytes%10#0) + let encoded_tuple_buffer%14#0: bytes = (concat encoded_tuple_buffer%13#0 encoded_bool%0#0) + let is_true%0#0: uint64 = (getbit encoded_bool%1#0 0u) + let encoded_tuple_buffer%15#0: bytes = (setbit encoded_tuple_buffer%14#0 737u is_true%0#0) + let encoded_tuple_buffer%16#0: bytes = (concat encoded_tuple_buffer%15#0 encoded_value%0#0) + let encoded_tuple_buffer%17#0: bytes = (concat encoded_tuple_buffer%16#0 encoded_value%1#0) + let tmp%13#0: bytes = (concat 0x151f7c75 encoded_tuple_buffer%17#0) + (log tmp%13#0) + return 1u + block@3: // switch_case_default_L4 + goto block@4 + block@4: // switch_case_next_L4 + goto block@9 + block@5: // bare_routing_L4 + let tmp%14#0: uint64 = (txn OnCompletion) + switch tmp%14#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L4 + let tmp%15#0: uint64 = (txn ApplicationID) + let tmp%16#0: bool = (== tmp%15#0 0u) + (assert tmp%16#0) // is creating + tests/approvals/accounts.algo.ts::AccountsContract.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L4 + goto block@8 + block@8: // switch_case_next_L4 + goto block@9 + block@9: // after_if_else_L4 + return 0u + + subroutine tests/approvals/accounts.algo.ts::AccountsContract.getAccountInfo(account: bytes, asset: uint64) -> : + block@0: // L5 + let (value%0#0: uint64, check%0#0: bool) = ((acct_params_get AcctBalance) account#0) + (assert check%0#0) // account funded + let (value%1#0: uint64, check%1#0: bool) = ((acct_params_get AcctMinBalance) account#0) + (assert check%1#0) // account funded + let (value%2#0: bytes, check%2#0: bool) = ((acct_params_get AcctAuthAddr) account#0) + (assert check%2#0) // account funded + let (value%3#0: uint64, check%3#0: bool) = ((acct_params_get AcctTotalNumUint) account#0) + (assert check%3#0) // account funded + let (value%4#0: uint64, check%4#0: bool) = ((acct_params_get AcctTotalNumByteSlice) account#0) + (assert check%4#0) // account funded + let (value%5#0: uint64, check%5#0: bool) = ((acct_params_get AcctTotalExtraAppPages) account#0) + (assert check%5#0) // account funded + let (value%6#0: uint64, check%6#0: bool) = ((acct_params_get AcctTotalAppsCreated) account#0) + (assert check%6#0) // account funded + let (value%7#0: uint64, check%7#0: bool) = ((acct_params_get AcctTotalAppsOptedIn) account#0) + (assert check%7#0) // account funded + let (value%8#0: uint64, check%8#0: bool) = ((acct_params_get AcctTotalAssetsCreated) account#0) + (assert check%8#0) // account funded + let (value%9#0: uint64, check%9#0: bool) = ((acct_params_get AcctTotalAssets) account#0) + (assert check%9#0) // account funded + let (value%10#0: uint64, check%10#0: bool) = ((acct_params_get AcctTotalBoxes) account#0) + (assert check%10#0) // account funded + let (value%11#0: uint64, check%11#0: bool) = ((acct_params_get AcctTotalBoxBytes) account#0) + (assert check%11#0) // account funded + let tmp%0#0: uint64 = (global CurrentApplicationID) + let tmp%1#0: bool = (app_opted_in account#0 tmp%0#0) + let (tmp%2#0: uint64, tmp%3#0: bool) = ((asset_holding_get AssetBalance) account#0 asset#0) + return account#0 value%0#0 value%1#0 value%2#0 value%3#0 value%4#0 value%5#0 value%6#0 value%7#0 value%8#0 value%9#0 value%10#0 value%11#0 tmp%1#0 tmp%3#0 + + subroutine tests/approvals/accounts.algo.ts::AccountsContract.__algots__.defaultCreate() -> void: + block@0: // L4 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/accounts/accounts.awst b/tests/approvals/out/accounts/accounts.awst new file mode 100644 index 00000000..0d7eac48 --- /dev/null +++ b/tests/approvals/out/accounts/accounts.awst @@ -0,0 +1,39 @@ +contract AccountsContract +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + getAccountInfo(): { bytes: bytes, balance: uint64, minBalance: uint64, authAddress: bytes, totalNumUint: uint64, totalNumByteSlice: uint64, totalExtraAppPages: uint64, totalAppsCreated: uint64, totalAppsOptedIn: uint64, totalAssetsCreated: uint64, totalAssets: uint64, totalBoxes: uint64, totalBoxBytes: uint64, isOptInApp: bool, isOptInAsset: bool } + { + return { bytes: reinterpret_cast(account), balance: checked_maybe(acct_params_get(account), comment=account funded), minBalance: checked_maybe(acct_params_get(account), comment=account funded), authAddress: reinterpret_cast(checked_maybe(acct_params_get(account), comment=account funded)), totalNumUint: checked_maybe(acct_params_get(account), comment=account funded), totalNumByteSlice: checked_maybe(acct_params_get(account), comment=account funded), totalExtraAppPages: checked_maybe(acct_params_get(account), comment=account funded), totalAppsCreated: checked_maybe(acct_params_get(account), comment=account funded), totalAppsOptedIn: checked_maybe(acct_params_get(account), comment=account funded), totalAssetsCreated: checked_maybe(acct_params_get(account), comment=account funded), totalAssets: checked_maybe(acct_params_get(account), comment=account funded), totalBoxes: checked_maybe(acct_params_get(account), comment=account funded), totalBoxBytes: checked_maybe(acct_params_get(account), comment=account funded), isOptInApp: app_opted_in(account, global()), isOptInAsset: asset_holding_get(account, asset).1 } + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + + __algots__.defaultCreate(): void + { + } + +} \ No newline at end of file diff --git a/tests/approvals/out/accounts.awst.json b/tests/approvals/out/accounts/accounts.awst.json similarity index 76% rename from tests/approvals/out/accounts.awst.json rename to tests/approvals/out/accounts/accounts.awst.json index f68338b7..e6f7c88c 100644 --- a/tests/approvals/out/accounts.awst.json +++ b/tests/approvals/out/accounts/accounts.awst.json @@ -1,71 +1,285 @@ [ { - "_type": "ContractFragment", + "_type": "Contract", "source_location": { "file": "tests/approvals/accounts.algo.ts", "line": 4, - "end_line": 24, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 48 }, "id": "tests/approvals/accounts.algo.ts::AccountsContract", "name": "AccountsContract", - "bases": [ + "description": null, + "method_resolution_order": [ "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" ], - "init": { + "approval_program": { "_type": "ContractMethod", "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 4, - "end_line": 24, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "args": [], "return_type": { "_type": "WType", - "name": "void", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": null + "scalar_type": 2 }, "body": { "_type": "Block", "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 4, - "end_line": 24, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "body": [ { - "_type": "ExpressionStatement", + "_type": "IfElse", "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 4, - "end_line": 24, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, - "expr": { - "_type": "VoidConstant", + "condition": { + "_type": "Not", "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 4, - "end_line": 24, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "wtype": { "_type": "WType", - "name": "void", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": null + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true } } ], @@ -78,23 +292,19 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/accounts.algo.ts::AccountsContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null }, - "approval_program": null, - "clear_program": null, - "subroutines": [ + "methods": [ { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/accounts.algo.ts", "line": 5, - "end_line": 23, + "end_line": 5, "column": 2, - "end_column": 3 + "end_column": 55 }, "args": [ { @@ -136,8 +346,8 @@ ], "return_type": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ @@ -157,21 +367,21 @@ }, { "_type": "WType", - "name": "bytes", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, { "_type": "WType", - "name": "bool", + "name": "bytes", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": 1 }, { "_type": "WType", - "name": "bool", + "name": "uint64", "immutable": true, "ephemeral": false, "scalar_type": 2 @@ -234,18 +444,35 @@ }, { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 }, { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "bytes", + "balance", + "minBalance", + "authAddress", + "totalNumUint", + "totalNumByteSlice", + "totalExtraAppPages", + "totalAppsCreated", + "totalAppsOptedIn", + "totalAssetsCreated", + "totalAssets", + "totalBoxes", + "totalBoxBytes", + "isOptInApp", + "isOptInAsset" ] }, "body": { @@ -278,7 +505,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -299,21 +526,21 @@ }, { "_type": "WType", - "name": "bytes", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, { "_type": "WType", - "name": "bool", + "name": "bytes", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": 1 }, { "_type": "WType", - "name": "bool", + "name": "uint64", "immutable": true, "ephemeral": false, "scalar_type": 2 @@ -376,18 +603,35 @@ }, { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 }, { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "bytes", + "balance", + "minBalance", + "authAddress", + "totalNumUint", + "totalNumByteSlice", + "totalExtraAppPages", + "totalAppsCreated", + "totalAppsOptedIn", + "totalAssetsCreated", + "totalAssets", + "totalBoxes", + "totalBoxBytes", + "isOptInApp", + "isOptInAsset" ] }, "items": [ @@ -395,10 +639,10 @@ "_type": "ReinterpretCast", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 10, - "end_line": 10, - "column": 19, - "end_column": 44 + "line": 7, + "end_line": 7, + "column": 13, + "end_column": 26 }, "wtype": { "_type": "WType", @@ -408,13 +652,13 @@ "scalar_type": 1 }, "expr": { - "_type": "CheckedMaybe", + "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 10, - "end_line": 10, - "column": 19, - "end_column": 38 + "line": 7, + "end_line": 7, + "column": 13, + "end_column": 20 }, "wtype": { "_type": "WType", @@ -423,65 +667,7 @@ "ephemeral": false, "scalar_type": 1 }, - "expr": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 10, - "end_line": 10, - "column": 19, - "end_column": 38 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "account", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "op_code": "acct_params_get", - "immediates": [ - "AcctAuthAddr" - ], - "stack_args": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 10, - "end_line": 10, - "column": 19, - "end_column": 26 - }, - "wtype": { - "_type": "WType", - "name": "account", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "account" - } - ], - "comment": null - }, - "comment": "account funded" + "name": "account" } }, { @@ -511,7 +697,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -561,131 +747,202 @@ "comment": "account funded" }, { - "_type": "ReinterpretCast", + "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 7, - "end_line": 7, - "column": 13, - "end_column": 26 + "line": 9, + "end_line": 9, + "column": 18, + "end_column": 36 }, "wtype": { "_type": "WType", - "name": "bytes", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, "expr": { - "_type": "VarExpression", + "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 7, - "end_line": 7, - "column": 13, - "end_column": 20 + "line": 9, + "end_line": 9, + "column": 18, + "end_column": 36 }, "wtype": { - "_type": "WType", - "name": "account", + "_type": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] }, - "name": "account" - } - }, - { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 20, - "end_line": 20, - "column": 18, - "end_column": 64 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "op_code": "app_opted_in", - "immediates": [], - "stack_args": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 20, - "end_line": 20, - "column": 18, - "end_column": 25 - }, - "wtype": { - "_type": "WType", - "name": "account", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "account" + "op_code": "acct_params_get", + "immediates": [ + "AcctMinBalance" + ], + "stack_args": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 9, + "end_line": 9, + "column": 18, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "account" + } + ], + "comment": null + }, + "comment": "account funded" + }, + { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "CheckedMaybe", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 38 }, - { + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 20, - "end_line": 20, - "column": 36, - "end_column": 63 + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 38 }, "wtype": { - "_type": "WType", - "name": "application", + "_type": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ] }, - "op_code": "global", + "op_code": "acct_params_get", "immediates": [ - "CurrentApplicationID" + "AcctAuthAddr" + ], + "stack_args": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 10, + "end_line": 10, + "column": 19, + "end_column": 26 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "account" + } ], - "stack_args": [], "comment": null - } - ], - "comment": null + }, + "comment": "account funded" + } }, { - "_type": "TupleItemExpression", + "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 21, - "end_line": 21, + "line": 11, + "end_line": 11, "column": 20, - "end_column": 44 + "end_column": 40 }, "wtype": { "_type": "WType", - "name": "bool", + "name": "uint64", "immutable": true, "ephemeral": false, "scalar_type": 2 }, - "base": { + "expr": { "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 21, - "end_line": 21, + "line": 11, + "end_line": 11, "column": 20, - "end_column": 44 + "end_column": 40 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -706,17 +963,17 @@ } ] }, - "op_code": "asset_holding_get", + "op_code": "acct_params_get", "immediates": [ - "AssetBalance" + "AcctTotalNumUint" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 21, - "end_line": 21, + "line": 11, + "end_line": 11, "column": 20, "end_column": 27 }, @@ -728,38 +985,20 @@ "scalar_type": 1 }, "name": "account" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 21, - "end_line": 21, - "column": 38, - "end_column": 43 - }, - "wtype": { - "_type": "WType", - "name": "asset", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "asset" } ], "comment": null }, - "index": "1" + "comment": "account funded" }, { "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 9, - "end_line": 9, - "column": 18, - "end_column": 36 + "line": 12, + "end_line": 12, + "column": 25, + "end_column": 50 }, "wtype": { "_type": "WType", @@ -772,14 +1011,14 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 9, - "end_line": 9, - "column": 18, - "end_column": 36 + "line": 12, + "end_line": 12, + "column": 25, + "end_column": 50 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -802,17 +1041,17 @@ }, "op_code": "acct_params_get", "immediates": [ - "AcctMinBalance" + "AcctTotalNumByteSlice" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 9, - "end_line": 9, - "column": 18, - "end_column": 25 + "line": 12, + "end_line": 12, + "column": 25, + "end_column": 32 }, "wtype": { "_type": "WType", @@ -832,10 +1071,10 @@ "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 14, - "end_line": 14, - "column": 24, - "end_column": 48 + "line": 13, + "end_line": 13, + "column": 26, + "end_column": 52 }, "wtype": { "_type": "WType", @@ -848,14 +1087,14 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 14, - "end_line": 14, - "column": 24, - "end_column": 48 + "line": 13, + "end_line": 13, + "column": 26, + "end_column": 52 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -878,17 +1117,17 @@ }, "op_code": "acct_params_get", "immediates": [ - "AcctTotalAppsCreated" + "AcctTotalExtraAppPages" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 14, - "end_line": 14, - "column": 24, - "end_column": 31 + "line": 13, + "end_line": 13, + "column": 26, + "end_column": 33 }, "wtype": { "_type": "WType", @@ -908,8 +1147,8 @@ "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 15, - "end_line": 15, + "line": 14, + "end_line": 14, "column": 24, "end_column": 48 }, @@ -924,14 +1163,14 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 15, - "end_line": 15, + "line": 14, + "end_line": 14, "column": 24, "end_column": 48 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -954,15 +1193,15 @@ }, "op_code": "acct_params_get", "immediates": [ - "AcctTotalAppsOptedIn" + "AcctTotalAppsCreated" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 15, - "end_line": 15, + "line": 14, + "end_line": 14, "column": 24, "end_column": 31 }, @@ -984,10 +1223,10 @@ "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 17, - "end_line": 17, - "column": 19, - "end_column": 38 + "line": 15, + "end_line": 15, + "column": 24, + "end_column": 48 }, "wtype": { "_type": "WType", @@ -1000,14 +1239,14 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 17, - "end_line": 17, - "column": 19, - "end_column": 38 + "line": 15, + "end_line": 15, + "column": 24, + "end_column": 48 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1030,17 +1269,17 @@ }, "op_code": "acct_params_get", "immediates": [ - "AcctTotalAssets" + "AcctTotalAppsOptedIn" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 17, - "end_line": 17, - "column": 19, - "end_column": 26 + "line": 15, + "end_line": 15, + "column": 24, + "end_column": 31 }, "wtype": { "_type": "WType", @@ -1083,7 +1322,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1136,10 +1375,10 @@ "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 19, - "end_line": 19, - "column": 21, - "end_column": 42 + "line": 17, + "end_line": 17, + "column": 19, + "end_column": 38 }, "wtype": { "_type": "WType", @@ -1152,14 +1391,14 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 19, - "end_line": 19, - "column": 21, - "end_column": 42 + "line": 17, + "end_line": 17, + "column": 19, + "end_column": 38 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1182,17 +1421,17 @@ }, "op_code": "acct_params_get", "immediates": [ - "AcctTotalBoxBytes" + "AcctTotalAssets" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 19, - "end_line": 19, - "column": 21, - "end_column": 28 + "line": 17, + "end_line": 17, + "column": 19, + "end_column": 26 }, "wtype": { "_type": "WType", @@ -1235,7 +1474,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1288,10 +1527,10 @@ "_type": "CheckedMaybe", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 13, - "end_line": 13, - "column": 26, - "end_column": 52 + "line": 19, + "end_line": 19, + "column": 21, + "end_column": 42 }, "wtype": { "_type": "WType", @@ -1304,14 +1543,14 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 13, - "end_line": 13, - "column": 26, - "end_column": 52 + "line": 19, + "end_line": 19, + "column": 21, + "end_column": 42 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1334,17 +1573,17 @@ }, "op_code": "acct_params_get", "immediates": [ - "AcctTotalExtraAppPages" + "AcctTotalBoxBytes" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 13, - "end_line": 13, - "column": 26, - "end_column": 33 + "line": 19, + "end_line": 19, + "column": 21, + "end_column": 28 }, "wtype": { "_type": "WType", @@ -1361,109 +1600,96 @@ "comment": "account funded" }, { - "_type": "CheckedMaybe", + "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 12, - "end_line": 12, - "column": 25, - "end_column": 50 + "line": 20, + "end_line": 20, + "column": 18, + "end_column": 64 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 }, - "expr": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 12, - "end_line": 12, - "column": 25, - "end_column": 50 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] + "op_code": "app_opted_in", + "immediates": [], + "stack_args": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 20, + "end_line": 20, + "column": 18, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "account" }, - "op_code": "acct_params_get", - "immediates": [ - "AcctTotalNumByteSlice" - ], - "stack_args": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/accounts.algo.ts", - "line": 12, - "end_line": 12, - "column": 25, - "end_column": 32 - }, - "wtype": { - "_type": "WType", - "name": "account", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "account" - } - ], - "comment": null - }, - "comment": "account funded" + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 20, + "end_line": 20, + "column": 36, + "end_column": 63 + }, + "wtype": { + "_type": "WType", + "name": "application", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "global", + "immediates": [ + "CurrentApplicationID" + ], + "stack_args": [], + "comment": null + } + ], + "comment": null }, { - "_type": "CheckedMaybe", + "_type": "TupleItemExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 11, - "end_line": 11, + "line": 21, + "end_line": 21, "column": 20, - "end_column": 40 + "end_column": 44 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 }, - "expr": { + "base": { "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 11, - "end_line": 11, + "line": 21, + "end_line": 21, "column": 20, - "end_column": 40 + "end_column": 44 }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1484,17 +1710,17 @@ } ] }, - "op_code": "acct_params_get", + "op_code": "asset_holding_get", "immediates": [ - "AcctTotalNumUint" + "AssetBalance" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/accounts.algo.ts", - "line": 11, - "end_line": 11, + "line": 21, + "end_line": 21, "column": 20, "end_column": 27 }, @@ -1506,11 +1732,29 @@ "scalar_type": 1 }, "name": "account" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 21, + "end_line": 21, + "column": 38, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "asset", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "asset" } ], "comment": null }, - "comment": "account funded" + "index": "1" } ] } @@ -1532,9 +1776,9 @@ "source_location": { "file": "tests/approvals/accounts.algo.ts", "line": 5, - "end_line": 23, + "end_line": 5, "column": 2, - "end_column": 3 + "end_column": 55 }, "name": "getAccountInfo", "is_bare": false, @@ -1544,20 +1788,324 @@ 0 ], "default_args": {}, - "structs": {} + "structs": { + "output": { + "name": "", + "elements": [ + [ + "bytes", + "byte[]" + ], + [ + "balance", + "uint64" + ], + [ + "minBalance", + "uint64" + ], + [ + "authAddress", + "byte[]" + ], + [ + "totalNumUint", + "uint64" + ], + [ + "totalNumByteSlice", + "uint64" + ], + [ + "totalExtraAppPages", + "uint64" + ], + [ + "totalAppsCreated", + "uint64" + ], + [ + "totalAppsOptedIn", + "uint64" + ], + [ + "totalAssetsCreated", + "uint64" + ], + [ + "totalAssets", + "uint64" + ], + [ + "totalBoxes", + "uint64" + ], + [ + "totalBoxBytes", + "uint64" + ], + [ + "isOptInApp", + "bool" + ], + [ + "isOptInAsset", + "bool" + ] + ] + } + } + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 48 }, - "synthetic": false, - "inheritable": true + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 48 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 48 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 48 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/accounts.algo.ts::AccountsContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 48 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 48 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/accounts.algo.ts::AccountsContract", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/accounts.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 48 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } } ], - "app_state": {}, - "reserved_scratch_space": [], + "app_state": [], "state_totals": { "globalBytes": null, "globalUints": null, "localBytes": null, "localUints": null }, - "docstring": null + "reserved_scratch_space": [] } ] \ No newline at end of file diff --git a/tests/approvals/out/arc4-types.awst b/tests/approvals/out/arc4-types.awst deleted file mode 100644 index 46b0e438..00000000 --- a/tests/approvals/out/arc4-types.awst +++ /dev/null @@ -1,31 +0,0 @@ -subroutine test(n: uint64, b: biguint, c: arc4.uint256): void -{ - x: arc4.uint8 = 0x04 - x2: arc4.uint8 = 0xff - y: arc4.uint16 = 0x00 - z: arc4.uint8 = ARC4_ENCODE(n, wtype=arc4.uint8) - z_native: uint64 = btoi(z) - a: arc4.uint128 = ARC4_ENCODE(b, wtype=arc4.uint128) - a_native: biguint = reinterpret_cast(a) -} -subroutine test_arrays(n: arc4.uint64): void -{ - myArray: arc4.dynamic_array = new arc4.dynamic_array(n, n, n) - myStatic: arc4.static_array = new arc4.static_array(n, n) - myStatic2: arc4.static_array = new arc4.static_array(n, n, n) -} -contract Arc4TypesTestContract extends @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - void - } - - approvalProgram(): bool - { - tests/approvals/arc4-types.algo.ts::test(1, 2, 0x04) - tests/approvals/arc4-types.algo.ts::test_arrays(0x41) - return True - } - -} \ No newline at end of file diff --git a/tests/approvals/out/arc4-types.awst.json b/tests/approvals/out/arc4-types.awst.json deleted file mode 100644 index 9aba9ad3..00000000 --- a/tests/approvals/out/arc4-types.awst.json +++ /dev/null @@ -1,2200 +0,0 @@ -[ - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 5, - "end_line": 13, - "column": 0, - "end_column": 1 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "n", - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 5, - "end_line": 5, - "column": 14, - "end_column": 23 - } - }, - { - "_type": "SubroutineArgument", - "name": "b", - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 5, - "end_line": 5, - "column": 25, - "end_column": 35 - } - }, - { - "_type": "SubroutineArgument", - "name": "c", - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint256", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "arc4_name": "uint256", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "256" - }, - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 5, - "end_line": 5, - "column": 37, - "end_column": 50 - } - } - ], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 5, - "end_line": 13, - "column": 52, - "end_column": 1 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 6, - "end_line": 6, - "column": 8, - "end_column": 27 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 6, - "end_line": 6, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint8", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint8", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "8" - }, - "name": "x" - }, - "value": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 6, - "end_line": 6, - "column": 12, - "end_column": 27 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint8", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint8", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "8" - }, - "value": "1O", - "encoding": "unknown" - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 7, - "end_line": 7, - "column": 8, - "end_column": 31 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 7, - "end_line": 7, - "column": 8, - "end_column": 10 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint8", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint8", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "8" - }, - "name": "x2" - }, - "value": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 7, - "end_line": 7, - "column": 13, - "end_column": 31 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint8", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint8", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "8" - }, - "value": "{{", - "encoding": "unknown" - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 8, - "end_line": 8, - "column": 8, - "end_column": 27 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 8, - "end_line": 8, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint16", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint16", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "16" - }, - "name": "y" - }, - "value": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 8, - "end_line": 8, - "column": 12, - "end_column": 27 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint16", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint16", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "16" - }, - "value": "00", - "encoding": "unknown" - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 9, - "end_line": 9, - "column": 8, - "end_column": 27 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 9, - "end_line": 9, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint8", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint8", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "8" - }, - "name": "z" - }, - "value": { - "_type": "ARC4Encode", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 9, - "end_line": 9, - "column": 12, - "end_column": 27 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint8", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint8", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "8" - }, - "value": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 9, - "end_line": 9, - "column": 25, - "end_column": 26 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "n" - } - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 10, - "end_line": 10, - "column": 8, - "end_column": 27 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 10, - "end_line": 10, - "column": 8, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "z_native" - }, - "value": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 10, - "end_line": 10, - "column": 19, - "end_column": 27 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "op_code": "btoi", - "immediates": [], - "stack_args": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 10, - "end_line": 10, - "column": 19, - "end_column": 20 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint8", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint8", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "8" - }, - "name": "z" - } - ], - "comment": null - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 11, - "end_line": 11, - "column": 8, - "end_column": 29 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 11, - "end_line": 11, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint128", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "arc4_name": "uint128", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "128" - }, - "name": "a" - }, - "value": { - "_type": "ARC4Encode", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 11, - "end_line": 11, - "column": 12, - "end_column": 29 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint128", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "arc4_name": "uint128", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "128" - }, - "value": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 11, - "end_line": 11, - "column": 27, - "end_column": 28 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "b" - } - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 12, - "end_line": 12, - "column": 8, - "end_column": 27 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 12, - "end_line": 12, - "column": 8, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "a_native" - }, - "value": { - "_type": "ReinterpretCast", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 12, - "end_line": 12, - "column": 19, - "end_column": 27 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "expr": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 12, - "end_line": 12, - "column": 19, - "end_column": 20 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint128", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "arc4_name": "uint128", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "128" - }, - "name": "a" - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/arc4-types.algo.ts::test", - "name": "test" - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 17, - "end_line": 23, - "column": 0, - "end_column": 1 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "n", - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 17, - "end_line": 17, - "column": 21, - "end_column": 34 - } - } - ], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 17, - "end_line": 23, - "column": 36, - "end_column": 1 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 18, - "end_line": 18, - "column": 8, - "end_column": 43 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 18, - "end_line": 18, - "column": 8, - "end_column": 15 - }, - "wtype": { - "_type": "ARC4DynamicArray", - "name": "arc4.dynamic_array", - "immutable": false, - "ephemeral": false, - "scalar_type": 1, - "decode_type": null, - "arc4_name": "uint64[]", - "other_encodeable_types": [], - "element_type": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "source_location": null - }, - "name": "myArray" - }, - "value": { - "_type": "NewArray", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 18, - "end_line": 18, - "column": 18, - "end_column": 43 - }, - "wtype": { - "_type": "ARC4DynamicArray", - "name": "arc4.dynamic_array", - "immutable": false, - "ephemeral": false, - "scalar_type": 1, - "decode_type": null, - "arc4_name": "uint64[]", - "other_encodeable_types": [], - "element_type": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 18, - "end_line": 18, - "column": 18, - "end_column": 43 - } - }, - "values": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 18, - "end_line": 18, - "column": 35, - "end_column": 36 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 18, - "end_line": 18, - "column": 38, - "end_column": 39 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 18, - "end_line": 18, - "column": 41, - "end_column": 42 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - } - ] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 20, - "end_line": 20, - "column": 8, - "end_column": 40 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 20, - "end_line": 20, - "column": 8, - "end_column": 16 - }, - "wtype": { - "_type": "ARC4StaticArray", - "name": "arc4.static_array", - "immutable": false, - "ephemeral": false, - "scalar_type": 1, - "decode_type": null, - "arc4_name": "uint64[2]", - "other_encodeable_types": [], - "element_type": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "source_location": null, - "array_size": "2" - }, - "name": "myStatic" - }, - "value": { - "_type": "NewArray", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 20, - "end_line": 20, - "column": 19, - "end_column": 40 - }, - "wtype": { - "_type": "ARC4StaticArray", - "name": "arc4.static_array", - "immutable": false, - "ephemeral": false, - "scalar_type": 1, - "decode_type": null, - "arc4_name": "uint64[2]", - "other_encodeable_types": [], - "element_type": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "source_location": null, - "array_size": "2" - }, - "values": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 20, - "end_line": 20, - "column": 35, - "end_column": 36 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 20, - "end_line": 20, - "column": 38, - "end_column": 39 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - } - ] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 22, - "end_line": 22, - "column": 8, - "end_column": 59 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 22, - "end_line": 22, - "column": 8, - "end_column": 17 - }, - "wtype": { - "_type": "ARC4StaticArray", - "name": "arc4.static_array", - "immutable": false, - "ephemeral": false, - "scalar_type": 1, - "decode_type": null, - "arc4_name": "uint64[3]", - "other_encodeable_types": [], - "element_type": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "source_location": null, - "array_size": "3" - }, - "name": "myStatic2" - }, - "value": { - "_type": "NewArray", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 22, - "end_line": 22, - "column": 20, - "end_column": 59 - }, - "wtype": { - "_type": "ARC4StaticArray", - "name": "arc4.static_array", - "immutable": false, - "ephemeral": false, - "scalar_type": 1, - "decode_type": null, - "arc4_name": "uint64[3]", - "other_encodeable_types": [], - "element_type": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "source_location": null, - "array_size": "3" - }, - "values": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 22, - "end_line": 22, - "column": 51, - "end_column": 52 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 22, - "end_line": 22, - "column": 54, - "end_column": 55 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 22, - "end_line": 22, - "column": 57, - "end_column": 58 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "name": "n" - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/arc4-types.algo.ts::test_arrays", - "name": "test_arrays" - }, - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 25, - "end_line": 32, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract", - "name": "Arc4TypesTestContract", - "bases": [ - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 25, - "end_line": 32, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 25, - "end_line": 32, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 25, - "end_line": 32, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 25, - "end_line": 32, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 26, - "end_line": 31, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 26, - "end_line": 31, - "column": 36, - "end_column": 3 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 27, - "end_line": 27, - "column": 4, - "end_column": 34 - }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 27, - "end_line": 27, - "column": 4, - "end_column": 34 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/arc4-types.algo.ts::test" - }, - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 27, - "end_line": 27, - "column": 9, - "end_column": 10 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - } - }, - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 27, - "end_line": 27, - "column": 12, - "end_column": 14 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "2", - "teal_alias": null - } - }, - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 27, - "end_line": 27, - "column": 16, - "end_column": 33 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint256", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "arc4_name": "uint256", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "256" - }, - "value": "1O", - "encoding": "unknown" - } - } - ] - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 28, - "end_line": 28, - "column": 4, - "end_column": 34 - }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 28, - "end_line": 28, - "column": 4, - "end_column": 34 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/arc4-types.algo.ts::test_arrays" - }, - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 28, - "end_line": 28, - "column": 16, - "end_column": 33 - }, - "wtype": { - "_type": "ARC4UIntN", - "name": "arc4.uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 1, - "decode_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "arc4_name": "uint64", - "other_encodeable_types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ], - "n": "64" - }, - "value": "K>", - "encoding": "unknown" - } - } - ] - } - }, - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 30, - "end_line": 30, - "column": 4, - "end_column": 15 - }, - "value": { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/arc4-types.algo.ts", - "line": 30, - "end_line": 30, - "column": 11, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - "clear_program": null, - "subroutines": [], - "app_state": {}, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - } -] \ No newline at end of file diff --git a/tests/approvals/out/arc4-types/Arc4TypesTestContract.ssa.ir b/tests/approvals/out/arc4-types/Arc4TypesTestContract.ssa.ir new file mode 100644 index 00000000..3e15efd6 --- /dev/null +++ b/tests/approvals/out/arc4-types/Arc4TypesTestContract.ssa.ir @@ -0,0 +1,122 @@ +contract tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract: + program approval: + subroutine tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.approvalProgram() -> bool: + block@0: // L57 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.constructor() + goto block@2 + block@2: // after_if_else_L1 + tests/approvals/arc4-types.algo.ts::test(1u, 2b, 0x0000000000000000000000000000000000000000000000000000000000000004) + tests/approvals/arc4-types.algo.ts::testByte() + tests/approvals/arc4-types.algo.ts::testArrays(0x0000000000000041) + tests/approvals/arc4-types.algo.ts::testAddress() + return 1u + + subroutine tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract.constructor() -> void: + block@0: // L52 + return + + subroutine tests/approvals/arc4-types.algo.ts::test(n: uint64, b: biguint, c: bytes) -> void: + block@0: // L5 + let x#0: bytes = 0x04 + let tmp%0#0: uint64 = (len x#0) + let tmp%1#0: bool = (== tmp%0#0 1u) + (assert tmp%1#0) + let x2#0: bytes = 0xff + let tmp%2#0: bool = (== x2#0 0xff) + (assert tmp%2#0) + let y#0: bytes = 0x0000 + let tmp%3#0: uint64 = (len y#0) + let tmp%4#0: bool = (== tmp%3#0 2u) + (assert tmp%4#0) + let val_as_bytes%0#0: bytes = (itob n#0) + let z#0: bytes = ((extract 7 1) val_as_bytes%0#0) + let z_native#0: uint64 = (btoi z#0) + let tmp%5#0: bool = (== z_native#0 n#0) + (assert tmp%5#0) + let len_%0#0: uint64 = (len b#0) + let no_overflow%0#0: bool = (<= len_%0#0 16u) + (assert no_overflow%0#0) // overflow + let b_zeros%0#0: bytes = (bzero 16u) + let a#0: bytes = (b| b#0 b_zeros%0#0) + let reinterpret_biguint%0#0: biguint = a#0 + let a_native#0: biguint = reinterpret_biguint%0#0 + let tmp%6#0: bool = (b== a_native#0 b#0) + (assert tmp%6#0) + return + + subroutine tests/approvals/arc4-types.algo.ts::testByte() -> void: + block@0: // L37 + let b#0: bytes = 0x00 + let b2#0: bytes = 0x00 + let tmp%0#0: bool = (== b#0 b2#0) + (assert tmp%0#0) + return + + subroutine tests/approvals/arc4-types.algo.ts::testArrays(n: bytes) -> void: + block@0: // L23 + let result%0#0: bytes = (concat 0x n#0) + let result%1#0: bytes = (concat result%0#0 n#0) + let result%2#0: bytes = (concat result%1#0 n#0) + let array_data%0#0: bytes = (concat 0x0003 result%2#0) + let myArray#0: bytes = array_data%0#0 + let expr_value_trimmed%0#0: bytes = ((extract 2 0) myArray#0) + let data%0#0: bytes = (concat 0x n#0) + let concatenated%0#0: bytes = (concat expr_value_trimmed%0#0 data%0#0) + let byte_len%0#0: uint64 = (len concatenated%0#0) + let len_%0#0: uint64 = (/ byte_len%0#0 8u) + let as_bytes%0#0: bytes = (itob len_%0#0) + let len_16_bit%0#0: bytes = ((extract 6 2) as_bytes%0#0) + let concat_result%0#0: bytes = (concat len_16_bit%0#0 concatenated%0#0) + let myArray#1: bytes = concat_result%0#0 + let result%3#0: bytes = (concat 0x n#0) + let result%4#0: bytes = (concat result%3#0 n#0) + let array_data%1#0: bytes = (concat 0x result%4#0) + let myStatic#0: bytes = array_data%1#0 + let array_head_and_tail%0#0: bytes = myStatic#0 + let item_offset%0#0: uint64 = (* 0u 8u) + let tmp%0#0: bytes = (extract3 array_head_and_tail%0#0 item_offset%0#0 8u) // on error: Index access is out of bounds + let (popped%0#0: bytes, data%1#0: bytes) = _puya_lib.arc4.dynamic_array_pop_fixed_size(myArray#1, 8u) + let myArray#2: bytes = data%1#0 + let tmp%1#0: bool = (== tmp%0#0 popped%0#0) + (assert tmp%1#0) + let assigned_value%0#0: bytes = 0x0000000000000032 + let updated_target%0#0: bytes = (replace3 myStatic#0 8u assigned_value%0#0) + let myStatic#1: bytes = updated_target%0#0 + return + + subroutine tests/approvals/arc4-types.algo.ts::testAddress() -> void: + block@0: // L43 + let a#0: bytes = addr AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ + let b#0: bytes = (txn Sender) + let tmp%0#0: bool = (== a#0 b#0) + let tmp%1#0: bool = (! tmp%0#0) + (assert tmp%1#0) // Zero address should not match sender + let tmp%2#0: bool = (== a#0 addr AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ) + (assert tmp%2#0) // Two zero addresses should match + let array_head_and_tail%0#0: bytes = a#0 + let item_offset%0#0: uint64 = (* 0u 1u) + let tmp%3#0: bytes = (extract3 array_head_and_tail%0#0 item_offset%0#0 1u) // on error: Index access is out of bounds + let tmp%4#0: bool = (== tmp%3#0 0x00) + (assert tmp%4#0) // Zero address should start with zero byte + return + + subroutine _puya_lib.arc4.dynamic_array_pop_fixed_size(array: bytes, fixed_byte_size: uint64) -> : + block@0: // L44 + let array_length#0: uint64 = (extract_uint16 array#0 0u) + let length_minus_1#0: uint64 = (- array_length#0 1u) + let tmp%0#0: bytes = (itob length_minus_1#0) + let tmp%1#0: bytes = ((extract 6 0) tmp%0#0) + let result#0: bytes = ((replace2 0) array#0 tmp%1#0) + let tmp%2#0: uint64 = (len result#0) + let item_location#0: uint64 = (- tmp%2#0 fixed_byte_size#0) + let popped#0: bytes = (extract3 result#0 item_location#0 fixed_byte_size#0) + let result#1: bytes = (substring3 result#0 0u item_location#0) + return popped#0 result#1 + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/arc4-types/arc4-types.awst b/tests/approvals/out/arc4-types/arc4-types.awst new file mode 100644 index 00000000..26e07457 --- /dev/null +++ b/tests/approvals/out/arc4-types/arc4-types.awst @@ -0,0 +1,72 @@ +subroutine test(n: uint64, b: biguint, c: arc4.uint256): void +{ + x: arc4.uint8 = 4 + assert(len(reinterpret_cast(x)) == 1) + x2: arc4.uint8 = 0xff + assert(reinterpret_cast(x2) == 0xff) + y: arc4.uint16 = 0 + assert(len(reinterpret_cast(y)) == 2) + z: arc4.uint8 = ARC4_ENCODE(n, wtype=arc4.uint8) + z_native: uint64 = btoi(z) + assert(z_native == n) + a: arc4.uint128 = ARC4_ENCODE(b, wtype=arc4.uint128) + a_native: biguint = reinterpret_cast(a) + assert(a_native == b) +} +subroutine testArrays(n: arc4.uint64): void +{ + myArray: arc4.dynamic_array = new arc4.dynamic_array(n, n, n) + myArray.push(...[n] + myStatic: arc4.static_array = new arc4.static_array(n, n) + assert(reinterpret_cast(myStatic[0]) == reinterpret_cast(myArray.pop())) + myStatic[1]: arc4.uint64 = 50 +} +subroutine testByte(): void +{ + b: arc4.byte = 0 + b2: arc4.byte = 0 + assert(reinterpret_cast(b) == reinterpret_cast(b2)) +} +subroutine testAddress(): void +{ + a: arc4.static_array = Address("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ") + b: arc4.static_array = reinterpret_cast>(txn()) + assert(!reinterpret_cast(a) == reinterpret_cast(b)) + assert(reinterpret_cast(a) == reinterpret_cast(Address("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ"))) + assert(reinterpret_cast(a[0]) == reinterpret_cast(0)) +} +contract Arc4TypesTestContract +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + tests/approvals/arc4-types.algo.ts::test(1, 2, 4) + tests/approvals/arc4-types.algo.ts::testByte() + tests/approvals/arc4-types.algo.ts::testArrays(65) + tests/approvals/arc4-types.algo.ts::testAddress() + return True + } + + clearProgram(): bool + { + return True + } + + getArc4Values(): readonlytuple[arc4.byte, arc4.uint8, arc4.static_array] + { + return [0, 255, Address("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ")] + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + +} \ No newline at end of file diff --git a/tests/approvals/out/arc4-types/arc4-types.awst.json b/tests/approvals/out/arc4-types/arc4-types.awst.json new file mode 100644 index 00000000..323c4dc3 --- /dev/null +++ b/tests/approvals/out/arc4-types/arc4-types.awst.json @@ -0,0 +1,5769 @@ +[ + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 5, + "end_line": 5, + "column": 0, + "end_column": 51 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 5, + "end_line": 5, + "column": 14, + "end_column": 23 + } + }, + { + "_type": "SubroutineArgument", + "name": "b", + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 5, + "end_line": 5, + "column": 25, + "end_column": 35 + } + }, + { + "_type": "SubroutineArgument", + "name": "c", + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint256", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "uint256", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "256" + }, + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 5, + "end_line": 5, + "column": 37, + "end_column": 50 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 5, + "end_line": 19, + "column": 52, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 6, + "end_line": 6, + "column": 8, + "end_column": 27 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 6, + "end_line": 6, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "x" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 6, + "end_line": 6, + "column": 12, + "end_column": 27 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": "4", + "teal_alias": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 30 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 7, + "end_line": 7, + "column": 2, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 7, + "end_line": 7, + "column": 9, + "end_column": 29 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 7, + "end_line": 7, + "column": 9, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "len", + "immediates": [], + "stack_args": [ + { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 7, + "end_line": 7, + "column": 9, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 7, + "end_line": 7, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "x" + } + } + ], + "comment": null + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 7, + "end_line": 7, + "column": 28, + "end_column": 29 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + ], + "comment": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 8, + "end_line": 8, + "column": 8, + "end_column": 31 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 8, + "end_line": 8, + "column": 8, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "x2" + }, + "value": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 8, + "end_line": 8, + "column": 13, + "end_column": 31 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": "{{", + "encoding": "unknown" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 42 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 9, + "end_line": 9, + "column": 9, + "end_column": 41 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 9, + "end_line": 9, + "column": 9, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 9, + "end_line": 9, + "column": 9, + "end_column": 11 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "x2" + } + }, + "operator": "==", + "rhs": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 9, + "end_line": 9, + "column": 22, + "end_column": 41 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "{{", + "encoding": "base16" + } + } + ], + "comment": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 11, + "end_line": 11, + "column": 8, + "end_column": 27 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 11, + "end_line": 11, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint16", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint16", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "16" + }, + "name": "y" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 11, + "end_line": 11, + "column": 12, + "end_column": 27 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint16", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint16", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "16" + }, + "value": "0", + "teal_alias": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 30 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 12, + "end_line": 12, + "column": 9, + "end_column": 29 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 12, + "end_line": 12, + "column": 9, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "len", + "immediates": [], + "stack_args": [ + { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 12, + "end_line": 12, + "column": 9, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 12, + "end_line": 12, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint16", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint16", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "16" + }, + "name": "y" + } + } + ], + "comment": null + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 12, + "end_line": 12, + "column": 28, + "end_column": 29 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + } + ], + "comment": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 27 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "z" + }, + "value": { + "_type": "ARC4Encode", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 13, + "end_line": 13, + "column": 12, + "end_column": 27 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 13, + "end_line": 13, + "column": 25, + "end_column": 26 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 14, + "end_line": 14, + "column": 8, + "end_column": 27 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 14, + "end_line": 14, + "column": 8, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "z_native" + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 14, + "end_line": 14, + "column": 19, + "end_column": 27 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "btoi", + "immediates": [], + "stack_args": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 14, + "end_line": 14, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "z" + } + ], + "comment": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 15, + "end_line": 15, + "column": 2, + "end_column": 24 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 15, + "end_line": 15, + "column": 2, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 15, + "end_line": 15, + "column": 9, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 15, + "end_line": 15, + "column": 9, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "z_native" + }, + "operator": "==", + "rhs": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 15, + "end_line": 15, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "n" + } + } + ], + "comment": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 16, + "end_line": 16, + "column": 8, + "end_column": 29 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 16, + "end_line": 16, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint128", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "uint128", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "128" + }, + "name": "a" + }, + "value": { + "_type": "ARC4Encode", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 16, + "end_line": 16, + "column": 12, + "end_column": 29 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint128", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "uint128", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "128" + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 16, + "end_line": 16, + "column": 27, + "end_column": 28 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "b" + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 17, + "end_line": 17, + "column": 8, + "end_column": 27 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 17, + "end_line": 17, + "column": 8, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "a_native" + }, + "value": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 17, + "end_line": 17, + "column": 19, + "end_column": 27 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 17, + "end_line": 17, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint128", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "uint128", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "128" + }, + "name": "a" + } + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 18, + "end_line": 18, + "column": 2, + "end_column": 24 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 18, + "end_line": 18, + "column": 2, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 18, + "end_line": 18, + "column": 9, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 18, + "end_line": 18, + "column": 9, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "a_native" + }, + "operator": "==", + "rhs": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 18, + "end_line": 18, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "b" + } + } + ], + "comment": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/arc4-types.algo.ts::test", + "name": "test" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 23, + "end_line": 23, + "column": 0, + "end_column": 34 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "n", + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 23, + "end_line": 23, + "column": 20, + "end_column": 33 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 23, + "end_line": 35, + "column": 35, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 8, + "end_column": 43 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 8, + "end_column": 15 + }, + "wtype": { + "_type": "ARC4DynamicArray", + "name": "arc4.dynamic_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null + }, + "name": "myArray" + }, + "value": { + "_type": "NewArray", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 18, + "end_column": 43 + }, + "wtype": { + "_type": "ARC4DynamicArray", + "name": "arc4.dynamic_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 18, + "end_column": 43 + } + }, + "values": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 35, + "end_column": 36 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "name": "n" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 38, + "end_column": 39 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "name": "n" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 41, + "end_column": 42 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "name": "n" + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 26, + "end_line": 26, + "column": 2, + "end_column": 17 + }, + "expr": { + "_type": "ArrayExtend", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 26, + "end_line": 26, + "column": 2, + "end_column": 17 + }, + "wtype": { + "_type": "ARC4DynamicArray", + "name": "arc4.dynamic_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 26, + "end_line": 26, + "column": 2, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4DynamicArray", + "name": "arc4.dynamic_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null + }, + "name": "myArray" + }, + "other": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 26, + "end_line": 26, + "column": 2, + "end_column": 17 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + } + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 26, + "end_line": 26, + "column": 15, + "end_column": 16 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "name": "n" + } + ] + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 28, + "end_line": 28, + "column": 8, + "end_column": 40 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 28, + "end_line": 28, + "column": 8, + "end_column": 16 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[2]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null, + "array_size": "2" + }, + "name": "myStatic" + }, + "value": { + "_type": "NewArray", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 28, + "end_line": 28, + "column": 19, + "end_column": 40 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[2]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null, + "array_size": "2" + }, + "values": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 28, + "end_line": 28, + "column": 35, + "end_column": 36 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "name": "n" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 28, + "end_line": 28, + "column": 38, + "end_column": 39 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "name": "n" + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 2, + "end_column": 43 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 2, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 9, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 9, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "IndexExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 9, + "end_column": 20 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 9, + "end_column": 17 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[2]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null, + "array_size": "2" + }, + "name": "myStatic" + }, + "index": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + } + }, + "operator": "==", + "rhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 9, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "ArrayPop", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 28, + "end_column": 41 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 30, + "end_line": 30, + "column": 28, + "end_column": 35 + }, + "wtype": { + "_type": "ARC4DynamicArray", + "name": "arc4.dynamic_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null + }, + "name": "myArray" + } + } + } + } + ], + "comment": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 32, + "end_line": 32, + "column": 2, + "end_column": 33 + }, + "target": { + "_type": "IndexExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 32, + "end_line": 32, + "column": 2, + "end_column": 13 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 32, + "end_line": 32, + "column": 2, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": false, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": null, + "arc4_name": "uint64[2]", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "source_location": null, + "array_size": "2" + }, + "name": "myStatic" + }, + "index": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 32, + "end_line": 32, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 32, + "end_line": 32, + "column": 16, + "end_column": 33 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "value": "50", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/arc4-types.algo.ts::testArrays", + "name": "testArrays" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 37, + "end_line": 37, + "column": 0, + "end_column": 19 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 37, + "end_line": 41, + "column": 20, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 38, + "end_line": 38, + "column": 8, + "end_column": 22 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 38, + "end_line": 38, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "b" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 38, + "end_line": 38, + "column": 12, + "end_column": 22 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": "0", + "teal_alias": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 39, + "end_line": 39, + "column": 8, + "end_column": 24 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 39, + "end_line": 39, + "column": 8, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "b2" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 39, + "end_line": 39, + "column": 13, + "end_column": 24 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": "0", + "teal_alias": null + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 40, + "end_line": 40, + "column": 2, + "end_column": 22 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 40, + "end_line": 40, + "column": 2, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 40, + "end_line": 40, + "column": 9, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 40, + "end_line": 40, + "column": 9, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 40, + "end_line": 40, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "b" + } + }, + "operator": "==", + "rhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 40, + "end_line": 40, + "column": 9, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 40, + "end_line": 40, + "column": 18, + "end_column": 20 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "name": "b2" + } + } + } + ], + "comment": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/arc4-types.algo.ts::testByte", + "name": "testByte" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 43, + "end_line": 43, + "column": 0, + "end_column": 22 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 43, + "end_line": 50, + "column": 23, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 44, + "end_line": 44, + "column": 8, + "end_column": 25 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 44, + "end_line": 44, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "name": "a" + }, + "value": { + "_type": "AddressConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 44, + "end_line": 44, + "column": 12, + "end_column": 25 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 45, + "end_line": 45, + "column": 8, + "end_column": 35 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 45, + "end_line": 45, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "name": "b" + }, + "value": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 45, + "end_line": 45, + "column": 12, + "end_column": 35 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 45, + "end_line": 45, + "column": 24, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Sender" + ], + "stack_args": [], + "comment": null + } + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 2, + "end_column": 62 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 2, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "Not", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 9, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 10, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 10, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "name": "a" + } + }, + "operator": "==", + "rhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 10, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "name": "b" + } + } + } + } + ], + "comment": "Zero address should not match sender" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 48, + "end_line": 48, + "column": 2, + "end_column": 68 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 48, + "end_line": 48, + "column": 2, + "end_column": 68 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 48, + "end_line": 48, + "column": 9, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 48, + "end_line": 48, + "column": 9, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 48, + "end_line": 48, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "name": "a" + } + }, + "operator": "==", + "rhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 48, + "end_line": 48, + "column": 9, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "AddressConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 48, + "end_line": 48, + "column": 18, + "end_column": 31 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ" + } + } + } + ], + "comment": "Two zero addresses should match" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 2, + "end_column": 77 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 2, + "end_column": 77 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 9, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 9, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "IndexExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 9, + "end_column": 13 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "name": "a" + }, + "index": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + } + }, + "operator": "==", + "rhs": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 9, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 49, + "end_line": 49, + "column": 21, + "end_column": 31 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": "0", + "teal_alias": null + } + } + } + ], + "comment": "Zero address should start with zero byte" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/arc4-types.algo.ts::testAddress", + "name": "testAddress" + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 52, + "end_line": 52, + "column": 0, + "end_column": 57 + }, + "id": "tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract", + "name": "Arc4TypesTestContract", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 57, + "end_line": 57, + "column": 2, + "end_column": 35 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 57, + "end_line": 64, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 58, + "end_line": 58, + "column": 4, + "end_column": 34 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 58, + "end_line": 58, + "column": 4, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/arc4-types.algo.ts::test" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 58, + "end_line": 58, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + }, + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 58, + "end_line": 58, + "column": 12, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "2", + "teal_alias": null + } + }, + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 58, + "end_line": 58, + "column": 16, + "end_column": 33 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint256", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "uint256", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "256" + }, + "value": "4", + "teal_alias": null + } + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 59, + "end_line": 59, + "column": 4, + "end_column": 14 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 59, + "end_line": 59, + "column": 4, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/arc4-types.algo.ts::testByte" + }, + "args": [] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 60, + "end_line": 60, + "column": 4, + "end_column": 33 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 60, + "end_line": 60, + "column": 4, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/arc4-types.algo.ts::testArrays" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 60, + "end_line": 60, + "column": 15, + "end_column": 32 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint64", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "64" + }, + "value": "65", + "teal_alias": null + } + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 61, + "end_line": 61, + "column": 4, + "end_column": 17 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 61, + "end_line": 61, + "column": 4, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/arc4-types.algo.ts::testAddress" + }, + "args": [] + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 63, + "end_line": 63, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 63, + "end_line": 63, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 53, + "end_line": 53, + "column": 2, + "end_column": 51 + }, + "args": [], + "return_type": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + } + ] + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 53, + "end_line": 55, + "column": 52, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 54, + "end_line": 54, + "column": 4, + "end_column": 54 + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 54, + "end_line": 54, + "column": 11, + "end_column": 54 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + } + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 54, + "end_line": 54, + "column": 12, + "end_column": 22 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": "0", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 54, + "end_line": 54, + "column": 24, + "end_column": 38 + }, + "wtype": { + "_type": "ARC4UIntN", + "name": "arc4.uint8", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "uint8", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "value": "255", + "teal_alias": null + }, + { + "_type": "AddressConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 54, + "end_line": 54, + "column": 40, + "end_column": 53 + }, + "wtype": { + "_type": "ARC4StaticArray", + "name": "arc4.static_array", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "arc4_name": "address", + "other_encodeable_types": [], + "element_type": { + "_type": "ARC4UIntN", + "name": "arc4.byte", + "immutable": true, + "ephemeral": false, + "scalar_type": 1, + "puya_type_name": "ARC4Type", + "native_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "arc4_name": "byte", + "other_encodeable_types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "n": "8" + }, + "source_location": null, + "array_size": "32" + }, + "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract", + "member_name": "getArc4Values", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 52, + "end_line": 52, + "column": 0, + "end_column": 57 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 52, + "end_line": 52, + "column": 0, + "end_column": 57 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 52, + "end_line": 52, + "column": 0, + "end_column": 57 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/arc4-types.algo.ts", + "line": 52, + "end_line": 52, + "column": 0, + "end_column": 57 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/arc4-types.algo.ts::Arc4TypesTestContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/array-destructuring.awst b/tests/approvals/out/array-destructuring/array-destructuring.awst similarity index 100% rename from tests/approvals/out/array-destructuring.awst rename to tests/approvals/out/array-destructuring/array-destructuring.awst diff --git a/tests/approvals/out/array-destructuring.awst.json b/tests/approvals/out/array-destructuring/array-destructuring.awst.json similarity index 98% rename from tests/approvals/out/array-destructuring.awst.json rename to tests/approvals/out/array-destructuring/array-destructuring.awst.json index b5980ef7..1d67bb78 100644 --- a/tests/approvals/out/array-destructuring.awst.json +++ b/tests/approvals/out/array-destructuring/array-destructuring.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/array-destructuring.algo.ts", "line": 4, - "end_line": 7, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 54 }, "args": [ { @@ -14,7 +14,7 @@ "name": "arg", "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -28,7 +28,7 @@ }, { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -97,7 +97,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -111,7 +111,7 @@ }, { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -164,7 +164,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -200,7 +200,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -214,7 +214,7 @@ }, { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -260,7 +260,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -274,7 +274,7 @@ }, { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -327,7 +327,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -400,7 +400,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -414,7 +414,7 @@ }, { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -458,9 +458,9 @@ "source_location": { "file": "tests/approvals/array-destructuring.algo.ts", "line": 9, - "end_line": 15, + "end_line": 9, "column": 0, - "end_column": 1 + "end_column": 15 }, "args": [], "return_type": { @@ -500,7 +500,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -621,7 +621,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -683,7 +683,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -804,7 +804,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -866,7 +866,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -914,7 +914,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -960,7 +960,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1081,7 +1081,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1142,14 +1142,14 @@ "source_location": { "file": "tests/approvals/array-destructuring.algo.ts", "line": 17, - "end_line": 19, + "end_line": 17, "column": 0, - "end_column": 1 + "end_column": 58 }, "args": [], "return_type": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1214,7 +1214,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1346,9 +1346,9 @@ "source_location": { "file": "tests/approvals/array-destructuring.algo.ts", "line": 21, - "end_line": 29, + "end_line": 21, "column": 0, - "end_column": 1 + "end_column": 35 }, "args": [], "return_type": { @@ -1482,7 +1482,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1553,7 +1553,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1585,7 +1585,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1656,7 +1656,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, diff --git a/tests/approvals/out/array-literals.awst b/tests/approvals/out/array-literals/array-literals.awst similarity index 100% rename from tests/approvals/out/array-literals.awst rename to tests/approvals/out/array-literals/array-literals.awst diff --git a/tests/approvals/out/array-literals.awst.json b/tests/approvals/out/array-literals/array-literals.awst.json similarity index 98% rename from tests/approvals/out/array-literals.awst.json rename to tests/approvals/out/array-literals/array-literals.awst.json index 679fb896..f83f2bce 100644 --- a/tests/approvals/out/array-literals.awst.json +++ b/tests/approvals/out/array-literals/array-literals.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/array-literals.algo.ts", "line": 3, - "end_line": 14, + "end_line": 3, "column": 0, - "end_column": 1 + "end_column": 35 }, "args": [ { @@ -83,7 +83,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -117,7 +117,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -198,7 +198,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -232,7 +232,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -313,7 +313,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -347,7 +347,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -433,7 +433,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -504,7 +504,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -586,7 +586,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -657,7 +657,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -738,7 +738,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -809,7 +809,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -890,7 +890,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -961,7 +961,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, diff --git a/tests/approvals/out/assert-match.awst b/tests/approvals/out/assert-match.awst deleted file mode 100644 index 24413f79..00000000 --- a/tests/approvals/out/assert-match.awst +++ /dev/null @@ -1,19 +0,0 @@ -subroutine test(x: group_transaction_pay): void -{ - assert(gtxns(x) <= 50000 and gtxns(x) >= 0 and gtxns(x) == global() and gtxns(x) > 1 and gtxns(x) < 1099511627776 and gtxns(x) == global() and gtxns(x) == txn()) -} -contract AssertMatchContract extends @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - void - } - - approvalProgram(): bool - { - txn: group_transaction_pay = reinterpret_cast(1) - tests/approvals/assert-match.algo.ts::test(txn) - return True - } - -} \ No newline at end of file diff --git a/tests/approvals/out/AssertMatchContract.ssa.ir b/tests/approvals/out/assert-match/AssertMatchContract.ssa.ir similarity index 50% rename from tests/approvals/out/AssertMatchContract.ssa.ir rename to tests/approvals/out/assert-match/AssertMatchContract.ssa.ir index 34eed03a..ac0a67d4 100644 --- a/tests/approvals/out/AssertMatchContract.ssa.ir +++ b/tests/approvals/out/assert-match/AssertMatchContract.ssa.ir @@ -1,65 +1,65 @@ contract tests/approvals/assert-match.algo.ts::AssertMatchContract: program approval: subroutine tests/approvals/assert-match.algo.ts::AssertMatchContract.approvalProgram() -> bool: - block@0: // L15 - let app_id%0#0: uint64 = (txn ApplicationID) - goto app_id%0#0 ? block@2 : block@1 - block@1: // on_create_L14 + block@0: // L21 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 tests/approvals/assert-match.algo.ts::AssertMatchContract.constructor() goto block@2 - block@2: // entrypoint_L14 + block@2: // after_if_else_L1 let txn#0: uint64 = 1u tests/approvals/assert-match.algo.ts::test(txn#0) return 1u - + + subroutine tests/approvals/assert-match.algo.ts::AssertMatchContract.constructor() -> void: + block@0: // L20 + return + subroutine tests/approvals/assert-match.algo.ts::test(x: uint64) -> void: - block@0: // L3 + block@0: // L9 let tmp%0#0: uint64 = ((gtxns Amount) x#0) let tmp%1#0: bool = (<= tmp%0#0 50000u) goto tmp%1#0 ? block@1 : block@8 - block@1: // and_contd_L4 + block@1: // and_contd_L10 let tmp%2#0: uint64 = ((gtxns Amount) x#0) let tmp%3#0: bool = (>= tmp%2#0 0u) goto tmp%3#0 ? block@2 : block@8 - block@2: // and_contd_L4 - let tmp%4#0: bytes = ((gtxns CloseRemainderTo) x#0) - let tmp%5#0: bytes = (global ZeroAddress) + block@2: // and_contd_L10 + let tmp%4#0: bytes = ((gtxns Sender) x#0) + let tmp%5#0: bytes = (txn Sender) let tmp%6#0: bool = (== tmp%4#0 tmp%5#0) goto tmp%6#0 ? block@3 : block@8 - block@3: // and_contd_L4 - let tmp%7#0: uint64 = ((gtxns FirstValid) x#0) - let tmp%8#0: bool = (> tmp%7#0 1u) - goto tmp%8#0 ? block@4 : block@8 - block@4: // and_contd_L4 - let tmp%9#0: uint64 = ((gtxns LastValid) x#0) - let tmp%10#0: bool = (< tmp%9#0 1099511627776u) - goto tmp%10#0 ? block@5 : block@8 - block@5: // and_contd_L4 - let tmp%11#0: bytes = ((gtxns Receiver) x#0) - let tmp%12#0: bytes = (global CurrentApplicationAddress) - let tmp%13#0: bool = (== tmp%11#0 tmp%12#0) - goto tmp%13#0 ? block@6 : block@8 - block@6: // and_contd_L4 - let tmp%14#0: bytes = ((gtxns Sender) x#0) - let tmp%15#0: bytes = (txn Sender) - let tmp%16#0: bool = (== tmp%14#0 tmp%15#0) + block@3: // and_contd_L10 + let tmp%7#0: bytes = ((gtxns Receiver) x#0) + let tmp%8#0: bytes = (global CurrentApplicationAddress) + let tmp%9#0: bool = (== tmp%7#0 tmp%8#0) + goto tmp%9#0 ? block@4 : block@8 + block@4: // and_contd_L10 + let tmp%10#0: bytes = ((gtxns CloseRemainderTo) x#0) + let tmp%11#0: bytes = (global ZeroAddress) + let tmp%12#0: bool = (== tmp%10#0 tmp%11#0) + goto tmp%12#0 ? block@5 : block@8 + block@5: // and_contd_L10 + let tmp%13#0: uint64 = ((gtxns FirstValid) x#0) + let tmp%14#0: bool = (> tmp%13#0 1u) + goto tmp%14#0 ? block@6 : block@8 + block@6: // and_contd_L10 + let tmp%15#0: uint64 = ((gtxns LastValid) x#0) + let tmp%16#0: bool = (< tmp%15#0 1099511627776u) goto tmp%16#0 ? block@7 : block@8 - block@7: // bool_true_L4 + block@7: // bool_true_L10 let and_result%0#0: bool = 1u goto block@9 - block@8: // bool_false_L4 + block@8: // bool_false_L10 let and_result%0#1: bool = 0u goto block@9 - block@9: // bool_merge_L4 + block@9: // bool_merge_L10 let and_result%0#2: bool = φ(and_result%0#0 <- block@7, and_result%0#1 <- block@8) (assert and_result%0#2) // assert target is match for conditions - return - - subroutine tests/approvals/assert-match.algo.ts::AssertMatchContract.constructor() -> void: - block@0: // L14 - return - + return + program clear-state: subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: block@0: // L1 - return 1u + return 1u \ No newline at end of file diff --git a/tests/approvals/out/assert-match/assert-match.awst b/tests/approvals/out/assert-match/assert-match.awst new file mode 100644 index 00000000..a981a9f7 --- /dev/null +++ b/tests/approvals/out/assert-match/assert-match.awst @@ -0,0 +1,36 @@ +subroutine testSelf(): void +{ + assert(txn() == global()) +} +subroutine test(x: group_transaction_pay): void +{ + assert(gtxns(x) <= 50000 and gtxns(x) >= 0 and gtxns(x) == txn() and gtxns(x) == global() and gtxns(x) == global() and gtxns(x) > 1 and gtxns(x) < 1099511627776) +} +contract AssertMatchContract +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + txn: group_transaction_pay = reinterpret_cast(1) + tests/approvals/assert-match.algo.ts::test(txn) + return True + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + +} \ No newline at end of file diff --git a/tests/approvals/out/assert-match.awst.json b/tests/approvals/out/assert-match/assert-match.awst.json similarity index 57% rename from tests/approvals/out/assert-match.awst.json rename to tests/approvals/out/assert-match/assert-match.awst.json index 905d16aa..1f880809 100644 --- a/tests/approvals/out/assert-match.awst.json +++ b/tests/approvals/out/assert-match/assert-match.awst.json @@ -4,9 +4,145 @@ "source_location": { "file": "tests/approvals/assert-match.algo.ts", "line": 3, - "end_line": 12, + "end_line": 3, "column": 0, - "end_column": 1 + "end_column": 19 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 3, + "end_line": 7, + "column": 20, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 4, + "end_line": 6, + "column": 2, + "end_column": 4 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 4, + "end_line": 6, + "column": 2, + "end_column": 4 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 4, + "end_line": 6, + "column": 2, + "end_column": 4 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 4, + "end_line": 6, + "column": 2, + "end_column": 4 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Receiver" + ], + "stack_args": [], + "comment": null + }, + "operator": "==", + "rhs": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 5, + "end_line": 5, + "column": 14, + "end_column": 46 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "global", + "immediates": [ + "CurrentApplicationAddress" + ], + "stack_args": [], + "comment": null + } + } + ], + "comment": "assert target is match for conditions" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/assert-match.algo.ts::testSelf", + "name": "testSelf" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 9, + "end_line": 9, + "column": 0, + "end_column": 33 }, "args": [ { @@ -22,8 +158,8 @@ }, "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 3, - "end_line": 3, + "line": 9, + "end_line": 9, "column": 14, "end_column": 32 } @@ -40,8 +176,8 @@ "_type": "Block", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 3, - "end_line": 12, + "line": 9, + "end_line": 18, "column": 34, "end_column": 1 }, @@ -50,8 +186,8 @@ "_type": "ExpressionStatement", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -59,8 +195,8 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -78,8 +214,8 @@ "_type": "BooleanBinaryOperation", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -94,8 +230,8 @@ "_type": "BooleanBinaryOperation", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -110,8 +246,8 @@ "_type": "BooleanBinaryOperation", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -126,8 +262,8 @@ "_type": "BooleanBinaryOperation", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -142,8 +278,8 @@ "_type": "BooleanBinaryOperation", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -158,8 +294,8 @@ "_type": "BooleanBinaryOperation", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -174,8 +310,8 @@ "_type": "NumericComparisonExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -190,8 +326,8 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -211,8 +347,8 @@ "_type": "VarExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 4, + "line": 10, + "end_line": 10, "column": 14, "end_column": 15 }, @@ -234,8 +370,8 @@ "_type": "IntegerConstant", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 5, - "end_line": 5, + "line": 11, + "end_line": 11, "column": 27, "end_column": 32 }, @@ -255,8 +391,8 @@ "_type": "NumericComparisonExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -271,8 +407,8 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -292,8 +428,8 @@ "_type": "VarExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 4, + "line": 10, + "end_line": 10, "column": 14, "end_column": 15 }, @@ -315,8 +451,8 @@ "_type": "IntegerConstant", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 5, - "end_line": 5, + "line": 11, + "end_line": 11, "column": 24, "end_column": 25 }, @@ -337,8 +473,8 @@ "_type": "BytesComparisonExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -353,8 +489,8 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -367,15 +503,15 @@ }, "op_code": "gtxns", "immediates": [ - "CloseRemainderTo" + "Sender" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 4, + "line": 10, + "end_line": 10, "column": 14, "end_column": 15 }, @@ -397,10 +533,10 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 8, - "end_line": 8, - "column": 22, - "end_column": 40 + "line": 12, + "end_line": 12, + "column": 12, + "end_column": 22 }, "wtype": { "_type": "WType", @@ -409,9 +545,9 @@ "ephemeral": false, "scalar_type": 1 }, - "op_code": "global", + "op_code": "txn", "immediates": [ - "ZeroAddress" + "Sender" ], "stack_args": [], "comment": null @@ -420,11 +556,11 @@ }, "op": "and", "right": { - "_type": "NumericComparisonExpression", + "_type": "BytesComparisonExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -439,29 +575,29 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "account", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": 1 }, "op_code": "gtxns", "immediates": [ - "FirstValid" + "Receiver" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 4, + "line": 10, + "end_line": 10, "column": 14, "end_column": 15 }, @@ -478,35 +614,39 @@ ], "comment": null }, - "operator": ">", + "operator": "==", "rhs": { - "_type": "IntegerConstant", + "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 9, - "end_line": 9, - "column": 31, - "end_column": 32 + "line": 13, + "end_line": 13, + "column": 14, + "end_column": 46 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "account", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": 1 }, - "value": "1", - "teal_alias": null + "op_code": "global", + "immediates": [ + "CurrentApplicationAddress" + ], + "stack_args": [], + "comment": null } } }, "op": "and", "right": { - "_type": "NumericComparisonExpression", + "_type": "BytesComparisonExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -521,29 +661,29 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "account", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": 1 }, "op_code": "gtxns", "immediates": [ - "LastValid" + "CloseRemainderTo" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 4, + "line": 10, + "end_line": 10, "column": 14, "end_column": 15 }, @@ -560,35 +700,39 @@ ], "comment": null }, - "operator": "<", + "operator": "==", "rhs": { - "_type": "IntegerConstant", + "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 10, - "end_line": 10, - "column": 27, - "end_column": 34 + "line": 14, + "end_line": 14, + "column": 22, + "end_column": 40 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "account", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": 1 }, - "value": "1099511627776", - "teal_alias": null + "op_code": "global", + "immediates": [ + "ZeroAddress" + ], + "stack_args": [], + "comment": null } } }, "op": "and", "right": { - "_type": "BytesComparisonExpression", + "_type": "NumericComparisonExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -603,29 +747,29 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, "wtype": { "_type": "WType", - "name": "account", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, "op_code": "gtxns", "immediates": [ - "Receiver" + "FirstValid" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 4, + "line": 10, + "end_line": 10, "column": 14, "end_column": 15 }, @@ -642,39 +786,35 @@ ], "comment": null }, - "operator": "==", + "operator": ">", "rhs": { - "_type": "IntrinsicCall", + "_type": "IntegerConstant", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 7, - "end_line": 7, - "column": 14, - "end_column": 46 + "line": 15, + "end_line": 15, + "column": 31, + "end_column": 32 }, "wtype": { "_type": "WType", - "name": "account", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, - "op_code": "global", - "immediates": [ - "CurrentApplicationAddress" - ], - "stack_args": [], - "comment": null + "value": "1", + "teal_alias": null } } }, "op": "and", "right": { - "_type": "BytesComparisonExpression", + "_type": "NumericComparisonExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, @@ -689,29 +829,29 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 11, + "line": 10, + "end_line": 17, "column": 2, "end_column": 4 }, "wtype": { "_type": "WType", - "name": "account", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, "op_code": "gtxns", "immediates": [ - "Sender" + "LastValid" ], "stack_args": [ { "_type": "VarExpression", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 4, - "end_line": 4, + "line": 10, + "end_line": 10, "column": 14, "end_column": 15 }, @@ -728,29 +868,25 @@ ], "comment": null }, - "operator": "==", + "operator": "<", "rhs": { - "_type": "IntrinsicCall", + "_type": "IntegerConstant", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 6, - "end_line": 6, - "column": 12, - "end_column": 22 + "line": 16, + "end_line": 16, + "column": 27, + "end_column": 34 }, "wtype": { "_type": "WType", - "name": "account", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, - "op_code": "txn", - "immediates": [ - "Sender" - ], - "stack_args": [], - "comment": null + "value": "1099511627776", + "teal_alias": null } } } @@ -772,72 +908,332 @@ "name": "test" }, { - "_type": "ContractFragment", + "_type": "Contract", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 14, + "line": 20, "end_line": 20, "column": 0, - "end_column": 1 + "end_column": 55 }, "id": "tests/approvals/assert-match.algo.ts::AssertMatchContract", "name": "AssertMatchContract", - "bases": [ + "description": null, + "method_resolution_order": [ "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" ], - "init": { + "approval_program": { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/assert-match.algo.ts", - "line": 14, - "end_line": 20, - "column": 0, - "end_column": 1 + "line": 21, + "end_line": 21, + "column": 2, + "end_column": 35 }, "args": [], "return_type": { "_type": "WType", - "name": "void", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": null + "scalar_type": 2 }, "body": { "_type": "Block", "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 14, - "end_line": 20, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "body": [ { - "_type": "ExpressionStatement", + "_type": "IfElse", "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 14, - "end_line": 20, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, - "expr": { - "_type": "VoidConstant", + "condition": { + "_type": "Not", "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 14, - "end_line": 20, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "wtype": { "_type": "WType", - "name": "void", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": null + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } } - } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 21, + "end_line": 25, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 22, + "end_line": 22, + "column": 10, + "end_column": 34 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 22, + "end_line": 22, + "column": 10, + "end_column": 13 + }, + "wtype": { + "_type": "WGroupTransaction", + "name": "group_transaction_pay", + "immutable": true, + "ephemeral": false, + "scalar_type": 2, + "transaction_type": 1 + }, + "name": "txn" + }, + "value": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 22, + "end_line": 22, + "column": 16, + "end_column": 34 + }, + "wtype": { + "_type": "WGroupTransaction", + "name": "group_transaction_pay", + "immutable": true, + "ephemeral": false, + "scalar_type": 2, + "transaction_type": 1 + }, + "expr": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 22, + "end_line": 22, + "column": 32, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 23, + "end_line": 23, + "column": 4, + "end_column": 13 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 23, + "end_line": 23, + "column": 4, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/assert-match.algo.ts::test" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 23, + "end_line": 23, + "column": 9, + "end_column": 12 + }, + "wtype": { + "_type": "WGroupTransaction", + "name": "group_transaction_pay", + "immutable": true, + "ephemeral": false, + "scalar_type": 2, + "transaction_type": 1 + }, + "name": "txn" + } + } + ] + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 24, + "end_line": 24, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 24, + "end_line": 24, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null } ], "label": null, @@ -850,19 +1246,18 @@ "returns": null }, "cref": "tests/approvals/assert-match.algo.ts::AssertMatchContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true + "member_name": "approvalProgram", + "arc4_method_config": null }, - "approval_program": { + "clear_program": { "_type": "ContractMethod", "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 15, - "end_line": 19, - "column": 2, - "end_column": 3 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "args": [], "return_type": { @@ -875,152 +1270,33 @@ "body": { "_type": "Block", "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 15, - "end_line": 19, - "column": 36, - "end_column": 3 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 16, - "end_line": 16, - "column": 10, - "end_column": 34 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 16, - "end_line": 16, - "column": 10, - "end_column": 13 - }, - "wtype": { - "_type": "WGroupTransaction", - "name": "group_transaction_pay", - "immutable": true, - "ephemeral": false, - "scalar_type": 2, - "transaction_type": 1 - }, - "name": "txn" - }, - "value": { - "_type": "ReinterpretCast", - "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 16, - "end_line": 16, - "column": 16, - "end_column": 34 - }, - "wtype": { - "_type": "WGroupTransaction", - "name": "group_transaction_pay", - "immutable": true, - "ephemeral": false, - "scalar_type": 2, - "transaction_type": 1 - }, - "expr": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 16, - "end_line": 16, - "column": 32, - "end_column": 33 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - } - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 17, - "end_line": 17, - "column": 4, - "end_column": 13 - }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 17, - "end_line": 17, - "column": 4, - "end_column": 13 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/assert-match.algo.ts::test" - }, - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 17, - "end_line": 17, - "column": 9, - "end_column": 12 - }, - "wtype": { - "_type": "WGroupTransaction", - "name": "group_transaction_pay", - "immutable": true, - "ephemeral": false, - "scalar_type": 2, - "transaction_type": 1 - }, - "name": "txn" - } - } - ] - } - }, { "_type": "ReturnStatement", "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 18, - "end_line": 18, - "column": 4, - "end_column": 15 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "value": { "_type": "BoolConstant", "source_location": { - "file": "tests/approvals/assert-match.algo.ts", - "line": 18, - "end_line": 18, - "column": 11, - "end_column": 15 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "wtype": { "_type": "WType", @@ -1042,22 +1318,164 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/assert-match.algo.ts::AssertMatchContract", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null }, - "clear_program": null, - "subroutines": [], - "app_state": {}, - "reserved_scratch_space": [], + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 20, + "end_line": 20, + "column": 0, + "end_column": 55 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 20, + "end_line": 20, + "column": 0, + "end_column": 55 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 20, + "end_line": 20, + "column": 0, + "end_column": 55 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/assert-match.algo.ts", + "line": 20, + "end_line": 20, + "column": 0, + "end_column": 55 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/assert-match.algo.ts::AssertMatchContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], "state_totals": { "globalBytes": null, "globalUints": null, "localBytes": null, "localUints": null }, - "docstring": null + "reserved_scratch_space": [] } ] \ No newline at end of file diff --git a/tests/approvals/out/biguint-expressions.awst b/tests/approvals/out/biguint-expressions/biguint-expressions.awst similarity index 100% rename from tests/approvals/out/biguint-expressions.awst rename to tests/approvals/out/biguint-expressions/biguint-expressions.awst diff --git a/tests/approvals/out/biguint-expressions.awst.json b/tests/approvals/out/biguint-expressions/biguint-expressions.awst.json similarity index 99% rename from tests/approvals/out/biguint-expressions.awst.json rename to tests/approvals/out/biguint-expressions/biguint-expressions.awst.json index af2649cd..3f5b05a6 100644 --- a/tests/approvals/out/biguint-expressions.awst.json +++ b/tests/approvals/out/biguint-expressions/biguint-expressions.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/biguint-expressions.algo.ts", "line": 4, - "end_line": 18, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 46 }, "args": [ { diff --git a/tests/approvals/out/boolean-conversions.awst b/tests/approvals/out/boolean-conversions/boolean-conversions.awst similarity index 100% rename from tests/approvals/out/boolean-conversions.awst rename to tests/approvals/out/boolean-conversions/boolean-conversions.awst diff --git a/tests/approvals/out/boolean-conversions.awst.json b/tests/approvals/out/boolean-conversions/boolean-conversions.awst.json similarity index 99% rename from tests/approvals/out/boolean-conversions.awst.json rename to tests/approvals/out/boolean-conversions/boolean-conversions.awst.json index 75e44662..49589682 100644 --- a/tests/approvals/out/boolean-conversions.awst.json +++ b/tests/approvals/out/boolean-conversions/boolean-conversions.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/boolean-conversions.algo.ts", "line": 4, - "end_line": 18, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 78 }, "args": [ { @@ -1140,9 +1140,9 @@ "source_location": { "file": "tests/approvals/boolean-conversions.algo.ts", "line": 20, - "end_line": 31, + "end_line": 20, "column": 0, - "end_column": 1 + "end_column": 34 }, "args": [], "return_type": { diff --git a/tests/approvals/out/boolean-expressions.awst b/tests/approvals/out/boolean-expressions/boolean-expressions.awst similarity index 74% rename from tests/approvals/out/boolean-expressions.awst rename to tests/approvals/out/boolean-expressions/boolean-expressions.awst index f7e4daf3..a13ee8b3 100644 --- a/tests/approvals/out/boolean-expressions.awst +++ b/tests/approvals/out/boolean-expressions/boolean-expressions.awst @@ -1,7 +1,7 @@ subroutine test(a: uint64, b: uint64, c: string, d: bytes, e: uint64): bool { - x: uint64 = (Boolean((#1 = (Boolean(a) ? a : b))) ? #1 : e) - assert(Boolean((Boolean((#2 = (Boolean(a) ? b : a))) ? e : #2))) + x: uint64 = (Boolean((#12 = (Boolean(a) ? a : b))) ? #12 : e) + assert(Boolean((Boolean((#13 = (Boolean(a) ? b : a))) ? e : #13))) y: uint64 = (Boolean(a) ? b : a) z: uint64 = (Boolean(a) and Boolean(len(d)) or Boolean(y) ? (Boolean(x) ? x : y) : (Boolean(x) ? y : x)) if (Boolean(a) or Boolean(len(c)) and Boolean(len(d))) { diff --git a/tests/approvals/out/boolean-expressions.awst.json b/tests/approvals/out/boolean-expressions/boolean-expressions.awst.json similarity index 99% rename from tests/approvals/out/boolean-expressions.awst.json rename to tests/approvals/out/boolean-expressions/boolean-expressions.awst.json index 29d81c45..4d8248d6 100644 --- a/tests/approvals/out/boolean-expressions.awst.json +++ b/tests/approvals/out/boolean-expressions/boolean-expressions.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/boolean-expressions.algo.ts", "line": 4, - "end_line": 18, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 67 }, "args": [ { @@ -280,7 +280,7 @@ "name": "b" } }, - "id": "1" + "id": "12" } }, "true_expr": { @@ -387,7 +387,7 @@ "name": "b" } }, - "id": "1" + "id": "12" }, "false_expr": { "_type": "VarExpression", @@ -589,7 +589,7 @@ "name": "a" } }, - "id": "2" + "id": "13" } }, "true_expr": { @@ -714,7 +714,7 @@ "name": "a" } }, - "id": "2" + "id": "13" } } } @@ -1227,9 +1227,9 @@ "source_location": { "file": "tests/approvals/boolean-expressions.algo.ts", "line": 9, - "end_line": 11, + "end_line": 9, "column": 2, - "end_column": 3 + "end_column": 20 }, "condition": { "_type": "BooleanBinaryOperation", @@ -1526,9 +1526,9 @@ "source_location": { "file": "tests/approvals/boolean-expressions.algo.ts", "line": 14, - "end_line": 16, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 19 }, "condition": { "_type": "ReinterpretCast", diff --git a/tests/approvals/out/box-proxies.awst b/tests/approvals/out/box-proxies/box-proxies.awst similarity index 100% rename from tests/approvals/out/box-proxies.awst rename to tests/approvals/out/box-proxies/box-proxies.awst diff --git a/tests/approvals/out/box-proxies.awst.json b/tests/approvals/out/box-proxies/box-proxies.awst.json similarity index 99% rename from tests/approvals/out/box-proxies.awst.json rename to tests/approvals/out/box-proxies/box-proxies.awst.json index 0cc93018..4b456160 100644 --- a/tests/approvals/out/box-proxies.awst.json +++ b/tests/approvals/out/box-proxies/box-proxies.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/box-proxies.algo.ts", "line": 5, - "end_line": 27, + "end_line": 5, "column": 0, - "end_column": 1 + "end_column": 49 }, "args": [ { @@ -543,7 +543,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1190,7 +1190,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1261,7 +1261,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1471,7 +1471,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1542,7 +1542,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1669,9 +1669,9 @@ "source_location": { "file": "tests/approvals/box-proxies.algo.ts", "line": 31, - "end_line": 44, + "end_line": 31, "column": 0, - "end_column": 1 + "end_column": 74 }, "args": [ { @@ -2060,7 +2060,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2242,7 +2242,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -3191,9 +3191,9 @@ "source_location": { "file": "tests/approvals/box-proxies.algo.ts", "line": 48, - "end_line": 60, + "end_line": 48, "column": 0, - "end_column": 1 + "end_column": 48 }, "args": [ { @@ -3255,9 +3255,9 @@ "source_location": { "file": "tests/approvals/box-proxies.algo.ts", "line": 49, - "end_line": 53, + "end_line": 49, "column": 2, - "end_column": 3 + "end_column": 21 }, "condition": { "_type": "Not", @@ -3302,7 +3302,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -3490,9 +3490,9 @@ "source_location": { "file": "tests/approvals/box-proxies.algo.ts", "line": 51, - "end_line": 53, + "end_line": 51, "column": 9, - "end_column": 3 + "end_column": 38 }, "body": [ { @@ -3500,9 +3500,9 @@ "source_location": { "file": "tests/approvals/box-proxies.algo.ts", "line": 51, - "end_line": 53, + "end_line": 51, "column": 9, - "end_column": 3 + "end_column": 38 }, "condition": { "_type": "NumericComparisonExpression", @@ -3547,7 +3547,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, diff --git a/tests/approvals/out/byte-expressions.awst b/tests/approvals/out/byte-expressions/byte-expressions.awst similarity index 100% rename from tests/approvals/out/byte-expressions.awst rename to tests/approvals/out/byte-expressions/byte-expressions.awst diff --git a/tests/approvals/out/byte-expressions.awst.json b/tests/approvals/out/byte-expressions/byte-expressions.awst.json similarity index 99% rename from tests/approvals/out/byte-expressions.awst.json rename to tests/approvals/out/byte-expressions/byte-expressions.awst.json index 99703c9a..4ca2f978 100644 --- a/tests/approvals/out/byte-expressions.awst.json +++ b/tests/approvals/out/byte-expressions/byte-expressions.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/byte-expressions.algo.ts", "line": 4, - "end_line": 13, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 47 }, "args": [ { diff --git a/tests/approvals/out/call-expressions.awst b/tests/approvals/out/call-expressions.awst deleted file mode 100644 index 01399157..00000000 --- a/tests/approvals/out/call-expressions.awst +++ /dev/null @@ -1,40 +0,0 @@ -contract ExampleBase extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - void - } - - baseMethod(): uint64 - { - return 2 - } - -} -contract Example extends tests/approvals/call-expressions.algo.ts::ExampleBase, @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - super.constructor() - } - - approvalProgram(): bool - { - return this.localMethod() + this.baseMethod() == tests/approvals/call-expressions.algo.ts::freeMethod() - this.baseMethod() - } - - baseMethod(): uint64 - { - return 1 - } - - localMethod(): uint64 - { - return 5 - } - -} -subroutine freeMethod(): uint64 -{ - return 7 -} \ No newline at end of file diff --git a/tests/approvals/out/call-expressions.awst.json b/tests/approvals/out/call-expressions.awst.json deleted file mode 100644 index dc517211..00000000 --- a/tests/approvals/out/call-expressions.awst.json +++ /dev/null @@ -1,685 +0,0 @@ -[ - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 4, - "end_line": 8, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/call-expressions.algo.ts::ExampleBase", - "name": "ExampleBase", - "bases": [ - "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 4, - "end_line": 8, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 4, - "end_line": 8, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 4, - "end_line": 8, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 4, - "end_line": 8, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/call-expressions.algo.ts::ExampleBase", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": null, - "clear_program": null, - "subroutines": [ - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 5, - "end_line": 7, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 5, - "end_line": 7, - "column": 33, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 6, - "end_line": 6, - "column": 4, - "end_column": 12 - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 6, - "end_line": 6, - "column": 11, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "2", - "teal_alias": null - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/call-expressions.algo.ts::ExampleBase", - "member_name": "baseMethod", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - } - ], - "app_state": {}, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - }, - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 10, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/call-expressions.algo.ts::default", - "name": "Example", - "bases": [ - "tests/approvals/call-expressions.algo.ts::ExampleBase", - "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 10, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 10, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 10, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 10, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "InstanceSuperMethodTarget", - "member_name": "constructor" - }, - "args": [] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/call-expressions.algo.ts::default", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 11, - "end_line": 13, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 11, - "end_line": 13, - "column": 36, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 4, - "end_column": 87 - }, - "value": { - "_type": "NumericComparisonExpression", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 11, - "end_column": 87 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "lhs": { - "_type": "UInt64BinaryOperation", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 11, - "end_column": 50 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "left": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 11, - "end_column": 29 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "localMethod" - }, - "args": [] - }, - "op": "+", - "right": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 32, - "end_column": 50 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "baseMethod" - }, - "args": [] - } - }, - "operator": "==", - "rhs": { - "_type": "UInt64BinaryOperation", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 55, - "end_column": 87 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "left": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 55, - "end_column": 67 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/call-expressions.algo.ts::freeMethod" - }, - "args": [] - }, - "op": "-", - "right": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 12, - "end_line": 12, - "column": 70, - "end_column": 87 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "baseMethod" - }, - "args": [] - } - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/call-expressions.algo.ts::default", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - "clear_program": null, - "subroutines": [ - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 14, - "end_line": 16, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 14, - "end_line": 16, - "column": 33, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 15, - "end_line": 15, - "column": 4, - "end_column": 12 - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 15, - "end_line": 15, - "column": 11, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/call-expressions.algo.ts::default", - "member_name": "baseMethod", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 17, - "end_line": 19, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 17, - "end_line": 19, - "column": 32, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 18, - "end_line": 18, - "column": 4, - "end_column": 12 - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 18, - "end_line": 18, - "column": 11, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "5", - "teal_alias": null - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/call-expressions.algo.ts::default", - "member_name": "localMethod", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - } - ], - "app_state": {}, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 22, - "end_line": 24, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 22, - "end_line": 24, - "column": 30, - "end_column": 1 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 23, - "end_line": 23, - "column": 2, - "end_column": 10 - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/call-expressions.algo.ts", - "line": 23, - "end_line": 23, - "column": 9, - "end_column": 10 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "7", - "teal_alias": null - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/call-expressions.algo.ts::freeMethod", - "name": "freeMethod" - } -] \ No newline at end of file diff --git a/tests/approvals/out/call-expressions/Example.ssa.ir b/tests/approvals/out/call-expressions/Example.ssa.ir new file mode 100644 index 00000000..cfa3cf9b --- /dev/null +++ b/tests/approvals/out/call-expressions/Example.ssa.ir @@ -0,0 +1,48 @@ +contract tests/approvals/call-expressions.algo.ts::Example: + program approval: + subroutine tests/approvals/call-expressions.algo.ts::Example.approvalProgram() -> bool: + block@0: // L11 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/call-expressions.algo.ts::Example.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: uint64 = tests/approvals/call-expressions.algo.ts::Example.localMethod() + let tmp%1#0: uint64 = tests/approvals/call-expressions.algo.ts::ExampleBase.baseMethod() + let tmp%2#0: uint64 = (+ tmp%0#0 tmp%1#0) + let tmp%3#0: uint64 = tests/approvals/call-expressions.algo.ts::freeMethod() + let tmp%4#0: uint64 = tests/approvals/call-expressions.algo.ts::Example.baseMethod() + let tmp%5#0: uint64 = (- tmp%3#0 tmp%4#0) + let tmp%6#0: bool = (== tmp%2#0 tmp%5#0) + return tmp%6#0 + + subroutine tests/approvals/call-expressions.algo.ts::Example.constructor() -> void: + block@0: // L10 + tests/approvals/call-expressions.algo.ts::ExampleBase.constructor() + return + + subroutine tests/approvals/call-expressions.algo.ts::ExampleBase.constructor() -> void: + block@0: // L4 + return + + subroutine tests/approvals/call-expressions.algo.ts::Example.localMethod() -> uint64: + block@0: // L17 + return 5u + + subroutine tests/approvals/call-expressions.algo.ts::ExampleBase.baseMethod() -> uint64: + block@0: // L5 + return 2u + + subroutine tests/approvals/call-expressions.algo.ts::freeMethod() -> uint64: + block@0: // L22 + return 7u + + subroutine tests/approvals/call-expressions.algo.ts::Example.baseMethod() -> uint64: + block@0: // L14 + return 1u + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/call-expressions/call-expressions.awst b/tests/approvals/out/call-expressions/call-expressions.awst new file mode 100644 index 00000000..9548b1fc --- /dev/null +++ b/tests/approvals/out/call-expressions/call-expressions.awst @@ -0,0 +1,50 @@ +contract Example +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return this.localMethod() + super.baseMethod() == tests/approvals/call-expressions.algo.ts::freeMethod() - this.baseMethod() + } + + clearProgram(): bool + { + return True + } + + baseMethod(): uint64 + { + return 1 + } + + localMethod(): uint64 + { + return 5 + } + + constructor(): void + { + super.constructor() + } + + ExampleBase::baseMethod(): uint64 + { + return 2 + } + + ExampleBase::constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + +} +subroutine freeMethod(): uint64 +{ + return 7 +} \ No newline at end of file diff --git a/tests/approvals/out/call-expressions/call-expressions.awst.json b/tests/approvals/out/call-expressions/call-expressions.awst.json new file mode 100644 index 00000000..f0867d7a --- /dev/null +++ b/tests/approvals/out/call-expressions/call-expressions.awst.json @@ -0,0 +1,928 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 10, + "end_line": 10, + "column": 0, + "end_column": 50 + }, + "id": "tests/approvals/call-expressions.algo.ts::Example", + "name": "Example", + "description": null, + "method_resolution_order": [ + "tests/approvals/call-expressions.algo.ts::ExampleBase", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 35 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 11, + "end_line": 13, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 4, + "end_column": 87 + }, + "value": { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 11, + "end_column": 87 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 11, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 11, + "end_column": 29 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "localMethod" + }, + "args": [] + }, + "op": "+", + "right": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 32, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "baseMethod" + }, + "args": [] + } + }, + "operator": "==", + "rhs": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 55, + "end_column": 87 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 55, + "end_column": 67 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/call-expressions.algo.ts::freeMethod" + }, + "args": [] + }, + "op": "-", + "right": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 12, + "end_line": 12, + "column": 70, + "end_column": 87 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "baseMethod" + }, + "args": [] + } + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/call-expressions.algo.ts::Example", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 14, + "end_line": 14, + "column": 2, + "end_column": 32 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 14, + "end_line": 16, + "column": 33, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 15, + "end_line": 15, + "column": 4, + "end_column": 12 + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 15, + "end_line": 15, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/call-expressions.algo.ts::Example", + "member_name": "baseMethod", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 17, + "end_line": 17, + "column": 2, + "end_column": 31 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 17, + "end_line": 19, + "column": 32, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 18, + "end_line": 18, + "column": 4, + "end_column": 12 + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 18, + "end_line": 18, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "5", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/call-expressions.algo.ts::Example", + "member_name": "localMethod", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 10, + "end_line": 10, + "column": 0, + "end_column": 50 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 10, + "end_line": 10, + "column": 0, + "end_column": 50 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 10, + "end_line": 10, + "column": 0, + "end_column": 50 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 10, + "end_line": 10, + "column": 0, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/call-expressions.algo.ts::Example", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 32 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 5, + "end_line": 7, + "column": 33, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 6, + "end_line": 6, + "column": 4, + "end_column": 12 + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 6, + "end_line": 6, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/call-expressions.algo.ts::ExampleBase", + "member_name": "baseMethod", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 49 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 49 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 49 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 49 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/call-expressions.algo.ts::ExampleBase", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 22, + "end_line": 22, + "column": 0, + "end_column": 29 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 22, + "end_line": 24, + "column": 30, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 23, + "end_line": 23, + "column": 2, + "end_column": 10 + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/call-expressions.algo.ts", + "line": 23, + "end_line": 23, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "7", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/call-expressions.algo.ts::freeMethod", + "name": "freeMethod" + } +] \ No newline at end of file diff --git a/tests/approvals/out/conditional-expression.awst b/tests/approvals/out/conditional-expression/conditional-expression.awst similarity index 100% rename from tests/approvals/out/conditional-expression.awst rename to tests/approvals/out/conditional-expression/conditional-expression.awst diff --git a/tests/approvals/out/conditional-expression.awst.json b/tests/approvals/out/conditional-expression/conditional-expression.awst.json similarity index 99% rename from tests/approvals/out/conditional-expression.awst.json rename to tests/approvals/out/conditional-expression/conditional-expression.awst.json index b7316aa1..cb84e6cb 100644 --- a/tests/approvals/out/conditional-expression.awst.json +++ b/tests/approvals/out/conditional-expression/conditional-expression.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/conditional-expression.algo.ts", "line": 4, - "end_line": 13, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 35 }, "args": [ { diff --git a/tests/approvals/out/destructured-params.awst b/tests/approvals/out/destructured-params.awst deleted file mode 100644 index 3f9c5b7b..00000000 --- a/tests/approvals/out/destructured-params.awst +++ /dev/null @@ -1,11 +0,0 @@ -subroutine test(p: tuple[uint64, bytes, bool]): void -{ - [a, b, c]: readonlytuple[uint64, bytes, bool] = p - log(concat(concat(itob(a), b), itob(c))) -} -subroutine init(): void -{ - tests/approvals/destructured-params.algo.ts::test([1, "", False]) - temp: tuple[uint64, bytes, bool] = [2, "Hello", True] - tests/approvals/destructured-params.algo.ts::test(temp) -} \ No newline at end of file diff --git a/tests/approvals/out/destructured-params/destructured-params.awst b/tests/approvals/out/destructured-params/destructured-params.awst new file mode 100644 index 00000000..a3786741 --- /dev/null +++ b/tests/approvals/out/destructured-params/destructured-params.awst @@ -0,0 +1,11 @@ +subroutine test(p: { a: uint64, b: bytes, c: bool }): void +{ + { a: a, b: b, c: c }: { a: uint64, b: bytes, c: bool } = p + log(concat(concat(itob(a), b), itob(c))) +} +subroutine init(): void +{ + tests/approvals/destructured-params.algo.ts::test({ a: (#11 = { a: 1, b: "", c: False }).a, b: #11.b, c: #11.c }) + temp: { a: uint64, b: bytes, c: bool } = { a: 2, b: "Hello", c: True } + tests/approvals/destructured-params.algo.ts::test(temp) +} \ No newline at end of file diff --git a/tests/approvals/out/destructured-params.awst.json b/tests/approvals/out/destructured-params/destructured-params.awst.json similarity index 55% rename from tests/approvals/out/destructured-params.awst.json rename to tests/approvals/out/destructured-params/destructured-params.awst.json index 69a4f9d5..148725f0 100644 --- a/tests/approvals/out/destructured-params.awst.json +++ b/tests/approvals/out/destructured-params/destructured-params.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/destructured-params.algo.ts", "line": 4, - "end_line": 6, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 69 }, "args": [ { @@ -14,8 +14,8 @@ "name": "p", "wtype": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ @@ -40,6 +40,11 @@ "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "a", + "b", + "c" ] }, "source_location": { @@ -63,9 +68,9 @@ "source_location": { "file": "tests/approvals/destructured-params.algo.ts", "line": 4, - "end_line": 6, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 69 }, "body": [ { @@ -73,9 +78,9 @@ "source_location": { "file": "tests/approvals/destructured-params.algo.ts", "line": 4, - "end_line": 6, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 69 }, "body": [ { @@ -98,7 +103,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -124,6 +129,11 @@ "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "a", + "b", + "c" ] }, "items": [ @@ -194,8 +204,8 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ @@ -220,6 +230,11 @@ "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "a", + "b", + "c" ] }, "name": "p" @@ -435,9 +450,9 @@ "source_location": { "file": "tests/approvals/destructured-params.algo.ts", "line": 8, - "end_line": 12, + "end_line": 8, "column": 0, - "end_column": 1 + "end_column": 15 }, "args": [], "return_type": { @@ -501,7 +516,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -527,17 +542,22 @@ "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "a", + "b", + "c" ] }, "items": [ { - "_type": "IntegerConstant", + "_type": "FieldExpression", "source_location": { "file": "tests/approvals/destructured-params.algo.ts", "line": 9, "end_line": 9, - "column": 12, - "end_column": 13 + "column": 7, + "end_column": 39 }, "wtype": { "_type": "WType", @@ -546,17 +566,165 @@ "ephemeral": false, "scalar_type": 2 }, - "value": "1", - "teal_alias": null + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 7, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b", + "c" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 7, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b", + "c" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 12, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 24, + "end_column": 26 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 32, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + } + ] + }, + "id": "11" + }, + "name": "a" }, { - "_type": "BytesConstant", + "_type": "FieldExpression", "source_location": { "file": "tests/approvals/destructured-params.algo.ts", "line": 9, "end_line": 9, - "column": 24, - "end_column": 26 + "column": 7, + "end_column": 39 }, "wtype": { "_type": "WType", @@ -565,17 +733,165 @@ "ephemeral": false, "scalar_type": 1 }, - "value": "", - "encoding": "utf8" + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 7, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b", + "c" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 7, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b", + "c" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 12, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 24, + "end_column": 26 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 32, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + } + ] + }, + "id": "11" + }, + "name": "b" }, { - "_type": "BoolConstant", + "_type": "FieldExpression", "source_location": { "file": "tests/approvals/destructured-params.algo.ts", "line": 9, "end_line": 9, - "column": 32, - "end_column": 37 + "column": 7, + "end_column": 39 }, "wtype": { "_type": "WType", @@ -584,7 +900,156 @@ "ephemeral": false, "scalar_type": 2 }, - "value": false + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 7, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b", + "c" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 7, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b", + "c" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 12, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 24, + "end_column": 26 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/destructured-params.algo.ts", + "line": 9, + "end_line": 9, + "column": 32, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + } + ] + }, + "id": "11" + }, + "name": "c" } ] } @@ -612,8 +1077,8 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ @@ -638,6 +1103,11 @@ "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "a", + "b", + "c" ] }, "name": "temp" @@ -653,7 +1123,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -679,6 +1149,11 @@ "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "a", + "b", + "c" ] }, "items": [ @@ -785,8 +1260,8 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ @@ -811,6 +1286,11 @@ "ephemeral": false, "scalar_type": 2 } + ], + "names": [ + "a", + "b", + "c" ] }, "name": "temp" diff --git a/tests/approvals/out/destructuring-iterators/destructuring-iterators.awst b/tests/approvals/out/destructuring-iterators/destructuring-iterators.awst new file mode 100644 index 00000000..f810af47 --- /dev/null +++ b/tests/approvals/out/destructuring-iterators/destructuring-iterators.awst @@ -0,0 +1,11 @@ +subroutine test(): void +{ + items: readonlytuple[{ a: uint64, b: uint64 }, { a: uint64, b: uint64 }, { a: uint64, b: uint64 }] = [{ a: 1, b: 2 }, { a: 2, b: 2 }, { a: 3, b: 2 }] + total: uint64 = 0 + for ({ a: a, b: _ } in items) { + total: uint64 = total + a + #loop₁ᶜ: + } + #loop₁ᵇ: + assert(total == 6) +} \ No newline at end of file diff --git a/tests/approvals/out/destructuring-iterators/destructuring-iterators.awst.json b/tests/approvals/out/destructuring-iterators/destructuring-iterators.awst.json new file mode 100644 index 00000000..16693b23 --- /dev/null +++ b/tests/approvals/out/destructuring-iterators/destructuring-iterators.awst.json @@ -0,0 +1,956 @@ +[ + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 15 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 4, + "end_line": 15, + "column": 16, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 5, + "end_line": 9, + "column": 8, + "end_column": 12 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 5, + "end_line": 5, + "column": 8, + "end_column": 13 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + } + ] + }, + "name": "items" + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 5, + "end_line": 9, + "column": 16, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + } + ] + }, + "items": [ + { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 6, + "end_line": 6, + "column": 4, + "end_column": 34 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 6, + "end_line": 6, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 6, + "end_line": 6, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + ] + }, + { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 34 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 7, + "end_line": 7, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 7, + "end_line": 7, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + ] + }, + { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 8, + "end_line": 8, + "column": 4, + "end_column": 34 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "3", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 8, + "end_line": 8, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + ] + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 10, + "end_line": 10, + "column": 6, + "end_column": 23 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 10, + "end_line": 10, + "column": 6, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "total" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 10, + "end_line": 10, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 28 + }, + "body": [ + { + "_type": "ForInLoop", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 28 + }, + "sequence": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 22, + "end_column": 27 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + } + ] + }, + "name": "items" + }, + "items": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 7, + "end_column": 18 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 15, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 7, + "end_column": 18 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_" + } + ] + }, + "loop_body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 28 + }, + "body": [ + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 13, + "column": 29, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 12, + "end_line": 12, + "column": 4, + "end_column": 14 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 12, + "end_line": 12, + "column": 4, + "end_column": 9 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "total" + }, + "value": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 12, + "end_line": 12, + "column": 4, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 12, + "end_line": 12, + "column": 4, + "end_column": 9 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "total" + }, + "op": "+", + "right": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 12, + "end_line": 12, + "column": 13, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + } + } + } + ], + "label": null, + "comment": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 28 + }, + "body": [], + "label": "#loop₁ᶜ", + "comment": null + } + ], + "label": null, + "comment": null + } + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 28 + }, + "body": [], + "label": "#loop₁ᵇ", + "comment": null + } + ], + "label": null, + "comment": null + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 14, + "end_line": 14, + "column": 2, + "end_column": 21 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 14, + "end_line": 14, + "column": 2, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 14, + "end_line": 14, + "column": 9, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 14, + "end_line": 14, + "column": 9, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "total" + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/destructuring-iterators.algo.ts", + "line": 14, + "end_line": 14, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "6", + "teal_alias": null + } + } + ], + "comment": null + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/destructuring-iterators.algo.ts::test", + "name": "test" + } +] \ No newline at end of file diff --git a/tests/approvals/out/do-loops.awst b/tests/approvals/out/do-loops/do-loops.awst similarity index 100% rename from tests/approvals/out/do-loops.awst rename to tests/approvals/out/do-loops/do-loops.awst diff --git a/tests/approvals/out/do-loops.awst.json b/tests/approvals/out/do-loops/do-loops.awst.json similarity index 99% rename from tests/approvals/out/do-loops.awst.json rename to tests/approvals/out/do-loops/do-loops.awst.json index 9a800404..7eeedd36 100644 --- a/tests/approvals/out/do-loops.awst.json +++ b/tests/approvals/out/do-loops/do-loops.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/do-loops.algo.ts", "line": 4, - "end_line": 9, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 30 }, "args": [ { diff --git a/tests/approvals/out/ensure-budget.awst b/tests/approvals/out/ensure-budget.awst deleted file mode 100644 index 615a3824..00000000 --- a/tests/approvals/out/ensure-budget.awst +++ /dev/null @@ -1,17 +0,0 @@ -contract EnsureBudgetContract extends @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - void - } - - approvalProgram(): bool - { - ensure_budget(100, 0) - ensure_budget(100, 0) - ensure_budget(100, 1) - ensure_budget(100, 2) - return True - } - -} \ No newline at end of file diff --git a/tests/approvals/out/ensure-budget.awst.json b/tests/approvals/out/ensure-budget.awst.json deleted file mode 100644 index 49c17b8c..00000000 --- a/tests/approvals/out/ensure-budget.awst.json +++ /dev/null @@ -1,473 +0,0 @@ -[ - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 3, - "end_line": 12, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract", - "name": "EnsureBudgetContract", - "bases": [ - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 3, - "end_line": 12, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 3, - "end_line": 12, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 3, - "end_line": 12, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 3, - "end_line": 12, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 4, - "end_line": 11, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 4, - "end_line": 11, - "column": 36, - "end_column": 3 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 5, - "end_line": 5, - "column": 4, - "end_column": 21 - }, - "expr": { - "_type": "PuyaLibCall", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 5, - "end_line": 5, - "column": 4, - "end_column": 21 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "func": "ensure_budget", - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 5, - "end_line": 5, - "column": 17, - "end_column": 20 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "100", - "teal_alias": null - } - }, - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 5, - "end_line": 5, - "column": 4, - "end_column": 21 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "0", - "teal_alias": null - } - } - ] - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 6, - "end_line": 6, - "column": 4, - "end_column": 48 - }, - "expr": { - "_type": "PuyaLibCall", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 6, - "end_line": 6, - "column": 4, - "end_column": 48 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "func": "ensure_budget", - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 6, - "end_line": 6, - "column": 17, - "end_column": 20 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "100", - "teal_alias": null - } - }, - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 6, - "end_line": 6, - "column": 22, - "end_column": 47 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "0", - "teal_alias": null - } - } - ] - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 7, - "end_line": 7, - "column": 4, - "end_column": 47 - }, - "expr": { - "_type": "PuyaLibCall", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 7, - "end_line": 7, - "column": 4, - "end_column": 47 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "func": "ensure_budget", - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 7, - "end_line": 7, - "column": 17, - "end_column": 20 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "100", - "teal_alias": null - } - }, - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 7, - "end_line": 7, - "column": 22, - "end_column": 46 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - } - } - ] - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 8, - "end_line": 8, - "column": 4, - "end_column": 40 - }, - "expr": { - "_type": "PuyaLibCall", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 8, - "end_line": 8, - "column": 4, - "end_column": 40 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "func": "ensure_budget", - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 8, - "end_line": 8, - "column": 17, - "end_column": 20 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "100", - "teal_alias": null - } - }, - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 8, - "end_line": 8, - "column": 22, - "end_column": 39 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "2", - "teal_alias": null - } - } - ] - } - }, - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 10, - "end_line": 10, - "column": 4, - "end_column": 15 - }, - "value": { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/ensure-budget.algo.ts", - "line": 10, - "end_line": 10, - "column": 11, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - "clear_program": null, - "subroutines": [], - "app_state": {}, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - } -] \ No newline at end of file diff --git a/tests/approvals/out/EnsureBudgetContract.ssa.ir b/tests/approvals/out/ensure-budget/EnsureBudgetContract.ssa.ir similarity index 88% rename from tests/approvals/out/EnsureBudgetContract.ssa.ir rename to tests/approvals/out/ensure-budget/EnsureBudgetContract.ssa.ir index 4cc54647..24b92009 100644 --- a/tests/approvals/out/EnsureBudgetContract.ssa.ir +++ b/tests/approvals/out/ensure-budget/EnsureBudgetContract.ssa.ir @@ -2,22 +2,22 @@ contract tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract: program approval: subroutine tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract.approvalProgram() -> bool: block@0: // L4 - let app_id%0#0: uint64 = (txn ApplicationID) - goto app_id%0#0 ? block@2 : block@1 - block@1: // on_create_L3 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract.constructor() goto block@2 - block@2: // entrypoint_L3 + block@2: // after_if_else_L1 _puya_lib.util.ensure_budget(100u, 0u) _puya_lib.util.ensure_budget(100u, 0u) _puya_lib.util.ensure_budget(100u, 1u) _puya_lib.util.ensure_budget(100u, 2u) return 1u - + subroutine tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract.constructor() -> void: block@0: // L3 - return - + return + subroutine _puya_lib.util.ensure_budget(required_budget: uint64, fee_source: uint64) -> void: block@0: // L12 let required_budget_with_buffer#0: uint64 = (+ required_budget#0 10u) @@ -46,9 +46,9 @@ contract tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract: itxn_submit goto block@1 block@7: // after_while_L20 - return - + return + program clear-state: subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: block@0: // L1 - return 1u + return 1u \ No newline at end of file diff --git a/tests/approvals/out/ensure-budget/ensure-budget.awst b/tests/approvals/out/ensure-budget/ensure-budget.awst new file mode 100644 index 00000000..b1282051 --- /dev/null +++ b/tests/approvals/out/ensure-budget/ensure-budget.awst @@ -0,0 +1,30 @@ +contract EnsureBudgetContract +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + ensure_budget(100, 0) + ensure_budget(100, 0) + ensure_budget(100, 1) + ensure_budget(100, 2) + return True + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + +} \ No newline at end of file diff --git a/tests/approvals/out/ensure-budget/ensure-budget.awst.json b/tests/approvals/out/ensure-budget/ensure-budget.awst.json new file mode 100644 index 00000000..6eabe1ef --- /dev/null +++ b/tests/approvals/out/ensure-budget/ensure-budget.awst.json @@ -0,0 +1,755 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 56 + }, + "id": "tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract", + "name": "EnsureBudgetContract", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 4, + "end_line": 4, + "column": 2, + "end_column": 35 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 4, + "end_line": 11, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 5, + "end_line": 5, + "column": 4, + "end_column": 21 + }, + "expr": { + "_type": "PuyaLibCall", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 5, + "end_line": 5, + "column": 4, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "func": "ensure_budget", + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 5, + "end_line": 5, + "column": 17, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "100", + "teal_alias": null + } + }, + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 5, + "end_line": 5, + "column": 4, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 6, + "end_line": 6, + "column": 4, + "end_column": 48 + }, + "expr": { + "_type": "PuyaLibCall", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 6, + "end_line": 6, + "column": 4, + "end_column": 48 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "func": "ensure_budget", + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 6, + "end_line": 6, + "column": 17, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "100", + "teal_alias": null + } + }, + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 6, + "end_line": 6, + "column": 22, + "end_column": 47 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 47 + }, + "expr": { + "_type": "PuyaLibCall", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 47 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "func": "ensure_budget", + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 7, + "end_line": 7, + "column": 17, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "100", + "teal_alias": null + } + }, + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 7, + "end_line": 7, + "column": 22, + "end_column": 46 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 8, + "end_line": 8, + "column": 4, + "end_column": 40 + }, + "expr": { + "_type": "PuyaLibCall", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 8, + "end_line": 8, + "column": 4, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "func": "ensure_budget", + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 8, + "end_line": 8, + "column": 17, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "100", + "teal_alias": null + } + }, + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 8, + "end_line": 8, + "column": 22, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + } + ] + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 10, + "end_line": 10, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 10, + "end_line": 10, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 56 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 56 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 56 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/ensure-budget.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 56 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/ensure-budget.algo.ts::EnsureBudgetContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/for-loops.awst b/tests/approvals/out/for-loops/for-loops.awst similarity index 100% rename from tests/approvals/out/for-loops.awst rename to tests/approvals/out/for-loops/for-loops.awst diff --git a/tests/approvals/out/for-loops.awst.json b/tests/approvals/out/for-loops/for-loops.awst.json similarity index 98% rename from tests/approvals/out/for-loops.awst.json rename to tests/approvals/out/for-loops/for-loops.awst.json index 57192aee..da644d4f 100644 --- a/tests/approvals/out/for-loops.awst.json +++ b/tests/approvals/out/for-loops/for-loops.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 4, - "end_line": 10, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 65 }, "args": [ { @@ -179,9 +179,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 6, - "end_line": 8, + "end_line": 6, "column": 2, - "end_column": 3 + "end_column": 42 }, "condition": { "_type": "NumericComparisonExpression", @@ -242,9 +242,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 6, - "end_line": 8, + "end_line": 6, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [ { @@ -348,9 +348,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 6, - "end_line": 8, + "end_line": 6, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [], "label": "#loop₁ᶜ", @@ -448,9 +448,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 6, - "end_line": 8, + "end_line": 6, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [], "label": "#loop₁ᵇ", @@ -502,9 +502,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 12, - "end_line": 21, + "end_line": 12, "column": 0, - "end_column": 1 + "end_column": 71 }, "args": [ { @@ -677,9 +677,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 14, - "end_line": 19, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 42 }, "condition": { "_type": "NumericComparisonExpression", @@ -740,9 +740,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 14, - "end_line": 19, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [ { @@ -842,9 +842,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 16, - "end_line": 18, + "end_line": 16, "column": 4, - "end_column": 5 + "end_column": 19 }, "condition": { "_type": "NumericComparisonExpression", @@ -951,9 +951,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 14, - "end_line": 19, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [], "label": "#loop₁ᶜ", @@ -1051,9 +1051,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 14, - "end_line": 19, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [], "label": "#loop₁ᵇ", @@ -1105,9 +1105,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 23, - "end_line": 30, + "end_line": 23, "column": 0, - "end_column": 1 + "end_column": 74 }, "args": [ { @@ -1280,9 +1280,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 25, - "end_line": 28, + "end_line": 25, "column": 2, - "end_column": 3 + "end_column": 42 }, "condition": { "_type": "NumericComparisonExpression", @@ -1343,9 +1343,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 25, - "end_line": 28, + "end_line": 25, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [ { @@ -1365,7 +1365,7 @@ "line": 26, "end_line": 26, "column": 4, - "end_column": 29 + "end_column": 20 }, "condition": { "_type": "NumericComparisonExpression", @@ -1577,9 +1577,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 25, - "end_line": 28, + "end_line": 25, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [], "label": "#loop₁ᶜ", @@ -1677,9 +1677,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 25, - "end_line": 28, + "end_line": 25, "column": 2, - "end_column": 3 + "end_column": 42 }, "body": [], "label": "#loop₁ᵇ", @@ -1731,9 +1731,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 32, - "end_line": 41, + "end_line": 32, "column": 0, - "end_column": 1 + "end_column": 74 }, "args": [ { @@ -1906,9 +1906,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 34, - "end_line": 39, + "end_line": 34, "column": 9, - "end_column": 3 + "end_column": 49 }, "condition": { "_type": "NumericComparisonExpression", @@ -1969,9 +1969,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 34, - "end_line": 39, + "end_line": 34, "column": 9, - "end_column": 3 + "end_column": 49 }, "body": [ { @@ -2035,9 +2035,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 35, - "end_line": 38, + "end_line": 35, "column": 4, - "end_column": 5 + "end_column": 44 }, "condition": { "_type": "NumericComparisonExpression", @@ -2098,9 +2098,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 35, - "end_line": 38, + "end_line": 35, "column": 4, - "end_column": 5 + "end_column": 44 }, "body": [ { @@ -2251,9 +2251,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 35, - "end_line": 38, + "end_line": 35, "column": 4, - "end_column": 5 + "end_column": 44 }, "body": [], "label": "#loop₁ᶜ", @@ -2351,9 +2351,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 35, - "end_line": 38, + "end_line": 35, "column": 4, - "end_column": 5 + "end_column": 44 }, "body": [], "label": "#loop₁ᵇ", @@ -2368,9 +2368,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 34, - "end_line": 39, + "end_line": 34, "column": 9, - "end_column": 3 + "end_column": 49 }, "body": [], "label": "outer₁ᶜ", @@ -2468,9 +2468,9 @@ "source_location": { "file": "tests/approvals/for-loops.algo.ts", "line": 34, - "end_line": 39, + "end_line": 34, "column": 9, - "end_column": 3 + "end_column": 49 }, "body": [], "label": "outer₁ᵇ", diff --git a/tests/approvals/out/for-of-loops.awst b/tests/approvals/out/for-of-loops/for-of-loops.awst similarity index 100% rename from tests/approvals/out/for-of-loops.awst rename to tests/approvals/out/for-of-loops/for-of-loops.awst diff --git a/tests/approvals/out/for-of-loops.awst.json b/tests/approvals/out/for-of-loops/for-of-loops.awst.json similarity index 96% rename from tests/approvals/out/for-of-loops.awst.json rename to tests/approvals/out/for-of-loops/for-of-loops.awst.json index 5ea1264e..fa00b60e 100644 --- a/tests/approvals/out/for-of-loops.awst.json +++ b/tests/approvals/out/for-of-loops/for-of-loops.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/for-of-loops.algo.ts", "line": 3, - "end_line": 9, + "end_line": 3, "column": 0, - "end_column": 1 + "end_column": 67 }, "args": [ { @@ -14,7 +14,7 @@ "name": "items", "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -120,9 +120,9 @@ "source_location": { "file": "tests/approvals/for-of-loops.algo.ts", "line": 5, - "end_line": 7, + "end_line": 5, "column": 2, - "end_column": 3 + "end_column": 27 }, "body": [ { @@ -130,9 +130,9 @@ "source_location": { "file": "tests/approvals/for-of-loops.algo.ts", "line": 5, - "end_line": 7, + "end_line": 5, "column": 2, - "end_column": 3 + "end_column": 27 }, "sequence": { "_type": "VarExpression", @@ -145,7 +145,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -198,9 +198,9 @@ "source_location": { "file": "tests/approvals/for-of-loops.algo.ts", "line": 5, - "end_line": 7, + "end_line": 5, "column": 2, - "end_column": 3 + "end_column": 27 }, "body": [ { @@ -304,9 +304,9 @@ "source_location": { "file": "tests/approvals/for-of-loops.algo.ts", "line": 5, - "end_line": 7, + "end_line": 5, "column": 2, - "end_column": 3 + "end_column": 27 }, "body": [], "label": "#loop₁ᶜ", @@ -322,9 +322,9 @@ "source_location": { "file": "tests/approvals/for-of-loops.algo.ts", "line": 5, - "end_line": 7, + "end_line": 5, "column": 2, - "end_column": 3 + "end_column": 27 }, "body": [], "label": "#loop₁ᵇ", diff --git a/tests/approvals/out/global-state.awst.json b/tests/approvals/out/global-state.awst.json deleted file mode 100644 index 49e329e2..00000000 --- a/tests/approvals/out/global-state.awst.json +++ /dev/null @@ -1,1303 +0,0 @@ -[ - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 4, - "end_line": 6, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/global-state.algo.ts::BaseTestContract", - "name": "BaseTestContract", - "bases": [ - "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 4, - "end_line": 6, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 4, - "end_line": 6, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 4, - "end_line": 6, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 4, - "end_line": 6, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 62 - }, - "target": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "VqtS-RAqB?Q*>c;Wd", - "encoding": "utf8" - }, - "exists_assertion_message": null - }, - "value": { - "_type": "StringConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 46, - "end_column": 59 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "testing 123" - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/global-state.algo.ts::BaseTestContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": null, - "clear_program": null, - "subroutines": [], - "app_state": { - "baseTestState": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 15 - }, - "member_name": "baseTestState", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "VqtS-RAqB?Q*>c;Wd", - "encoding": "utf8" - }, - "description": null - } - }, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - }, - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 8, - "end_line": 29, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/global-state.algo.ts::TestContract", - "name": "TestContract", - "bases": [ - "tests/approvals/global-state.algo.ts::BaseTestContract", - "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 14, - "end_line": 19, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 14, - "end_line": 19, - "column": 16, - "end_column": 3 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 15, - "end_line": 15, - "column": 10, - "end_column": 37 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 15, - "end_line": 15, - "column": 10, - "end_column": 19 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "someValue" - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 15, - "end_line": 15, - "column": 30, - "end_column": 37 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "72057594037927936", - "teal_alias": null - } - }, - { - "_type": "Block", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 16, - "end_line": 16, - "column": 4, - "end_column": 11 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 16, - "end_line": 16, - "column": 4, - "end_column": 11 - }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 16, - "end_line": 16, - "column": 4, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "InstanceSuperMethodTarget", - "member_name": "constructor" - }, - "args": [] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 54 - }, - "target": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNQ*>c;Wd", - "encoding": "utf8" - }, - "exists_assertion_message": null - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 49, - "end_column": 50 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "2", - "teal_alias": null - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 12, - "end_line": 12, - "column": 2, - "end_column": 80 - }, - "target": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 12, - "end_line": 12, - "column": 2, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 12, - "end_line": 12, - "column": 65, - "end_column": 76 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "R7F!%Q&d4zMF", - "encoding": "utf8" - }, - "exists_assertion_message": null - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 12, - "end_line": 12, - "column": 50, - "end_column": 51 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "5", - "teal_alias": null - } - } - ], - "label": null, - "comment": null - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 17, - "end_line": 17, - "column": 4, - "end_column": 113 - }, - "expr": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 17, - "end_line": 17, - "column": 4, - "end_column": 113 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "op_code": "assert", - "immediates": [], - "stack_args": [ - { - "_type": "BytesComparisonExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 17, - "end_line": 17, - "column": 11, - "end_column": 53 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "lhs": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 17, - "end_line": 17, - "column": 11, - "end_column": 35 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "VqtS-RAqB?Q*>c;Wd", - "encoding": "utf8" - }, - "exists_assertion_message": "check GlobalState exists" - }, - "operator": "==", - "rhs": { - "_type": "StringConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 17, - "end_line": 17, - "column": 40, - "end_column": 53 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "testing 123" - } - } - ], - "comment": "Base class state should be initialized after super call" - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 18, - "end_line": 18, - "column": 4, - "end_column": 62 - }, - "target": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 18, - "end_line": 18, - "column": 4, - "end_column": 27 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 10, - "end_line": 10, - "column": 2, - "end_column": 14 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "Zf{9$X>@5}Y)Ni(", - "encoding": "utf8" - }, - "exists_assertion_message": "check GlobalState exists" - }, - "value": { - "_type": "UInt64BinaryOperation", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 18, - "end_line": 18, - "column": 30, - "end_column": 62 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "left": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 18, - "end_line": 18, - "column": 30, - "end_column": 39 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "someValue" - }, - "op": "*", - "right": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 18, - "end_line": 18, - "column": 42, - "end_column": 62 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNQ*>c;Wd", - "encoding": "utf8" - }, - "exists_assertion_message": "check GlobalState exists" - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/global-state.algo.ts::TestContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - "approval_program": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 21, - "end_line": 28, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 21, - "end_line": 28, - "column": 36, - "end_column": 3 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 22, - "end_line": 22, - "column": 4, - "end_column": 62 - }, - "expr": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 22, - "end_line": 22, - "column": 4, - "end_column": 62 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "op_code": "assert", - "immediates": [], - "stack_args": [ - { - "_type": "StateExists", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 22, - "end_line": 22, - "column": 11, - "end_column": 34 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "field": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 22, - "end_line": 22, - "column": 11, - "end_column": 34 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNQ*>c;Wd", - "encoding": "utf8" - }, - "exists_assertion_message": "check GlobalState exists" - } - } - ], - "comment": "State should have value" - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 23, - "end_line": 23, - "column": 4, - "end_column": 62 - }, - "expr": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 23, - "end_line": 23, - "column": 4, - "end_column": 62 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "op_code": "assert", - "immediates": [], - "stack_args": [ - { - "_type": "NumericComparisonExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 23, - "end_line": 23, - "column": 11, - "end_column": 37 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "lhs": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 23, - "end_line": 23, - "column": 11, - "end_column": 31 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNQ*>c;Wd", - "encoding": "utf8" - }, - "exists_assertion_message": "check GlobalState exists" - }, - "operator": "==", - "rhs": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 23, - "end_line": 23, - "column": 36, - "end_column": 37 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "2", - "teal_alias": null - } - } - ], - "comment": "Value should equal 2" - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 25, - "end_line": 25, - "column": 4, - "end_column": 58 - }, - "target": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 25, - "end_line": 25, - "column": 4, - "end_column": 24 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNQ*>c;Wd", - "encoding": "utf8" - }, - "exists_assertion_message": "check GlobalState exists" - }, - "value": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 25, - "end_line": 25, - "column": 27, - "end_column": 58 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "op_code": "btoi", - "immediates": [], - "stack_args": [ - { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 25, - "end_line": 25, - "column": 35, - "end_column": 57 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "op_code": "txnas", - "immediates": [ - "ApplicationArgs" - ], - "stack_args": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 25, - "end_line": 25, - "column": 55, - "end_column": 56 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "0", - "teal_alias": null - } - ], - "comment": null - } - ], - "comment": null - } - }, - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 27, - "end_line": 27, - "column": 4, - "end_column": 15 - }, - "value": { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 27, - "end_line": 27, - "column": 11, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/global-state.algo.ts::TestContract", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - "clear_program": null, - "subroutines": [], - "app_state": { - "baseTestState": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 15 - }, - "member_name": "baseTestState", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "VqtS-RAqB?Q*>c;Wd", - "encoding": "utf8" - }, - "description": null - }, - "noInitial": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 9, - "end_line": 9, - "column": 2, - "end_column": 11 - }, - "member_name": "noInitial", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 9, - "end_line": 9, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "Zf{9$X>@5}Yy", - "encoding": "utf8" - }, - "description": null - }, - "noInitialInt": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 10, - "end_line": 10, - "column": 2, - "end_column": 14 - }, - "member_name": "noInitialInt", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 10, - "end_line": 10, - "column": 2, - "end_column": 14 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "Zf{9$X>@5}Y)Ni(", - "encoding": "utf8" - }, - "description": null - }, - "testState": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "member_name": "testState", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 11, - "end_line": 11, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNQ*>c;Wd", - "encoding": "utf8" - }, - "description": null - }, - "testState2": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 12, - "end_line": 12, - "column": 2, - "end_column": 12 - }, - "member_name": "testState2", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/global-state.algo.ts", - "line": 12, - "end_line": 12, - "column": 65, - "end_column": 76 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "R7F!%Q&d4zMF", - "encoding": "utf8" - }, - "description": null - } - }, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - } -] \ No newline at end of file diff --git a/tests/approvals/out/global-state/TestContract.ssa.ir b/tests/approvals/out/global-state/TestContract.ssa.ir new file mode 100644 index 00000000..b33a0eb9 --- /dev/null +++ b/tests/approvals/out/global-state/TestContract.ssa.ir @@ -0,0 +1,46 @@ +contract tests/approvals/global-state.algo.ts::TestContract: + program approval: + subroutine tests/approvals/global-state.algo.ts::TestContract.approvalProgram() -> bool: + block@0: // L21 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/global-state.algo.ts::TestContract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let (maybe_value%0#0: uint64, maybe_exists%0#0: bool) = (app_global_get_ex 0u "testState") + (assert maybe_exists%0#0) // State should have value + let (maybe_value%1#0: uint64, maybe_exists%1#0: bool) = (app_global_get_ex 0u "testState") + (assert maybe_exists%1#0) // check GlobalState exists + let tmp%0#0: bool = (== maybe_value%1#0 2u) + (assert tmp%0#0) // Value should equal 2 + let tmp%1#0: bytes = ((txnas ApplicationArgs) 0u) + let new_state_value%0#0: uint64 = (btoi tmp%1#0) + (app_global_put "testState" new_state_value%0#0) + return 1u + + subroutine tests/approvals/global-state.algo.ts::TestContract.constructor() -> void: + block@0: // L14 + let someValue#0: uint64 = 72057594037927936u + tests/approvals/global-state.algo.ts::BaseTestContract.constructor() + (app_global_put "testState" 2u) + (app_global_put "TESTSTATE" 5u) + let (maybe_value%0#0: bytes, maybe_exists%0#0: bool) = (app_global_get_ex 0u "baseTestState") + (assert maybe_exists%0#0) // check GlobalState exists + let tmp%0#0: bool = (== maybe_value%0#0 "testing 123") + (assert tmp%0#0) // Base class state should be initialized after super call + let (maybe_value%1#0: uint64, maybe_exists%1#0: bool) = (app_global_get_ex 0u "testState") + (assert maybe_exists%1#0) // check GlobalState exists + let new_state_value%0#0: uint64 = (* someValue#0 maybe_value%1#0) + (app_global_put "noInitialInt" new_state_value%0#0) + return + + subroutine tests/approvals/global-state.algo.ts::BaseTestContract.constructor() -> void: + block@0: // L4 + (app_global_put "baseTestState" "testing 123") + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/global-state.awst b/tests/approvals/out/global-state/global-state.awst similarity index 62% rename from tests/approvals/out/global-state.awst rename to tests/approvals/out/global-state/global-state.awst index 29c173fd..3f3a2038 100644 --- a/tests/approvals/out/global-state.awst +++ b/tests/approvals/out/global-state/global-state.awst @@ -1,16 +1,4 @@ -contract BaseTestContract extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - globals { - ["baseTestState"]: string - } - constructor(): void - { - void - GlobalState["baseTestState"]: string = "testing 123" - } - -} -contract TestContract extends tests/approvals/global-state.algo.ts::BaseTestContract, @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract +contract TestContract { globals { ["baseTestState"]: string @@ -19,6 +7,22 @@ contract TestContract extends tests/approvals/global-state.algo.ts::BaseTestCont ["testState"]: uint64 ["TESTSTATE"]: uint64 } + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + assert(STATE_EXISTS(GlobalState["testState"])) + assert(GlobalState["testState"] == 2) + GlobalState["testState"]: uint64 = btoi(txnas(0)) + return True + } + + clearProgram(): bool + { + return True + } + constructor(): void { someValue: uint64 = 72057594037927936 @@ -29,12 +33,15 @@ contract TestContract extends tests/approvals/global-state.algo.ts::BaseTestCont GlobalState["noInitialInt"]: uint64 = someValue * GlobalState["testState"] } - approvalProgram(): bool + BaseTestContract::constructor(): void { - assert(STATE_EXISTS(GlobalState["testState"])) - assert(GlobalState["testState"] == 2) - GlobalState["testState"]: uint64 = btoi(txnas(0)) - return True + void + GlobalState["baseTestState"]: string = "testing 123" + } + + Contract::constructor(): void + { + this.constructor() } } \ No newline at end of file diff --git a/tests/approvals/out/global-state/global-state.awst.json b/tests/approvals/out/global-state/global-state.awst.json new file mode 100644 index 00000000..5023fcae --- /dev/null +++ b/tests/approvals/out/global-state/global-state.awst.json @@ -0,0 +1,1513 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 52 + }, + "id": "tests/approvals/global-state.algo.ts::TestContract", + "name": "TestContract", + "description": null, + "method_resolution_order": [ + "tests/approvals/global-state.algo.ts::BaseTestContract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 21, + "end_line": 21, + "column": 2, + "end_column": 35 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 21, + "end_line": 28, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 22, + "end_line": 22, + "column": 4, + "end_column": 62 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 22, + "end_line": 22, + "column": 4, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "StateExists", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 22, + "end_line": 22, + "column": 11, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "field": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 22, + "end_line": 22, + "column": 11, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNQ*>c;Wd", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + } + } + ], + "comment": "State should have value" + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 23, + "end_line": 23, + "column": 4, + "end_column": 62 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 23, + "end_line": 23, + "column": 4, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "NumericComparisonExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 23, + "end_line": 23, + "column": 11, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 23, + "end_line": 23, + "column": 11, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNQ*>c;Wd", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "operator": "==", + "rhs": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 23, + "end_line": 23, + "column": 36, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + } + ], + "comment": "Value should equal 2" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 25, + "end_line": 25, + "column": 4, + "end_column": 58 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 25, + "end_line": 25, + "column": 4, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNQ*>c;Wd", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 25, + "end_line": 25, + "column": 27, + "end_column": 58 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "btoi", + "immediates": [], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 25, + "end_line": 25, + "column": 35, + "end_column": 57 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txnas", + "immediates": [ + "ApplicationArgs" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 25, + "end_line": 25, + "column": 55, + "end_column": 56 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ], + "comment": null + } + ], + "comment": null + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 27, + "end_line": 27, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 27, + "end_line": 27, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/global-state.algo.ts::TestContract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 14, + "end_line": 19, + "column": 2, + "end_column": 3 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 14, + "end_line": 19, + "column": 16, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 15, + "end_line": 15, + "column": 10, + "end_column": 37 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 15, + "end_line": 15, + "column": 10, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "someValue" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "72057594037927936", + "teal_alias": null + } + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 11 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 11 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 16, + "end_line": 16, + "column": 4, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 54 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNQ*>c;Wd", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 49, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 80 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 12, + "end_line": 12, + "column": 65, + "end_column": 76 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "R7F!%Q&d4zMF", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 12, + "end_line": 12, + "column": 50, + "end_column": 51 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "5", + "teal_alias": null + } + } + ], + "label": null, + "comment": null + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 113 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 17, + "end_line": 17, + "column": 4, + "end_column": 113 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "assert", + "immediates": [], + "stack_args": [ + { + "_type": "BytesComparisonExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 17, + "end_line": 17, + "column": 11, + "end_column": 53 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "lhs": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 17, + "end_line": 17, + "column": 11, + "end_column": 35 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "VqtS-RAqB?Q*>c;Wd", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "operator": "==", + "rhs": { + "_type": "StringConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 17, + "end_line": 17, + "column": 40, + "end_column": 53 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "testing 123" + } + } + ], + "comment": "Base class state should be initialized after super call" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 18, + "end_line": 18, + "column": 4, + "end_column": 62 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 18, + "end_line": 18, + "column": 4, + "end_column": 27 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 10, + "end_line": 10, + "column": 2, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Zf{9$X>@5}Y)Ni(", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + }, + "value": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 18, + "end_line": 18, + "column": 30, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 18, + "end_line": 18, + "column": 30, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "someValue" + }, + "op": "*", + "right": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 18, + "end_line": 18, + "column": 42, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNQ*>c;Wd", + "encoding": "utf8" + }, + "exists_assertion_message": "check GlobalState exists" + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/global-state.algo.ts::TestContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 61 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 61 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 61 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 61 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 62 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "VqtS-RAqB?Q*>c;Wd", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "StringConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 5, + "end_line": 5, + "column": 46, + "end_column": 59 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "testing 123" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/global-state.algo.ts::BaseTestContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [ + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 15 + }, + "member_name": "baseTestState", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "VqtS-RAqB?Q*>c;Wd", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 11 + }, + "member_name": "noInitial", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 9, + "end_line": 9, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Zf{9$X>@5}Yy", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 10, + "end_line": 10, + "column": 2, + "end_column": 14 + }, + "member_name": "noInitialInt", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 10, + "end_line": 10, + "column": 2, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Zf{9$X>@5}Y)Ni(", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "member_name": "testState", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNQ*>c;Wd", + "encoding": "utf8" + }, + "description": null + }, + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 12 + }, + "member_name": "testState2", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/global-state.algo.ts", + "line": 12, + "end_line": 12, + "column": 65, + "end_column": 76 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "R7F!%Q&d4zMF", + "encoding": "utf8" + }, + "description": null + } + ], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/BaseWithAbiCreate.arc32.json b/tests/approvals/out/implicit-create/BaseWithAbiCreate.arc32.json new file mode 100644 index 00000000..e1fd7ae8 --- /dev/null +++ b/tests/approvals/out/implicit-create/BaseWithAbiCreate.arc32.json @@ -0,0 +1,48 @@ +{ + "hints": { + "create()void": { + "call_config": { + "no_op": "CREATE" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkJhc2VXaXRoQWJpQ3JlYXRlLmFwcHJvdmFsUHJvZ3JhbToKICAgIGNhbGxzdWIgX19wdXlhX2FyYzRfcm91dGVyX18KICAgIHJldHVybgoKCi8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czo6QmFzZVdpdGhBYmlDcmVhdGUuX19wdXlhX2FyYzRfcm91dGVyX18oKSAtPiB1aW50NjQ6Cl9fcHV5YV9hcmM0X3JvdXRlcl9fOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjE3CiAgICAvLyBjbGFzcyBCYXNlV2l0aEFiaUNyZWF0ZSBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJ6IF9fcHV5YV9hcmM0X3JvdXRlcl9fX2FmdGVyX2lmX2Vsc2VANgogICAgcHVzaGJ5dGVzIDB4NGM1YzYxYmEgLy8gbWV0aG9kICJjcmVhdGUoKXZvaWQiCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAwCiAgICBtYXRjaCBfX3B1eWFfYXJjNF9yb3V0ZXJfX19jcmVhdGVfcm91dGVAMgogICAgcHVzaGludCAwIC8vIDAKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fY3JlYXRlX3JvdXRlQDI6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6MTgKICAgIC8vIEBhYmltZXRob2QoeyBvbkNyZWF0ZTogJ3JlcXVpcmUnIH0pCiAgICB0eG4gT25Db21wbGV0aW9uCiAgICAhCiAgICBhc3NlcnQgLy8gT25Db21wbGV0aW9uIGlzIE5vT3AKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICAhCiAgICBhc3NlcnQgLy8gaXMgY3JlYXRpbmcKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2FmdGVyX2lmX2Vsc2VANjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czoxNwogICAgLy8gY2xhc3MgQmFzZVdpdGhBYmlDcmVhdGUgZXh0ZW5kcyBDb250cmFjdCB7CiAgICBwdXNoaW50IDAgLy8gMAogICAgcmV0c3ViCg==", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkJhc2VXaXRoQWJpQ3JlYXRlLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "BaseWithAbiCreate", + "methods": [ + { + "name": "create", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": {} +} \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/BaseWithAbiCreate.ssa.ir b/tests/approvals/out/implicit-create/BaseWithAbiCreate.ssa.ir new file mode 100644 index 00000000..91d2a684 --- /dev/null +++ b/tests/approvals/out/implicit-create/BaseWithAbiCreate.ssa.ir @@ -0,0 +1,51 @@ +contract tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.constructor() -> void: + block@0: // L17 + return + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.__puya_arc4_router__() -> bool: + block@0: // L17 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L17 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "create()void" => block@2, * => block@3} + block@2: // create_route_L18 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (== tmp%5#0 0u) + (assert tmp%6#0) // is creating + tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.create() + return 1u + block@3: // switch_case_default_L17 + goto block@4 + block@4: // switch_case_next_L17 + goto block@6 + block@5: // bare_routing_L17 + goto block@6 + block@6: // after_if_else_L17 + return 0u + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.create() -> void: + block@0: // L18 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/BaseWithBareCreate.arc32.json b/tests/approvals/out/implicit-create/BaseWithBareCreate.arc32.json new file mode 100644 index 00000000..df985c5a --- /dev/null +++ b/tests/approvals/out/implicit-create/BaseWithBareCreate.arc32.json @@ -0,0 +1,35 @@ +{ + "hints": {}, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkJhc2VXaXRoQmFyZUNyZWF0ZS5hcHByb3ZhbFByb2dyYW06CiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkJhc2VXaXRoQmFyZUNyZWF0ZS5fX3B1eWFfYXJjNF9yb3V0ZXJfXygpIC0+IHVpbnQ2NDoKX19wdXlhX2FyYzRfcm91dGVyX186CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6MTMKICAgIC8vIGNsYXNzIEJhc2VXaXRoQmFyZUNyZWF0ZSBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJueiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDYKICAgIHR4biBPbkNvbXBsZXRpb24KICAgIGJueiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDYKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czoxNAogICAgLy8gQGJhcmVtZXRob2QoeyBvbkNyZWF0ZTogJ3JlcXVpcmUnIH0pCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgIQogICAgYXNzZXJ0IC8vIGlzIGNyZWF0aW5nCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6MTQtMTUKICAgIC8vIEBiYXJlbWV0aG9kKHsgb25DcmVhdGU6ICdyZXF1aXJlJyB9KQogICAgLy8gcHVibGljIGNyZWF0ZSgpIHt9CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDY6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6MTMKICAgIC8vIGNsYXNzIEJhc2VXaXRoQmFyZUNyZWF0ZSBleHRlbmRzIENvbnRyYWN0IHsKICAgIHB1c2hpbnQgMCAvLyAwCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkJhc2VXaXRoQmFyZUNyZWF0ZS5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "BaseWithBareCreate", + "methods": [], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/BaseWithBareCreate.ssa.ir b/tests/approvals/out/implicit-create/BaseWithBareCreate.ssa.ir new file mode 100644 index 00000000..6a4c8d57 --- /dev/null +++ b/tests/approvals/out/implicit-create/BaseWithBareCreate.ssa.ir @@ -0,0 +1,48 @@ +contract tests/approvals/implicit-create.algo.ts::BaseWithBareCreate: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.constructor() -> void: + block@0: // L13 + return + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.__puya_arc4_router__() -> bool: + block@0: // L13 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@2 + block@1: // abi_routing_L13 + goto block@6 + block@2: // bare_routing_L13 + let tmp%2#0: uint64 = (txn OnCompletion) + switch tmp%2#0 {0u => block@3, * => block@4} + block@3: // create_L14 + let tmp%3#0: uint64 = (txn ApplicationID) + let tmp%4#0: bool = (== tmp%3#0 0u) + (assert tmp%4#0) // is creating + tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.create() + return 1u + block@4: // switch_case_default_L13 + goto block@5 + block@5: // switch_case_next_L13 + goto block@6 + block@6: // after_if_else_L13 + return 0u + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.create() -> void: + block@0: // L14 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/ExplicitAbiCreateFromBase.arc32.json b/tests/approvals/out/implicit-create/ExplicitAbiCreateFromBase.arc32.json new file mode 100644 index 00000000..ee0b6e01 --- /dev/null +++ b/tests/approvals/out/implicit-create/ExplicitAbiCreateFromBase.arc32.json @@ -0,0 +1,48 @@ +{ + "hints": { + "create()void": { + "call_config": { + "no_op": "CREATE" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkV4cGxpY2l0QWJpQ3JlYXRlRnJvbUJhc2UuYXBwcm92YWxQcm9ncmFtOgogICAgY2FsbHN1YiBfX3B1eWFfYXJjNF9yb3V0ZXJfXwogICAgcmV0dXJuCgoKLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjpFeHBsaWNpdEFiaUNyZWF0ZUZyb21CYXNlLl9fcHV5YV9hcmM0X3JvdXRlcl9fKCkgLT4gdWludDY0OgpfX3B1eWFfYXJjNF9yb3V0ZXJfXzoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czoyMwogICAgLy8gZXhwb3J0IGNsYXNzIEV4cGxpY2l0QWJpQ3JlYXRlRnJvbUJhc2UgZXh0ZW5kcyBCYXNlV2l0aEFiaUNyZWF0ZSB7fQogICAgcHJvdG8gMCAxCiAgICB0eG4gTnVtQXBwQXJncwogICAgYnogX19wdXlhX2FyYzRfcm91dGVyX19fYWZ0ZXJfaWZfZWxzZUA2CiAgICBwdXNoYnl0ZXMgMHg0YzVjNjFiYSAvLyBtZXRob2QgImNyZWF0ZSgpdm9pZCIKICAgIHR4bmEgQXBwbGljYXRpb25BcmdzIDAKICAgIG1hdGNoIF9fcHV5YV9hcmM0X3JvdXRlcl9fX2NyZWF0ZV9yb3V0ZUAyCiAgICBwdXNoaW50IDAgLy8gMAogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19jcmVhdGVfcm91dGVAMjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czoxOAogICAgLy8gQGFiaW1ldGhvZCh7IG9uQ3JlYXRlOiAncmVxdWlyZScgfSkKICAgIHR4biBPbkNvbXBsZXRpb24KICAgICEKICAgIGFzc2VydCAvLyBPbkNvbXBsZXRpb24gaXMgTm9PcAogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgICEKICAgIGFzc2VydCAvLyBpcyBjcmVhdGluZwogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fYWZ0ZXJfaWZfZWxzZUA2OgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjIzCiAgICAvLyBleHBvcnQgY2xhc3MgRXhwbGljaXRBYmlDcmVhdGVGcm9tQmFzZSBleHRlbmRzIEJhc2VXaXRoQWJpQ3JlYXRlIHt9CiAgICBwdXNoaW50IDAgLy8gMAogICAgcmV0c3ViCg==", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkV4cGxpY2l0QWJpQ3JlYXRlRnJvbUJhc2UuY2xlYXJTdGF0ZVByb2dyYW06CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "ExplicitAbiCreateFromBase", + "methods": [ + { + "name": "create", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": {} +} \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/ExplicitAbiCreateFromBase.ssa.ir b/tests/approvals/out/implicit-create/ExplicitAbiCreateFromBase.ssa.ir new file mode 100644 index 00000000..80ed22ef --- /dev/null +++ b/tests/approvals/out/implicit-create/ExplicitAbiCreateFromBase.ssa.ir @@ -0,0 +1,56 @@ +contract tests/approvals/implicit-create.algo.ts::ExplicitAbiCreateFromBase: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/implicit-create.algo.ts::ExplicitAbiCreateFromBase.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/implicit-create.algo.ts::ExplicitAbiCreateFromBase.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/implicit-create.algo.ts::ExplicitAbiCreateFromBase.constructor() -> void: + block@0: // L23 + tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.constructor() + return + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.constructor() -> void: + block@0: // L17 + return + + subroutine tests/approvals/implicit-create.algo.ts::ExplicitAbiCreateFromBase.__puya_arc4_router__() -> bool: + block@0: // L23 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L23 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "create()void" => block@2, * => block@3} + block@2: // create_route_L18 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (== tmp%5#0 0u) + (assert tmp%6#0) // is creating + tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.create() + return 1u + block@3: // switch_case_default_L23 + goto block@4 + block@4: // switch_case_next_L23 + goto block@6 + block@5: // bare_routing_L23 + goto block@6 + block@6: // after_if_else_L23 + return 0u + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate.create() -> void: + block@0: // L18 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/ExplicitBareCreateFromBase.arc32.json b/tests/approvals/out/implicit-create/ExplicitBareCreateFromBase.arc32.json new file mode 100644 index 00000000..2b66fb5d --- /dev/null +++ b/tests/approvals/out/implicit-create/ExplicitBareCreateFromBase.arc32.json @@ -0,0 +1,35 @@ +{ + "hints": {}, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkV4cGxpY2l0QmFyZUNyZWF0ZUZyb21CYXNlLmFwcHJvdmFsUHJvZ3JhbToKICAgIGNhbGxzdWIgX19wdXlhX2FyYzRfcm91dGVyX18KICAgIHJldHVybgoKCi8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czo6RXhwbGljaXRCYXJlQ3JlYXRlRnJvbUJhc2UuX19wdXlhX2FyYzRfcm91dGVyX18oKSAtPiB1aW50NjQ6Cl9fcHV5YV9hcmM0X3JvdXRlcl9fOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjIxCiAgICAvLyBleHBvcnQgY2xhc3MgRXhwbGljaXRCYXJlQ3JlYXRlRnJvbUJhc2UgZXh0ZW5kcyBCYXNlV2l0aEJhcmVDcmVhdGUge30KICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJueiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDYKICAgIHR4biBPbkNvbXBsZXRpb24KICAgIGJueiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDYKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czoxNAogICAgLy8gQGJhcmVtZXRob2QoeyBvbkNyZWF0ZTogJ3JlcXVpcmUnIH0pCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgIQogICAgYXNzZXJ0IC8vIGlzIGNyZWF0aW5nCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6MTQtMTUKICAgIC8vIEBiYXJlbWV0aG9kKHsgb25DcmVhdGU6ICdyZXF1aXJlJyB9KQogICAgLy8gcHVibGljIGNyZWF0ZSgpIHt9CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDY6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6MjEKICAgIC8vIGV4cG9ydCBjbGFzcyBFeHBsaWNpdEJhcmVDcmVhdGVGcm9tQmFzZSBleHRlbmRzIEJhc2VXaXRoQmFyZUNyZWF0ZSB7fQogICAgcHVzaGludCAwIC8vIDAKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OkV4cGxpY2l0QmFyZUNyZWF0ZUZyb21CYXNlLmNsZWFyU3RhdGVQcm9ncmFtOgogICAgcHVzaGludCAxIC8vIDEKICAgIHJldHVybgo=" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "ExplicitBareCreateFromBase", + "methods": [], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/ExplicitBareCreateFromBase.ssa.ir b/tests/approvals/out/implicit-create/ExplicitBareCreateFromBase.ssa.ir new file mode 100644 index 00000000..2fdb82be --- /dev/null +++ b/tests/approvals/out/implicit-create/ExplicitBareCreateFromBase.ssa.ir @@ -0,0 +1,53 @@ +contract tests/approvals/implicit-create.algo.ts::ExplicitBareCreateFromBase: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/implicit-create.algo.ts::ExplicitBareCreateFromBase.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/implicit-create.algo.ts::ExplicitBareCreateFromBase.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/implicit-create.algo.ts::ExplicitBareCreateFromBase.constructor() -> void: + block@0: // L21 + tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.constructor() + return + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.constructor() -> void: + block@0: // L13 + return + + subroutine tests/approvals/implicit-create.algo.ts::ExplicitBareCreateFromBase.__puya_arc4_router__() -> bool: + block@0: // L21 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@2 + block@1: // abi_routing_L21 + goto block@6 + block@2: // bare_routing_L21 + let tmp%2#0: uint64 = (txn OnCompletion) + switch tmp%2#0 {0u => block@3, * => block@4} + block@3: // create_L14 + let tmp%3#0: uint64 = (txn ApplicationID) + let tmp%4#0: bool = (== tmp%3#0 0u) + (assert tmp%4#0) // is creating + tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.create() + return 1u + block@4: // switch_case_default_L21 + goto block@5 + block@5: // switch_case_next_L21 + goto block@6 + block@6: // after_if_else_L21 + return 0u + + subroutine tests/approvals/implicit-create.algo.ts::BaseWithBareCreate.create() -> void: + block@0: // L14 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/NoBare.arc32.json b/tests/approvals/out/implicit-create/NoBare.arc32.json new file mode 100644 index 00000000..3f6185b5 --- /dev/null +++ b/tests/approvals/out/implicit-create/NoBare.arc32.json @@ -0,0 +1,50 @@ +{ + "hints": { + "handleNoop()void": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6Ok5vQmFyZS5hcHByb3ZhbFByb2dyYW06CiAgICBpbnRjYmxvY2sgMCAxCiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6Ok5vQmFyZS5fX3B1eWFfYXJjNF9yb3V0ZXJfXygpIC0+IHVpbnQ2NDoKX19wdXlhX2FyYzRfcm91dGVyX186CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6NAogICAgLy8gZXhwb3J0IGNsYXNzIE5vQmFyZSBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJ6IF9fcHV5YV9hcmM0X3JvdXRlcl9fX2JhcmVfcm91dGluZ0A1CiAgICBwdXNoYnl0ZXMgMHhiOGI1ZTRiOSAvLyBtZXRob2QgImhhbmRsZU5vb3AoKXZvaWQiCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAwCiAgICBtYXRjaCBfX3B1eWFfYXJjNF9yb3V0ZXJfX19oYW5kbGVOb29wX3JvdXRlQDIKICAgIGludGNfMCAvLyAwCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2hhbmRsZU5vb3Bfcm91dGVAMjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbXBsaWNpdC1jcmVhdGUuYWxnby50czo1CiAgICAvLyBAYWJpbWV0aG9kKHsgYWxsb3dBY3Rpb25zOiAnTm9PcCcgfSkKICAgIHR4biBPbkNvbXBsZXRpb24KICAgICEKICAgIGFzc2VydCAvLyBPbkNvbXBsZXRpb24gaXMgTm9PcAogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGFzc2VydCAvLyBpcyBub3QgY3JlYXRpbmcKICAgIGludGNfMSAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2JhcmVfcm91dGluZ0A1OgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjQKICAgIC8vIGV4cG9ydCBjbGFzcyBOb0JhcmUgZXh0ZW5kcyBDb250cmFjdCB7CiAgICB0eG4gT25Db21wbGV0aW9uCiAgICBibnogX19wdXlhX2FyYzRfcm91dGVyX19fYWZ0ZXJfaWZfZWxzZUA5CiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgIQogICAgYXNzZXJ0IC8vIGlzIGNyZWF0aW5nCiAgICBpbnRjXzEgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDk6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6NAogICAgLy8gZXhwb3J0IGNsYXNzIE5vQmFyZSBleHRlbmRzIENvbnRyYWN0IHsKICAgIGludGNfMCAvLyAwCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6Ok5vQmFyZS5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NoBare", + "methods": [ + { + "name": "handleNoop", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/NoBare.ssa.ir b/tests/approvals/out/implicit-create/NoBare.ssa.ir new file mode 100644 index 00000000..46017190 --- /dev/null +++ b/tests/approvals/out/implicit-create/NoBare.ssa.ir @@ -0,0 +1,66 @@ +contract tests/approvals/implicit-create.algo.ts::NoBare: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/implicit-create.algo.ts::NoBare.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/implicit-create.algo.ts::NoBare.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/implicit-create.algo.ts::NoBare.constructor() -> void: + block@0: // L4 + return + + subroutine tests/approvals/implicit-create.algo.ts::NoBare.__puya_arc4_router__() -> bool: + block@0: // L4 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L4 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "handleNoop()void" => block@2, * => block@3} + block@2: // handleNoop_route_L5 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // is not creating + tests/approvals/implicit-create.algo.ts::NoBare.handleNoop() + return 1u + block@3: // switch_case_default_L4 + goto block@4 + block@4: // switch_case_next_L4 + goto block@9 + block@5: // bare_routing_L4 + let tmp%7#0: uint64 = (txn OnCompletion) + switch tmp%7#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L4 + let tmp%8#0: uint64 = (txn ApplicationID) + let tmp%9#0: bool = (== tmp%8#0 0u) + (assert tmp%9#0) // is creating + tests/approvals/implicit-create.algo.ts::NoBare.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L4 + goto block@8 + block@8: // switch_case_next_L4 + goto block@9 + block@9: // after_if_else_L4 + return 0u + + subroutine tests/approvals/implicit-create.algo.ts::NoBare.handleNoop() -> void: + block@0: // L5 + return + + subroutine tests/approvals/implicit-create.algo.ts::NoBare.__algots__.defaultCreate() -> void: + block@0: // L4 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/NoNoOp.arc32.json b/tests/approvals/out/implicit-create/NoNoOp.arc32.json new file mode 100644 index 00000000..c7ceccc0 --- /dev/null +++ b/tests/approvals/out/implicit-create/NoNoOp.arc32.json @@ -0,0 +1,36 @@ +{ + "hints": {}, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6Ok5vTm9PcC5hcHByb3ZhbFByb2dyYW06CiAgICBpbnRjYmxvY2sgMCAxCiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6Ok5vTm9PcC5fX3B1eWFfYXJjNF9yb3V0ZXJfXygpIC0+IHVpbnQ2NDoKX19wdXlhX2FyYzRfcm91dGVyX186CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OAogICAgLy8gZXhwb3J0IGNsYXNzIE5vTm9PcCBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJueiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDcKICAgIHB1c2hpbnQgNCAvLyA0CiAgICBpbnRjXzAgLy8gMAogICAgdHhuIE9uQ29tcGxldGlvbgogICAgbWF0Y2ggX19wdXlhX2FyYzRfcm91dGVyX19faGFuZGxlVXBkYXRlQDMgX19wdXlhX2FyYzRfcm91dGVyX19fX19hbGdvdHNfXy5kZWZhdWx0Q3JlYXRlQDQKICAgIGludGNfMCAvLyAwCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2hhbmRsZVVwZGF0ZUAzOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjkKICAgIC8vIEBiYXJlbWV0aG9kKHsgYWxsb3dBY3Rpb25zOiAnVXBkYXRlQXBwbGljYXRpb24nIH0pCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYXNzZXJ0IC8vIGlzIG5vdCBjcmVhdGluZwogICAgLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjktMTAKICAgIC8vIEBiYXJlbWV0aG9kKHsgYWxsb3dBY3Rpb25zOiAnVXBkYXRlQXBwbGljYXRpb24nIH0pCiAgICAvLyBwdWJsaWMgaGFuZGxlVXBkYXRlKCkge30KICAgIGludGNfMSAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX19fYWxnb3RzX18uZGVmYXVsdENyZWF0ZUA0OgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2ltcGxpY2l0LWNyZWF0ZS5hbGdvLnRzOjgKICAgIC8vIGV4cG9ydCBjbGFzcyBOb05vT3AgZXh0ZW5kcyBDb250cmFjdCB7CiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgIQogICAgYXNzZXJ0IC8vIGlzIGNyZWF0aW5nCiAgICBpbnRjXzEgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDc6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6OAogICAgLy8gZXhwb3J0IGNsYXNzIE5vTm9PcCBleHRlbmRzIENvbnRyYWN0IHsKICAgIGludGNfMCAvLyAwCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW1wbGljaXQtY3JlYXRlLmFsZ28udHM6Ok5vTm9PcC5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NoNoOp", + "methods": [], + "networks": {} + }, + "bare_call_config": { + "update_application": "CALL", + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/NoNoOp.ssa.ir b/tests/approvals/out/implicit-create/NoNoOp.ssa.ir new file mode 100644 index 00000000..7d29ff9c --- /dev/null +++ b/tests/approvals/out/implicit-create/NoNoOp.ssa.ir @@ -0,0 +1,58 @@ +contract tests/approvals/implicit-create.algo.ts::NoNoOp: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/implicit-create.algo.ts::NoNoOp.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/implicit-create.algo.ts::NoNoOp.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/implicit-create.algo.ts::NoNoOp.constructor() -> void: + block@0: // L8 + return + + subroutine tests/approvals/implicit-create.algo.ts::NoNoOp.__puya_arc4_router__() -> bool: + block@0: // L8 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@2 + block@1: // abi_routing_L8 + goto block@7 + block@2: // bare_routing_L8 + let tmp%2#0: uint64 = (txn OnCompletion) + switch tmp%2#0 {4u => block@3, 0u => block@4, * => block@5} + block@3: // handleUpdate_L9 + let tmp%3#0: uint64 = (txn ApplicationID) + let tmp%4#0: bool = (!= tmp%3#0 0u) + (assert tmp%4#0) // is not creating + tests/approvals/implicit-create.algo.ts::NoNoOp.handleUpdate() + return 1u + block@4: // __algots__.defaultCreate_L8 + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (== tmp%5#0 0u) + (assert tmp%6#0) // is creating + tests/approvals/implicit-create.algo.ts::NoNoOp.__algots__.defaultCreate() + return 1u + block@5: // switch_case_default_L8 + goto block@6 + block@6: // switch_case_next_L8 + goto block@7 + block@7: // after_if_else_L8 + return 0u + + subroutine tests/approvals/implicit-create.algo.ts::NoNoOp.handleUpdate() -> void: + block@0: // L9 + return + + subroutine tests/approvals/implicit-create.algo.ts::NoNoOp.__algots__.defaultCreate() -> void: + block@0: // L8 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/implicit-create.awst b/tests/approvals/out/implicit-create/implicit-create.awst new file mode 100644 index 00000000..3df60dc5 --- /dev/null +++ b/tests/approvals/out/implicit-create/implicit-create.awst @@ -0,0 +1,222 @@ +contract NoBare +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + handleNoop(): void + { + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + + __algots__.defaultCreate(): void + { + } + +} +contract NoNoOp +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + handleUpdate(): void + { + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + + __algots__.defaultCreate(): void + { + } + +} +contract BaseWithBareCreate +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + create(): void + { + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + +} +contract BaseWithAbiCreate +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + create(): void + { + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + +} +contract ExplicitBareCreateFromBase +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + super.constructor() + } + + BaseWithBareCreate::create(): void + { + } + + BaseWithBareCreate::constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + +} +contract ExplicitAbiCreateFromBase +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + super.constructor() + } + + BaseWithAbiCreate::create(): void + { + } + + BaseWithAbiCreate::constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + +} \ No newline at end of file diff --git a/tests/approvals/out/implicit-create/implicit-create.awst.json b/tests/approvals/out/implicit-create/implicit-create.awst.json new file mode 100644 index 00000000..8832f912 --- /dev/null +++ b/tests/approvals/out/implicit-create/implicit-create.awst.json @@ -0,0 +1,3564 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "id": "tests/approvals/implicit-create.algo.ts::NoBare", + "name": "NoBare", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 5, + "end_line": 6, + "column": 2, + "end_column": 21 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 6, + "end_line": 6, + "column": 22, + "end_column": 24 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::NoBare", + "member_name": "handleNoop", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 5, + "end_line": 5, + "column": 3, + "end_column": 38 + }, + "name": "handleNoop", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::NoBare", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::NoBare", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 38 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "id": "tests/approvals/implicit-create.algo.ts::NoNoOp", + "name": "NoNoOp", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 9, + "end_line": 10, + "column": 2, + "end_column": 23 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 10, + "end_line": 10, + "column": 24, + "end_column": 26 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::NoNoOp", + "member_name": "handleUpdate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 9, + "end_line": 9, + "column": 3, + "end_column": 52 + }, + "allowed_completion_types": [ + 4 + ], + "create": 3, + "is_bare": true + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::NoNoOp", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::NoNoOp", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 8, + "end_line": 8, + "column": 0, + "end_column": 38 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "id": "tests/approvals/implicit-create.algo.ts::BaseWithBareCreate", + "name": "BaseWithBareCreate", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 14, + "end_line": 15, + "column": 2, + "end_column": 17 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 15, + "end_line": 15, + "column": 18, + "end_column": 20 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithBareCreate", + "member_name": "create", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 14, + "end_line": 14, + "column": 3, + "end_column": 38 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithBareCreate", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "id": "tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate", + "name": "BaseWithAbiCreate", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 18, + "end_line": 19, + "column": 2, + "end_column": 17 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 19, + "end_line": 19, + "column": 18, + "end_column": 20 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate", + "member_name": "create", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 18, + "end_line": 18, + "column": 3, + "end_column": 37 + }, + "name": "create", + "is_bare": false, + "create": 2, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 69 + }, + "id": "tests/approvals/implicit-create.algo.ts::ExplicitBareCreateFromBase", + "name": "ExplicitBareCreateFromBase", + "description": null, + "method_resolution_order": [ + "tests/approvals/implicit-create.algo.ts::BaseWithBareCreate", + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 69 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 69 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 69 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 69 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::ExplicitBareCreateFromBase", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 14, + "end_line": 15, + "column": 2, + "end_column": 17 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 15, + "end_line": 15, + "column": 18, + "end_column": 20 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithBareCreate", + "member_name": "create", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 14, + "end_line": 14, + "column": 3, + "end_column": 38 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithBareCreate", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 23, + "end_line": 23, + "column": 0, + "end_column": 67 + }, + "id": "tests/approvals/implicit-create.algo.ts::ExplicitAbiCreateFromBase", + "name": "ExplicitAbiCreateFromBase", + "description": null, + "method_resolution_order": [ + "tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate", + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 23, + "end_line": 23, + "column": 0, + "end_column": 67 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 23, + "end_line": 23, + "column": 0, + "end_column": 67 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 23, + "end_line": 23, + "column": 0, + "end_column": 67 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 23, + "end_line": 23, + "column": 0, + "end_column": 67 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::ExplicitAbiCreateFromBase", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 18, + "end_line": 19, + "column": 2, + "end_column": 17 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 19, + "end_line": 19, + "column": 18, + "end_column": 20 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate", + "member_name": "create", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 18, + "end_line": 18, + "column": 3, + "end_column": 37 + }, + "name": "create", + "is_bare": false, + "create": 2, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/implicit-create.algo.ts", + "line": 17, + "end_line": 17, + "column": 0, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/implicit-create.algo.ts::BaseWithAbiCreate", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/inheritance-a.awst b/tests/approvals/out/inheritance-a.awst deleted file mode 100644 index ba40c727..00000000 --- a/tests/approvals/out/inheritance-a.awst +++ /dev/null @@ -1,37 +0,0 @@ -contract SimpleContract extends @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - globals { - ["someState"]: uint64 - } - constructor(): void - { - void - } - - simpleMethod(): uint64 - { - return a * b - } - -} -contract Arc4Contract extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - globals { - ["someState"]: uint64 - } - constructor(): void - { - void - } - - simpleMethod(): uint64 - { - return a * b - } - - simpleAbiMethod(): uint64 - { - return a + b - } - -} \ No newline at end of file diff --git a/tests/approvals/out/inheritance-a.awst.json b/tests/approvals/out/inheritance-a.awst.json deleted file mode 100644 index 48b9189a..00000000 --- a/tests/approvals/out/inheritance-a.awst.json +++ /dev/null @@ -1,731 +0,0 @@ -[ - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 4, - "end_line": 9, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/inheritance-a.algo.ts::SimpleContract", - "name": "SimpleContract", - "bases": [ - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 4, - "end_line": 9, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 4, - "end_line": 9, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 4, - "end_line": 9, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 4, - "end_line": 9, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-a.algo.ts::SimpleContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": null, - "clear_program": null, - "subroutines": [ - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 6, - "end_line": 8, - "column": 2, - "end_column": 3 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "a", - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 6, - "end_line": 6, - "column": 22, - "end_column": 31 - } - }, - { - "_type": "SubroutineArgument", - "name": "b", - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 6, - "end_line": 6, - "column": 33, - "end_column": 42 - } - } - ], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 6, - "end_line": 8, - "column": 52, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 7, - "end_line": 7, - "column": 4, - "end_column": 16 - }, - "value": { - "_type": "UInt64BinaryOperation", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 7, - "end_line": 7, - "column": 11, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "left": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 7, - "end_line": 7, - "column": 11, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - "op": "*", - "right": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 7, - "end_line": 7, - "column": 15, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-a.algo.ts::SimpleContract", - "member_name": "simpleMethod", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - } - ], - "app_state": { - "someState": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 11 - }, - "member_name": "someState", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "b8l^BQ*>c;Wd", - "encoding": "utf8" - }, - "description": null - } - }, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - }, - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 11, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/inheritance-a.algo.ts::Arc4Contract", - "name": "Arc4Contract", - "bases": [ - "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 11, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 11, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 11, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 11, - "end_line": 20, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-a.algo.ts::Arc4Contract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": null, - "clear_program": null, - "subroutines": [ - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 13, - "end_line": 15, - "column": 2, - "end_column": 3 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "a", - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 13, - "end_line": 13, - "column": 23, - "end_column": 32 - } - }, - { - "_type": "SubroutineArgument", - "name": "b", - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 13, - "end_line": 13, - "column": 34, - "end_column": 43 - } - } - ], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 13, - "end_line": 15, - "column": 53, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 14, - "end_line": 14, - "column": 4, - "end_column": 16 - }, - "value": { - "_type": "UInt64BinaryOperation", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 14, - "end_line": 14, - "column": 11, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "left": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 14, - "end_line": 14, - "column": 11, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - "op": "*", - "right": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 14, - "end_line": 14, - "column": 15, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-a.algo.ts::Arc4Contract", - "member_name": "simpleMethod", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 17, - "end_line": 19, - "column": 2, - "end_column": 3 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "a", - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 17, - "end_line": 17, - "column": 25, - "end_column": 34 - } - }, - { - "_type": "SubroutineArgument", - "name": "b", - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 17, - "end_line": 17, - "column": 36, - "end_column": 45 - } - } - ], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 17, - "end_line": 19, - "column": 55, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 18, - "end_line": 18, - "column": 4, - "end_column": 16 - }, - "value": { - "_type": "UInt64BinaryOperation", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 18, - "end_line": 18, - "column": 11, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "left": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 18, - "end_line": 18, - "column": 11, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - "op": "+", - "right": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 18, - "end_line": 18, - "column": 15, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-a.algo.ts::Arc4Contract", - "member_name": "simpleAbiMethod", - "arc4_method_config": { - "_type": "ARC4ABIMethodConfig", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 17, - "end_line": 19, - "column": 2, - "end_column": 3 - }, - "name": "simpleAbiMethod", - "is_bare": false, - "create": 3, - "readonly": false, - "allowed_completion_types": [ - 0 - ], - "default_args": {}, - "structs": {} - }, - "synthetic": false, - "inheritable": true - } - ], - "app_state": { - "someState": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 12, - "end_line": 12, - "column": 2, - "end_column": 11 - }, - "member_name": "someState", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 12, - "end_line": 12, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "b8l^BQ*>c;Wd", - "encoding": "utf8" - }, - "description": null - } - }, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - } -] \ No newline at end of file diff --git a/tests/approvals/out/inheritance-a/inheritance-a.awst b/tests/approvals/out/inheritance-a/inheritance-a.awst new file mode 100644 index 00000000..e69de29b diff --git a/tests/approvals/out/inheritance-a/inheritance-a.awst.json b/tests/approvals/out/inheritance-a/inheritance-a.awst.json new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/tests/approvals/out/inheritance-a/inheritance-a.awst.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/approvals/out/inheritance-b.awst b/tests/approvals/out/inheritance-b.awst deleted file mode 100644 index 7870fada..00000000 --- a/tests/approvals/out/inheritance-b.awst +++ /dev/null @@ -1,26 +0,0 @@ -contract ConcreteSimpleContract extends tests/approvals/inheritance-a.algo.ts::SimpleContract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - globals { - ["someState"]: uint64 - } - constructor(): void - { - super.constructor() - } - - approvalProgram(): uint64 - { - a: uint64 = btoi(txnas(0)) - b: uint64 = btoi(txnas(1)) - return this.simpleMethod(a, b) - } - -} -contract ConcreteArc4Contract extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - void - } - -} \ No newline at end of file diff --git a/tests/approvals/out/inheritance-b.awst.json b/tests/approvals/out/inheritance-b.awst.json deleted file mode 100644 index 969d22eb..00000000 --- a/tests/approvals/out/inheritance-b.awst.json +++ /dev/null @@ -1,549 +0,0 @@ -[ - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 5, - "end_line": 11, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract", - "name": "ConcreteSimpleContract", - "bases": [ - "tests/approvals/inheritance-a.algo.ts::SimpleContract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 5, - "end_line": 11, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 5, - "end_line": 11, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 5, - "end_line": 11, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 5, - "end_line": 11, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "InstanceSuperMethodTarget", - "member_name": "constructor" - }, - "args": [] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 6, - "end_line": 10, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 6, - "end_line": 10, - "column": 35, - "end_column": 3 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 7, - "end_line": 7, - "column": 10, - "end_column": 45 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 7, - "end_line": 7, - "column": 10, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - "value": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 7, - "end_line": 7, - "column": 14, - "end_column": 45 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "op_code": "btoi", - "immediates": [], - "stack_args": [ - { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 7, - "end_line": 7, - "column": 22, - "end_column": 44 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "op_code": "txnas", - "immediates": [ - "ApplicationArgs" - ], - "stack_args": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 7, - "end_line": 7, - "column": 42, - "end_column": 43 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "0", - "teal_alias": null - } - ], - "comment": null - } - ], - "comment": null - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 8, - "end_line": 8, - "column": 10, - "end_column": 45 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 8, - "end_line": 8, - "column": 10, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - }, - "value": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 8, - "end_line": 8, - "column": 14, - "end_column": 45 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "op_code": "btoi", - "immediates": [], - "stack_args": [ - { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 8, - "end_line": 8, - "column": 22, - "end_column": 44 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "op_code": "txnas", - "immediates": [ - "ApplicationArgs" - ], - "stack_args": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 8, - "end_line": 8, - "column": 42, - "end_column": 43 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - } - ], - "comment": null - } - ], - "comment": null - } - }, - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 9, - "end_line": 9, - "column": 4, - "end_column": 34 - }, - "value": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 9, - "end_line": 9, - "column": 11, - "end_column": 34 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "simpleMethod" - }, - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 9, - "end_line": 9, - "column": 29, - "end_column": 30 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - } - }, - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 9, - "end_line": 9, - "column": 32, - "end_column": 33 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - } - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - "clear_program": null, - "subroutines": [], - "app_state": { - "someState": { - "_type": "AppStorageDefinition", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 11 - }, - "member_name": "someState", - "kind": 1, - "storage_wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key_wtype": null, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/inheritance-a.algo.ts", - "line": 5, - "end_line": 5, - "column": 2, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "b8l^BQ*>c;Wd", - "encoding": "utf8" - }, - "description": null - } - }, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - }, - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 13, - "end_line": 13, - "column": 0, - "end_column": 53 - }, - "id": "tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract", - "name": "ConcreteArc4Contract", - "bases": [ - "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 13, - "end_line": 13, - "column": 0, - "end_column": 53 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 13, - "end_line": 13, - "column": 0, - "end_column": 53 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 13, - "end_line": 13, - "column": 0, - "end_column": 53 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/inheritance-b.algo.ts", - "line": 13, - "end_line": 13, - "column": 0, - "end_column": 53 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": null, - "clear_program": null, - "subroutines": [], - "app_state": {}, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - } -] \ No newline at end of file diff --git a/tests/approvals/out/inheritance-b/ConcreteArc4Contract.arc32.json b/tests/approvals/out/inheritance-b/ConcreteArc4Contract.arc32.json new file mode 100644 index 00000000..29fd4535 --- /dev/null +++ b/tests/approvals/out/inheritance-b/ConcreteArc4Contract.arc32.json @@ -0,0 +1,64 @@ +{ + "hints": { + "simpleAbiMethod(uint64,uint64)uint64": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYi5hbGdvLnRzOjpDb25jcmV0ZUFyYzRDb250cmFjdC5hcHByb3ZhbFByb2dyYW06CiAgICBpbnRjYmxvY2sgMCAxCiAgICBjYWxsc3ViIF9fcHV5YV9hcmM0X3JvdXRlcl9fCiAgICByZXR1cm4KCgovLyB0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYi5hbGdvLnRzOjpDb25jcmV0ZUFyYzRDb250cmFjdC5fX3B1eWFfYXJjNF9yb3V0ZXJfXygpIC0+IHVpbnQ2NDoKX19wdXlhX2FyYzRfcm91dGVyX186CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYi5hbGdvLnRzOjEzCiAgICAvLyBleHBvcnQgY2xhc3MgQ29uY3JldGVBcmM0Q29udHJhY3QgZXh0ZW5kcyBBcmM0Q29udHJhY3Qge30KICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJ6IF9fcHV5YV9hcmM0X3JvdXRlcl9fX2JhcmVfcm91dGluZ0A1CiAgICBwdXNoYnl0ZXMgMHhmMTYxZGMzNyAvLyBtZXRob2QgInNpbXBsZUFiaU1ldGhvZCh1aW50NjQsdWludDY0KXVpbnQ2NCIKICAgIHR4bmEgQXBwbGljYXRpb25BcmdzIDAKICAgIG1hdGNoIF9fcHV5YV9hcmM0X3JvdXRlcl9fX3NpbXBsZUFiaU1ldGhvZF9yb3V0ZUAyCiAgICBpbnRjXzAgLy8gMAogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19zaW1wbGVBYmlNZXRob2Rfcm91dGVAMjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbmhlcml0YW5jZS1hLmFsZ28udHM6MTcKICAgIC8vIHB1YmxpYyBzaW1wbGVBYmlNZXRob2QoYTogdWludDY0LCBiOiB1aW50NjQpOiB1aW50NjQgewogICAgdHhuIE9uQ29tcGxldGlvbgogICAgIQogICAgYXNzZXJ0IC8vIE9uQ29tcGxldGlvbiBpcyBOb09wCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYXNzZXJ0IC8vIGlzIG5vdCBjcmVhdGluZwogICAgLy8gdGVzdHMvYXBwcm92YWxzL2luaGVyaXRhbmNlLWIuYWxnby50czoxMwogICAgLy8gZXhwb3J0IGNsYXNzIENvbmNyZXRlQXJjNENvbnRyYWN0IGV4dGVuZHMgQXJjNENvbnRyYWN0IHt9CiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAxCiAgICBidG9pCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAyCiAgICBidG9pCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYS5hbGdvLnRzOjE3CiAgICAvLyBwdWJsaWMgc2ltcGxlQWJpTWV0aG9kKGE6IHVpbnQ2NCwgYjogdWludDY0KTogdWludDY0IHsKICAgIGNhbGxzdWIgc2ltcGxlQWJpTWV0aG9kCiAgICBpdG9iCiAgICBwdXNoYnl0ZXMgMHgxNTFmN2M3NQogICAgc3dhcAogICAgY29uY2F0CiAgICBsb2cKICAgIGludGNfMSAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2JhcmVfcm91dGluZ0A1OgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2luaGVyaXRhbmNlLWIuYWxnby50czoxMwogICAgLy8gZXhwb3J0IGNsYXNzIENvbmNyZXRlQXJjNENvbnRyYWN0IGV4dGVuZHMgQXJjNENvbnRyYWN0IHt9CiAgICB0eG4gT25Db21wbGV0aW9uCiAgICBibnogX19wdXlhX2FyYzRfcm91dGVyX19fYWZ0ZXJfaWZfZWxzZUA5CiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgIQogICAgYXNzZXJ0IC8vIGlzIGNyZWF0aW5nCiAgICBpbnRjXzEgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDk6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYi5hbGdvLnRzOjEzCiAgICAvLyBleHBvcnQgY2xhc3MgQ29uY3JldGVBcmM0Q29udHJhY3QgZXh0ZW5kcyBBcmM0Q29udHJhY3Qge30KICAgIGludGNfMCAvLyAwCiAgICByZXRzdWIKCgovLyB0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYS5hbGdvLnRzOjpBcmM0Q29udHJhY3Quc2ltcGxlQWJpTWV0aG9kKGE6IHVpbnQ2NCwgYjogdWludDY0KSAtPiB1aW50NjQ6CnNpbXBsZUFiaU1ldGhvZDoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9pbmhlcml0YW5jZS1hLmFsZ28udHM6MTcKICAgIC8vIHB1YmxpYyBzaW1wbGVBYmlNZXRob2QoYTogdWludDY0LCBiOiB1aW50NjQpOiB1aW50NjQgewogICAgcHJvdG8gMiAxCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYS5hbGdvLnRzOjE4CiAgICAvLyByZXR1cm4gYSArIGIKICAgIGZyYW1lX2RpZyAtMgogICAgZnJhbWVfZGlnIC0xCiAgICArCiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvaW5oZXJpdGFuY2UtYi5hbGdvLnRzOjpDb25jcmV0ZUFyYzRDb250cmFjdC5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 1 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "someState": { + "type": "uint64", + "key": "someState" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "ConcreteArc4Contract", + "methods": [ + { + "name": "simpleAbiMethod", + "args": [ + { + "type": "uint64", + "name": "a" + }, + { + "type": "uint64", + "name": "b" + } + ], + "readonly": false, + "returns": { + "type": "uint64" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/inheritance-b/ConcreteArc4Contract.ssa.ir b/tests/approvals/out/inheritance-b/ConcreteArc4Contract.ssa.ir new file mode 100644 index 00000000..f457c5d9 --- /dev/null +++ b/tests/approvals/out/inheritance-b/ConcreteArc4Contract.ssa.ir @@ -0,0 +1,79 @@ +contract tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract.constructor() -> void: + block@0: // L13 + tests/approvals/inheritance-a.algo.ts::Arc4Contract.constructor() + return + + subroutine tests/approvals/inheritance-a.algo.ts::Arc4Contract.constructor() -> void: + block@0: // L11 + return + + subroutine tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract.__puya_arc4_router__() -> bool: + block@0: // L13 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@5 + block@1: // abi_routing_L13 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "simpleAbiMethod(uint64,uint64)uint64" => block@2, * => block@3} + block@2: // simpleAbiMethod_route_L17 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // is not creating + let tmp%7#0: bytes = (txna ApplicationArgs 1) + let tmp%8#0: uint64 = (btoi tmp%7#0) + let tmp%9#0: bytes = (txna ApplicationArgs 2) + let tmp%10#0: uint64 = (btoi tmp%9#0) + let to_encode%0#0: uint64 = tests/approvals/inheritance-a.algo.ts::Arc4Contract.simpleAbiMethod(tmp%8#0, tmp%10#0) + let val_as_bytes%0#0: bytes = (itob to_encode%0#0) + let tmp%11#0: bytes = (concat 0x151f7c75 val_as_bytes%0#0) + (log tmp%11#0) + return 1u + block@3: // switch_case_default_L13 + goto block@4 + block@4: // switch_case_next_L13 + goto block@9 + block@5: // bare_routing_L13 + let tmp%12#0: uint64 = (txn OnCompletion) + switch tmp%12#0 {0u => block@6, * => block@7} + block@6: // __algots__.defaultCreate_L13 + let tmp%13#0: uint64 = (txn ApplicationID) + let tmp%14#0: bool = (== tmp%13#0 0u) + (assert tmp%14#0) // is creating + tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract.__algots__.defaultCreate() + return 1u + block@7: // switch_case_default_L13 + goto block@8 + block@8: // switch_case_next_L13 + goto block@9 + block@9: // after_if_else_L13 + return 0u + + subroutine tests/approvals/inheritance-a.algo.ts::Arc4Contract.simpleAbiMethod(a: uint64, b: uint64) -> uint64: + block@0: // L17 + let tmp%0#0: uint64 = (+ a#0 b#0) + return tmp%0#0 + + subroutine tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract.__algots__.defaultCreate() -> void: + block@0: // L13 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/inheritance-b/ConcreteSimpleContract.ssa.ir b/tests/approvals/out/inheritance-b/ConcreteSimpleContract.ssa.ir new file mode 100644 index 00000000..43c20475 --- /dev/null +++ b/tests/approvals/out/inheritance-b/ConcreteSimpleContract.ssa.ir @@ -0,0 +1,35 @@ +contract tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract: + program approval: + subroutine tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract.approvalProgram() -> uint64: + block@0: // L6 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bytes = ((txnas ApplicationArgs) 0u) + let a#0: uint64 = (btoi tmp%0#0) + let tmp%1#0: bytes = ((txnas ApplicationArgs) 1u) + let b#0: uint64 = (btoi tmp%1#0) + let tmp%2#0: uint64 = tests/approvals/inheritance-a.algo.ts::SimpleContract.simpleMethod(a#0, b#0) + return tmp%2#0 + + subroutine tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract.constructor() -> void: + block@0: // L5 + tests/approvals/inheritance-a.algo.ts::SimpleContract.constructor() + return + + subroutine tests/approvals/inheritance-a.algo.ts::SimpleContract.constructor() -> void: + block@0: // L4 + return + + subroutine tests/approvals/inheritance-a.algo.ts::SimpleContract.simpleMethod(a: uint64, b: uint64) -> uint64: + block@0: // L6 + let tmp%0#0: uint64 = (* a#0 b#0) + return tmp%0#0 + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/inheritance-b/inheritance-b.awst b/tests/approvals/out/inheritance-b/inheritance-b.awst new file mode 100644 index 00000000..dafe6206 --- /dev/null +++ b/tests/approvals/out/inheritance-b/inheritance-b.awst @@ -0,0 +1,93 @@ +contract ConcreteSimpleContract +{ + globals { + ["someState"]: uint64 + } + approvalProgram(): uint64 + { + if (!Boolean(txn())) { + this.constructor() + } + a: uint64 = btoi(txnas(0)) + b: uint64 = btoi(txnas(1)) + return this.simpleMethod(a, b) + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + super.constructor() + } + + SimpleContract::simpleMethod(): uint64 + { + return a * b + } + + SimpleContract::constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + +} +contract ConcreteArc4Contract +{ + globals { + ["someState"]: uint64 + } + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + super.constructor() + } + + Arc4Contract::simpleMethod(): uint64 + { + return a * b + } + + Arc4Contract::simpleAbiMethod(): uint64 + { + return a + b + } + + Arc4Contract::constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + + __algots__.defaultCreate(): void + { + } + +} \ No newline at end of file diff --git a/tests/approvals/out/inheritance-b/inheritance-b.awst.json b/tests/approvals/out/inheritance-b/inheritance-b.awst.json new file mode 100644 index 00000000..2502b588 --- /dev/null +++ b/tests/approvals/out/inheritance-b/inheritance-b.awst.json @@ -0,0 +1,1909 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 5, + "end_line": 5, + "column": 0, + "end_column": 60 + }, + "id": "tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract", + "name": "ConcreteSimpleContract", + "description": null, + "method_resolution_order": [ + "tests/approvals/inheritance-a.algo.ts::SimpleContract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 34 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 6, + "end_line": 10, + "column": 35, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 7, + "end_line": 7, + "column": 10, + "end_column": 45 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 7, + "end_line": 7, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 7, + "end_line": 7, + "column": 14, + "end_column": 45 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "btoi", + "immediates": [], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 7, + "end_line": 7, + "column": 22, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txnas", + "immediates": [ + "ApplicationArgs" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 7, + "end_line": 7, + "column": 42, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ], + "comment": null + } + ], + "comment": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 8, + "end_line": 8, + "column": 10, + "end_column": 45 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 8, + "end_line": 8, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + }, + "value": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 8, + "end_line": 8, + "column": 14, + "end_column": 45 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "btoi", + "immediates": [], + "stack_args": [ + { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 8, + "end_line": 8, + "column": 22, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txnas", + "immediates": [ + "ApplicationArgs" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 8, + "end_line": 8, + "column": 42, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + ], + "comment": null + } + ], + "comment": null + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 9, + "end_line": 9, + "column": 4, + "end_column": 34 + }, + "value": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 9, + "end_line": 9, + "column": 11, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "simpleMethod" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 9, + "end_line": 9, + "column": 29, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + } + }, + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 9, + "end_line": 9, + "column": 32, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + } + ] + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 5, + "end_line": 5, + "column": 0, + "end_column": 60 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 5, + "end_line": 5, + "column": 0, + "end_column": 60 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 5, + "end_line": 5, + "column": 0, + "end_column": 60 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 5, + "end_line": 5, + "column": 0, + "end_column": 60 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-b.algo.ts::ConcreteSimpleContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 6, + "end_line": 6, + "column": 2, + "end_column": 51 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "a", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 6, + "end_line": 6, + "column": 22, + "end_column": 31 + } + }, + { + "_type": "SubroutineArgument", + "name": "b", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 6, + "end_line": 6, + "column": 33, + "end_column": 42 + } + } + ], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 6, + "end_line": 8, + "column": 52, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 16 + }, + "value": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 7, + "end_line": 7, + "column": 11, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 7, + "end_line": 7, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + "op": "*", + "right": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 7, + "end_line": 7, + "column": 15, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-a.algo.ts::SimpleContract", + "member_name": "simpleMethod", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 59 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 59 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 59 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 59 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-a.algo.ts::SimpleContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [ + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "member_name": "someState", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 5, + "end_line": 5, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "b8l^BQ*>c;Wd", + "encoding": "utf8" + }, + "description": null + } + ], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "id": "tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract", + "name": "ConcreteArc4Contract", + "description": null, + "method_resolution_order": [ + "tests/approvals/inheritance-a.algo.ts::Arc4Contract", + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceSuperMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 13, + "end_line": 13, + "column": 2, + "end_column": 52 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "a", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 13, + "end_line": 13, + "column": 23, + "end_column": 32 + } + }, + { + "_type": "SubroutineArgument", + "name": "b", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 13, + "end_line": 13, + "column": 34, + "end_column": 43 + } + } + ], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 13, + "end_line": 15, + "column": 53, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 14, + "end_line": 14, + "column": 4, + "end_column": 16 + }, + "value": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 14, + "end_line": 14, + "column": 11, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 14, + "end_line": 14, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + "op": "*", + "right": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 14, + "end_line": 14, + "column": 15, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-a.algo.ts::Arc4Contract", + "member_name": "simpleMethod", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 17, + "end_line": 17, + "column": 2, + "end_column": 54 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "a", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 17, + "end_line": 17, + "column": 25, + "end_column": 34 + } + }, + { + "_type": "SubroutineArgument", + "name": "b", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 17, + "end_line": 17, + "column": 36, + "end_column": 45 + } + } + ], + "return_type": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 17, + "end_line": 19, + "column": 55, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 18, + "end_line": 18, + "column": 4, + "end_column": 16 + }, + "value": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 18, + "end_line": 18, + "column": 11, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 18, + "end_line": 18, + "column": 11, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + "op": "+", + "right": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 18, + "end_line": 18, + "column": 15, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-a.algo.ts::Arc4Contract", + "member_name": "simpleAbiMethod", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 17, + "end_line": 17, + "column": 2, + "end_column": 54 + }, + "name": "simpleAbiMethod", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 11, + "end_line": 11, + "column": 0, + "end_column": 53 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 11, + "end_line": 11, + "column": 0, + "end_column": 53 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 11, + "end_line": 11, + "column": 0, + "end_column": 53 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 11, + "end_line": 11, + "column": 0, + "end_column": 53 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-a.algo.ts::Arc4Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/inheritance-b.algo.ts::ConcreteArc4Contract", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/inheritance-b.algo.ts", + "line": 13, + "end_line": 13, + "column": 0, + "end_column": 57 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [ + { + "_type": "AppStorageDefinition", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 11 + }, + "member_name": "someState", + "kind": 1, + "storage_wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "key_wtype": null, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/inheritance-a.algo.ts", + "line": 12, + "end_line": 12, + "column": 2, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "b8l^BQ*>c;Wd", + "encoding": "utf8" + }, + "description": null + } + ], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/intrinsic-calls.awst b/tests/approvals/out/intrinsic-calls/intrinsic-calls.awst similarity index 100% rename from tests/approvals/out/intrinsic-calls.awst rename to tests/approvals/out/intrinsic-calls/intrinsic-calls.awst diff --git a/tests/approvals/out/intrinsic-calls.awst.json b/tests/approvals/out/intrinsic-calls/intrinsic-calls.awst.json similarity index 99% rename from tests/approvals/out/intrinsic-calls.awst.json rename to tests/approvals/out/intrinsic-calls/intrinsic-calls.awst.json index ee97ad17..a436886f 100644 --- a/tests/approvals/out/intrinsic-calls.awst.json +++ b/tests/approvals/out/intrinsic-calls/intrinsic-calls.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/intrinsic-calls.algo.ts", "line": 5, - "end_line": 11, + "end_line": 5, "column": 0, - "end_column": 1 + "end_column": 34 }, "args": [ { diff --git a/tests/approvals/out/itxn/ItxnDemoContract.ssa.ir b/tests/approvals/out/itxn/ItxnDemoContract.ssa.ir new file mode 100644 index 00000000..bc09e847 --- /dev/null +++ b/tests/approvals/out/itxn/ItxnDemoContract.ssa.ir @@ -0,0 +1,758 @@ +contract tests/approvals/itxn.algo.ts::ItxnDemoContract: + program approval: + subroutine tests/approvals/itxn.algo.ts::ItxnDemoContract.approvalProgram() -> bool: + block@0: // L10 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/itxn.algo.ts::ItxnDemoContract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let reinterpret_bool%1#0: bool = (txn NumAppArgs) + goto reinterpret_bool%1#0 ? block@3 : block@15 + block@3: // if_body_L11 + let tmp%0#0: bytes = ((txnas ApplicationArgs) 0u) + switch tmp%0#0 {"test1" => block@4, "test2" => block@6, "test3" => block@8, "test4" => block@10, * => block@12} + block@4: // switch_case_0_L13 + goto block@5 + block@5: // L13 + tests/approvals/itxn.algo.ts::ItxnDemoContract.test1() + goto block@14 + block@6: // switch_case_1_L16 + goto block@7 + block@7: // L16 + tests/approvals/itxn.algo.ts::ItxnDemoContract.test2() + goto block@14 + block@8: // switch_case_2_L19 + goto block@9 + block@9: // L19 + goto block@11 + block@10: // switch_case_3_L20 + goto block@11 + block@11: // L20 + goto block@14 + block@12: // switch_case_default_L12 + goto block@13 + block@13: // switch_case_next_L12 + goto block@14 + block@14: // L12 + goto block@15 + block@15: // after_if_else_L11 + return 1u + + subroutine tests/approvals/itxn.algo.ts::ItxnDemoContract.constructor() -> void: + block@0: // L7 + (app_global_put "name" 0x) + return + + subroutine tests/approvals/itxn.algo.ts::ItxnDemoContract.test1() -> void: + block@0: // L27 + (app_global_put "name" "AST1") + let assetParams#0: itxn_field_set = itxn_field_set(0) + let assetParams%%param_Fee_idx_0#0: uint64 = 0u + let assetParams%%Fee_length#0: uint64 = 1u + let assetParams%%param_ConfigAssetTotal_idx_0#0: uint64 = 1000u + let assetParams%%ConfigAssetTotal_length#0: uint64 = 1u + let (maybe_value%0#0: bytes, maybe_exists%0#0: bool) = (app_global_get_ex 0u "name") + (assert maybe_exists%0#0) // check GlobalState exists + let assetParams%%param_ConfigAssetName_idx_0#0: bytes = maybe_value%0#0 + let assetParams%%ConfigAssetName_length#0: uint64 = 1u + let assetParams%%param_ConfigAssetUnitName_idx_0#0: bytes = "unit" + let assetParams%%ConfigAssetUnitName_length#0: uint64 = 1u + let assetParams%%param_ConfigAssetDecimals_idx_0#0: uint64 = 3u + let assetParams%%ConfigAssetDecimals_length#0: uint64 = 1u + let assetParams%%param_ConfigAssetManager_idx_0#0: bytes = (global CurrentApplicationAddress) + let assetParams%%ConfigAssetManager_length#0: uint64 = 1u + let assetParams%%param_ConfigAssetReserve_idx_0#0: bytes = (global CurrentApplicationAddress) + let assetParams%%ConfigAssetReserve_length#0: uint64 = 1u + let assetParams%%Sender_length#0: uint64 = 0u + let assetParams%%Note_length#0: uint64 = 0u + let assetParams%%Receiver_length#0: uint64 = 0u + let assetParams%%Amount_length#0: uint64 = 0u + let assetParams%%CloseRemainderTo_length#0: uint64 = 0u + let assetParams%%VotePK_length#0: uint64 = 0u + let assetParams%%SelectionPK_length#0: uint64 = 0u + let assetParams%%VoteFirst_length#0: uint64 = 0u + let assetParams%%VoteLast_length#0: uint64 = 0u + let assetParams%%VoteKeyDilution_length#0: uint64 = 0u + let assetParams%%Type_length#0: uint64 = 0u + let assetParams%%TypeEnum_length#0: uint64 = 0u + let assetParams%%XferAsset_length#0: uint64 = 0u + let assetParams%%AssetAmount_length#0: uint64 = 0u + let assetParams%%AssetSender_length#0: uint64 = 0u + let assetParams%%AssetReceiver_length#0: uint64 = 0u + let assetParams%%AssetCloseTo_length#0: uint64 = 0u + let assetParams%%ApplicationID_length#0: uint64 = 0u + let assetParams%%OnCompletion_length#0: uint64 = 0u + let assetParams%%ApprovalProgram_length#0: uint64 = 0u + let assetParams%%ClearStateProgram_length#0: uint64 = 0u + let assetParams%%RekeyTo_length#0: uint64 = 0u + let assetParams%%ConfigAsset_length#0: uint64 = 0u + let assetParams%%ConfigAssetDefaultFrozen_length#0: uint64 = 0u + let assetParams%%ConfigAssetURL_length#0: uint64 = 0u + let assetParams%%ConfigAssetMetadataHash_length#0: uint64 = 0u + let assetParams%%ConfigAssetFreeze_length#0: uint64 = 0u + let assetParams%%ConfigAssetClawback_length#0: uint64 = 0u + let assetParams%%FreezeAsset_length#0: uint64 = 0u + let assetParams%%FreezeAssetAccount_length#0: uint64 = 0u + let assetParams%%FreezeAssetFrozen_length#0: uint64 = 0u + let assetParams%%GlobalNumUint_length#0: uint64 = 0u + let assetParams%%GlobalNumByteSlice_length#0: uint64 = 0u + let assetParams%%LocalNumUint_length#0: uint64 = 0u + let assetParams%%LocalNumByteSlice_length#0: uint64 = 0u + let assetParams%%ExtraProgramPages_length#0: uint64 = 0u + let assetParams%%Nonparticipation_length#0: uint64 = 0u + let assetParams%%StateProofPK_length#0: uint64 = 0u + let assetParams%%ApplicationArgs_length#0: uint64 = 0u + let assetParams%%Accounts_length#0: uint64 = 0u + let assetParams%%Assets_length#0: uint64 = 0u + let assetParams%%Applications_length#0: uint64 = 0u + let assetParams%%ApprovalProgramPages_length#0: uint64 = 0u + let assetParams%%ClearStateProgramPages_length#0: uint64 = 0u + (app_global_put "name" "AST2") + itxn_begin + ((itxn_field ConfigAssetReserve) assetParams%%param_ConfigAssetReserve_idx_0#0) + ((itxn_field ConfigAssetManager) assetParams%%param_ConfigAssetManager_idx_0#0) + ((itxn_field ConfigAssetDecimals) assetParams%%param_ConfigAssetDecimals_idx_0#0) + ((itxn_field ConfigAssetUnitName) assetParams%%param_ConfigAssetUnitName_idx_0#0) + ((itxn_field ConfigAssetName) assetParams%%param_ConfigAssetName_idx_0#0) + ((itxn_field ConfigAssetTotal) assetParams%%param_ConfigAssetTotal_idx_0#0) + ((itxn_field Fee) assetParams%%param_Fee_idx_0#0) + goto block@1 + block@1: // next_txn_L40 + itxn_submit + let asset1_txn#0: itxn_group_idx = itxn_group_idx(0) + let asset1_txn._is_last#0: bool = 1u + let asset1_txn.Sender#0: bytes = itxn[asset1_txn#0].Sender + let asset1_txn.Fee#0: uint64 = itxn[asset1_txn#0].Fee + let asset1_txn.FirstValid#0: uint64 = itxn[asset1_txn#0].FirstValid + let asset1_txn.FirstValidTime#0: uint64 = itxn[asset1_txn#0].FirstValidTime + let asset1_txn.LastValid#0: uint64 = itxn[asset1_txn#0].LastValid + let asset1_txn.Note#0: bytes = itxn[asset1_txn#0].Note + let asset1_txn.Lease#0: bytes = itxn[asset1_txn#0].Lease + let asset1_txn.Receiver#0: bytes = itxn[asset1_txn#0].Receiver + let asset1_txn.Amount#0: uint64 = itxn[asset1_txn#0].Amount + let asset1_txn.CloseRemainderTo#0: bytes = itxn[asset1_txn#0].CloseRemainderTo + let asset1_txn.VotePK#0: bytes = itxn[asset1_txn#0].VotePK + let asset1_txn.SelectionPK#0: bytes = itxn[asset1_txn#0].SelectionPK + let asset1_txn.VoteFirst#0: uint64 = itxn[asset1_txn#0].VoteFirst + let asset1_txn.VoteLast#0: uint64 = itxn[asset1_txn#0].VoteLast + let asset1_txn.VoteKeyDilution#0: uint64 = itxn[asset1_txn#0].VoteKeyDilution + let asset1_txn.Type#0: bytes = itxn[asset1_txn#0].Type + let asset1_txn.TypeEnum#0: uint64 = itxn[asset1_txn#0].TypeEnum + let asset1_txn.XferAsset#0: uint64 = itxn[asset1_txn#0].XferAsset + let asset1_txn.AssetAmount#0: uint64 = itxn[asset1_txn#0].AssetAmount + let asset1_txn.AssetSender#0: bytes = itxn[asset1_txn#0].AssetSender + let asset1_txn.AssetReceiver#0: bytes = itxn[asset1_txn#0].AssetReceiver + let asset1_txn.AssetCloseTo#0: bytes = itxn[asset1_txn#0].AssetCloseTo + let asset1_txn.GroupIndex#0: uint64 = itxn[asset1_txn#0].GroupIndex + let asset1_txn.TxID#0: bytes = itxn[asset1_txn#0].TxID + let asset1_txn.ApplicationID#0: uint64 = itxn[asset1_txn#0].ApplicationID + let asset1_txn.OnCompletion#0: uint64 = itxn[asset1_txn#0].OnCompletion + let asset1_txn.NumAppArgs#0: uint64 = itxn[asset1_txn#0].NumAppArgs + let asset1_txn.NumAccounts#0: uint64 = itxn[asset1_txn#0].NumAccounts + let asset1_txn.ApprovalProgram#0: bytes = itxn[asset1_txn#0].ApprovalProgram + let asset1_txn.ClearStateProgram#0: bytes = itxn[asset1_txn#0].ClearStateProgram + let asset1_txn.RekeyTo#0: bytes = itxn[asset1_txn#0].RekeyTo + let asset1_txn.ConfigAsset#0: uint64 = itxn[asset1_txn#0].ConfigAsset + let asset1_txn.ConfigAssetTotal#0: uint64 = itxn[asset1_txn#0].ConfigAssetTotal + let asset1_txn.ConfigAssetDecimals#0: uint64 = itxn[asset1_txn#0].ConfigAssetDecimals + let asset1_txn.ConfigAssetDefaultFrozen#0: bool = itxn[asset1_txn#0].ConfigAssetDefaultFrozen + let asset1_txn.ConfigAssetUnitName#0: bytes = itxn[asset1_txn#0].ConfigAssetUnitName + let asset1_txn.ConfigAssetName#0: bytes = itxn[asset1_txn#0].ConfigAssetName + let asset1_txn.ConfigAssetURL#0: bytes = itxn[asset1_txn#0].ConfigAssetURL + let asset1_txn.ConfigAssetMetadataHash#0: bytes = itxn[asset1_txn#0].ConfigAssetMetadataHash + let asset1_txn.ConfigAssetManager#0: bytes = itxn[asset1_txn#0].ConfigAssetManager + let asset1_txn.ConfigAssetReserve#0: bytes = itxn[asset1_txn#0].ConfigAssetReserve + let asset1_txn.ConfigAssetFreeze#0: bytes = itxn[asset1_txn#0].ConfigAssetFreeze + let asset1_txn.ConfigAssetClawback#0: bytes = itxn[asset1_txn#0].ConfigAssetClawback + let asset1_txn.FreezeAsset#0: uint64 = itxn[asset1_txn#0].FreezeAsset + let asset1_txn.FreezeAssetAccount#0: bytes = itxn[asset1_txn#0].FreezeAssetAccount + let asset1_txn.FreezeAssetFrozen#0: bool = itxn[asset1_txn#0].FreezeAssetFrozen + let asset1_txn.NumAssets#0: uint64 = itxn[asset1_txn#0].NumAssets + let asset1_txn.NumApplications#0: uint64 = itxn[asset1_txn#0].NumApplications + let asset1_txn.GlobalNumUint#0: uint64 = itxn[asset1_txn#0].GlobalNumUint + let asset1_txn.GlobalNumByteSlice#0: uint64 = itxn[asset1_txn#0].GlobalNumByteSlice + let asset1_txn.LocalNumUint#0: uint64 = itxn[asset1_txn#0].LocalNumUint + let asset1_txn.LocalNumByteSlice#0: uint64 = itxn[asset1_txn#0].LocalNumByteSlice + let asset1_txn.ExtraProgramPages#0: uint64 = itxn[asset1_txn#0].ExtraProgramPages + let asset1_txn.Nonparticipation#0: bool = itxn[asset1_txn#0].Nonparticipation + let asset1_txn.NumLogs#0: uint64 = itxn[asset1_txn#0].NumLogs + let asset1_txn.CreatedAssetID#0: uint64 = itxn[asset1_txn#0].CreatedAssetID + let asset1_txn.CreatedApplicationID#0: uint64 = itxn[asset1_txn#0].CreatedApplicationID + let asset1_txn.LastLog#0: bytes = itxn[asset1_txn#0].LastLog + let asset1_txn.StateProofPK#0: bytes = itxn[asset1_txn#0].StateProofPK + let asset1_txn.NumApprovalProgramPages#0: uint64 = itxn[asset1_txn#0].NumApprovalProgramPages + let asset1_txn.NumClearStateProgramPages#0: uint64 = itxn[asset1_txn#0].NumClearStateProgramPages + let assetParams#1: itxn_field_set = itxn_field_set(1) + let (maybe_value%1#0: bytes, maybe_exists%1#0: bool) = (app_global_get_ex 0u "name") + (assert maybe_exists%1#0) // check GlobalState exists + let assetParams%%param_ConfigAssetName_idx_0#1: bytes = maybe_value%1#0 + let assetParams%%ConfigAssetName_length#1: uint64 = 1u + itxn_begin + ((itxn_field ConfigAssetReserve) assetParams%%param_ConfigAssetReserve_idx_0#0) + ((itxn_field ConfigAssetManager) assetParams%%param_ConfigAssetManager_idx_0#0) + ((itxn_field ConfigAssetDecimals) assetParams%%param_ConfigAssetDecimals_idx_0#0) + ((itxn_field ConfigAssetUnitName) assetParams%%param_ConfigAssetUnitName_idx_0#0) + ((itxn_field ConfigAssetName) assetParams%%param_ConfigAssetName_idx_0#1) + ((itxn_field ConfigAssetTotal) assetParams%%param_ConfigAssetTotal_idx_0#0) + ((itxn_field Fee) assetParams%%param_Fee_idx_0#0) + goto block@2 + block@2: // next_txn_L44 + itxn_submit + let asset2_txn#0: itxn_group_idx = itxn_group_idx(0) + let asset2_txn._is_last#0: bool = 1u + let asset2_txn.Sender#0: bytes = itxn[asset2_txn#0].Sender + let asset2_txn.Fee#0: uint64 = itxn[asset2_txn#0].Fee + let asset2_txn.FirstValid#0: uint64 = itxn[asset2_txn#0].FirstValid + let asset2_txn.FirstValidTime#0: uint64 = itxn[asset2_txn#0].FirstValidTime + let asset2_txn.LastValid#0: uint64 = itxn[asset2_txn#0].LastValid + let asset2_txn.Note#0: bytes = itxn[asset2_txn#0].Note + let asset2_txn.Lease#0: bytes = itxn[asset2_txn#0].Lease + let asset2_txn.Receiver#0: bytes = itxn[asset2_txn#0].Receiver + let asset2_txn.Amount#0: uint64 = itxn[asset2_txn#0].Amount + let asset2_txn.CloseRemainderTo#0: bytes = itxn[asset2_txn#0].CloseRemainderTo + let asset2_txn.VotePK#0: bytes = itxn[asset2_txn#0].VotePK + let asset2_txn.SelectionPK#0: bytes = itxn[asset2_txn#0].SelectionPK + let asset2_txn.VoteFirst#0: uint64 = itxn[asset2_txn#0].VoteFirst + let asset2_txn.VoteLast#0: uint64 = itxn[asset2_txn#0].VoteLast + let asset2_txn.VoteKeyDilution#0: uint64 = itxn[asset2_txn#0].VoteKeyDilution + let asset2_txn.Type#0: bytes = itxn[asset2_txn#0].Type + let asset2_txn.TypeEnum#0: uint64 = itxn[asset2_txn#0].TypeEnum + let asset2_txn.XferAsset#0: uint64 = itxn[asset2_txn#0].XferAsset + let asset2_txn.AssetAmount#0: uint64 = itxn[asset2_txn#0].AssetAmount + let asset2_txn.AssetSender#0: bytes = itxn[asset2_txn#0].AssetSender + let asset2_txn.AssetReceiver#0: bytes = itxn[asset2_txn#0].AssetReceiver + let asset2_txn.AssetCloseTo#0: bytes = itxn[asset2_txn#0].AssetCloseTo + let asset2_txn.GroupIndex#0: uint64 = itxn[asset2_txn#0].GroupIndex + let asset2_txn.TxID#0: bytes = itxn[asset2_txn#0].TxID + let asset2_txn.ApplicationID#0: uint64 = itxn[asset2_txn#0].ApplicationID + let asset2_txn.OnCompletion#0: uint64 = itxn[asset2_txn#0].OnCompletion + let asset2_txn.NumAppArgs#0: uint64 = itxn[asset2_txn#0].NumAppArgs + let asset2_txn.NumAccounts#0: uint64 = itxn[asset2_txn#0].NumAccounts + let asset2_txn.ApprovalProgram#0: bytes = itxn[asset2_txn#0].ApprovalProgram + let asset2_txn.ClearStateProgram#0: bytes = itxn[asset2_txn#0].ClearStateProgram + let asset2_txn.RekeyTo#0: bytes = itxn[asset2_txn#0].RekeyTo + let asset2_txn.ConfigAsset#0: uint64 = itxn[asset2_txn#0].ConfigAsset + let asset2_txn.ConfigAssetTotal#0: uint64 = itxn[asset2_txn#0].ConfigAssetTotal + let asset2_txn.ConfigAssetDecimals#0: uint64 = itxn[asset2_txn#0].ConfigAssetDecimals + let asset2_txn.ConfigAssetDefaultFrozen#0: bool = itxn[asset2_txn#0].ConfigAssetDefaultFrozen + let asset2_txn.ConfigAssetUnitName#0: bytes = itxn[asset2_txn#0].ConfigAssetUnitName + let asset2_txn.ConfigAssetName#0: bytes = itxn[asset2_txn#0].ConfigAssetName + let asset2_txn.ConfigAssetURL#0: bytes = itxn[asset2_txn#0].ConfigAssetURL + let asset2_txn.ConfigAssetMetadataHash#0: bytes = itxn[asset2_txn#0].ConfigAssetMetadataHash + let asset2_txn.ConfigAssetManager#0: bytes = itxn[asset2_txn#0].ConfigAssetManager + let asset2_txn.ConfigAssetReserve#0: bytes = itxn[asset2_txn#0].ConfigAssetReserve + let asset2_txn.ConfigAssetFreeze#0: bytes = itxn[asset2_txn#0].ConfigAssetFreeze + let asset2_txn.ConfigAssetClawback#0: bytes = itxn[asset2_txn#0].ConfigAssetClawback + let asset2_txn.FreezeAsset#0: uint64 = itxn[asset2_txn#0].FreezeAsset + let asset2_txn.FreezeAssetAccount#0: bytes = itxn[asset2_txn#0].FreezeAssetAccount + let asset2_txn.FreezeAssetFrozen#0: bool = itxn[asset2_txn#0].FreezeAssetFrozen + let asset2_txn.NumAssets#0: uint64 = itxn[asset2_txn#0].NumAssets + let asset2_txn.NumApplications#0: uint64 = itxn[asset2_txn#0].NumApplications + let asset2_txn.GlobalNumUint#0: uint64 = itxn[asset2_txn#0].GlobalNumUint + let asset2_txn.GlobalNumByteSlice#0: uint64 = itxn[asset2_txn#0].GlobalNumByteSlice + let asset2_txn.LocalNumUint#0: uint64 = itxn[asset2_txn#0].LocalNumUint + let asset2_txn.LocalNumByteSlice#0: uint64 = itxn[asset2_txn#0].LocalNumByteSlice + let asset2_txn.ExtraProgramPages#0: uint64 = itxn[asset2_txn#0].ExtraProgramPages + let asset2_txn.Nonparticipation#0: bool = itxn[asset2_txn#0].Nonparticipation + let asset2_txn.NumLogs#0: uint64 = itxn[asset2_txn#0].NumLogs + let asset2_txn.CreatedAssetID#0: uint64 = itxn[asset2_txn#0].CreatedAssetID + let asset2_txn.CreatedApplicationID#0: uint64 = itxn[asset2_txn#0].CreatedApplicationID + let asset2_txn.LastLog#0: bytes = itxn[asset2_txn#0].LastLog + let asset2_txn.StateProofPK#0: bytes = itxn[asset2_txn#0].StateProofPK + let asset2_txn.NumApprovalProgramPages#0: uint64 = itxn[asset2_txn#0].NumApprovalProgramPages + let asset2_txn.NumClearStateProgramPages#0: uint64 = itxn[asset2_txn#0].NumClearStateProgramPages + let tmp%0#0: bool = (== asset1_txn.ConfigAssetName#0 "AST1") + (assert tmp%0#0) // asset1_txn is correct + let tmp%1#0: bool = (== asset2_txn.ConfigAssetName#0 "AST2") + (assert tmp%1#0) // asset2_txn is correct + let (value%0#0: bytes, check%0#0: bool) = ((asset_params_get AssetName) asset1_txn.CreatedAssetID#0) + (assert check%0#0) // asset exists + let tmp%2#0: bool = (== value%0#0 "AST1") + (assert tmp%2#0) // created asset 1 is correct + let (value%1#0: bytes, check%1#0: bool) = ((asset_params_get AssetName) asset2_txn.CreatedAssetID#0) + (assert check%1#0) // asset exists + let tmp%3#0: bool = (== value%1#0 "AST2") + (assert tmp%3#0) // created asset 2 is correct + let appCreateParams#0: itxn_field_set = itxn_field_set(2) + let appCreateParams%%param_Fee_idx_0#0: uint64 = 0u + let appCreateParams%%Fee_length#0: uint64 = 1u + let appCreateParams%%param_ApprovalProgram_idx_0#0: bytes = 0x098101 + let appCreateParams%%ApprovalProgram_length#0: uint64 = 1u + let appCreateParams%%param_ClearStateProgram_idx_0#0: bytes = 0x098101 + let appCreateParams%%ClearStateProgram_length#0: uint64 = 1u + let appCreateParams%%Sender_length#0: uint64 = 0u + let appCreateParams%%Note_length#0: uint64 = 0u + let appCreateParams%%Receiver_length#0: uint64 = 0u + let appCreateParams%%Amount_length#0: uint64 = 0u + let appCreateParams%%CloseRemainderTo_length#0: uint64 = 0u + let appCreateParams%%VotePK_length#0: uint64 = 0u + let appCreateParams%%SelectionPK_length#0: uint64 = 0u + let appCreateParams%%VoteFirst_length#0: uint64 = 0u + let appCreateParams%%VoteLast_length#0: uint64 = 0u + let appCreateParams%%VoteKeyDilution_length#0: uint64 = 0u + let appCreateParams%%Type_length#0: uint64 = 0u + let appCreateParams%%TypeEnum_length#0: uint64 = 0u + let appCreateParams%%XferAsset_length#0: uint64 = 0u + let appCreateParams%%AssetAmount_length#0: uint64 = 0u + let appCreateParams%%AssetSender_length#0: uint64 = 0u + let appCreateParams%%AssetReceiver_length#0: uint64 = 0u + let appCreateParams%%AssetCloseTo_length#0: uint64 = 0u + let appCreateParams%%ApplicationID_length#0: uint64 = 0u + let appCreateParams%%OnCompletion_length#0: uint64 = 0u + let appCreateParams%%RekeyTo_length#0: uint64 = 0u + let appCreateParams%%ConfigAsset_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetTotal_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetDecimals_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetDefaultFrozen_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetUnitName_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetName_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetURL_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetMetadataHash_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetManager_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetReserve_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetFreeze_length#0: uint64 = 0u + let appCreateParams%%ConfigAssetClawback_length#0: uint64 = 0u + let appCreateParams%%FreezeAsset_length#0: uint64 = 0u + let appCreateParams%%FreezeAssetAccount_length#0: uint64 = 0u + let appCreateParams%%FreezeAssetFrozen_length#0: uint64 = 0u + let appCreateParams%%GlobalNumUint_length#0: uint64 = 0u + let appCreateParams%%GlobalNumByteSlice_length#0: uint64 = 0u + let appCreateParams%%LocalNumUint_length#0: uint64 = 0u + let appCreateParams%%LocalNumByteSlice_length#0: uint64 = 0u + let appCreateParams%%ExtraProgramPages_length#0: uint64 = 0u + let appCreateParams%%Nonparticipation_length#0: uint64 = 0u + let appCreateParams%%StateProofPK_length#0: uint64 = 0u + let appCreateParams%%ApplicationArgs_length#0: uint64 = 0u + let appCreateParams%%Accounts_length#0: uint64 = 0u + let appCreateParams%%Assets_length#0: uint64 = 0u + let appCreateParams%%Applications_length#0: uint64 = 0u + let appCreateParams%%ApprovalProgramPages_length#0: uint64 = 0u + let appCreateParams%%ClearStateProgramPages_length#0: uint64 = 0u + let assetParams#2: itxn_field_set = itxn_field_set(3) + let assetParams%%param_ConfigAssetName_idx_0#2: bytes = "AST3" + let assetParams%%ConfigAssetName_length#2: uint64 = 1u + itxn_begin + ((itxn_field ClearStateProgram) appCreateParams%%param_ClearStateProgram_idx_0#0) + ((itxn_field ApprovalProgram) appCreateParams%%param_ApprovalProgram_idx_0#0) + ((itxn_field Fee) appCreateParams%%param_Fee_idx_0#0) + goto block@3 + block@3: // next_txn_L61 + itxn_next + ((itxn_field ConfigAssetReserve) assetParams%%param_ConfigAssetReserve_idx_0#0) + ((itxn_field ConfigAssetManager) assetParams%%param_ConfigAssetManager_idx_0#0) + ((itxn_field ConfigAssetDecimals) assetParams%%param_ConfigAssetDecimals_idx_0#0) + ((itxn_field ConfigAssetUnitName) assetParams%%param_ConfigAssetUnitName_idx_0#0) + ((itxn_field ConfigAssetName) assetParams%%param_ConfigAssetName_idx_0#2) + ((itxn_field ConfigAssetTotal) assetParams%%param_ConfigAssetTotal_idx_0#0) + ((itxn_field Fee) assetParams%%param_Fee_idx_0#0) + goto block@4 + block@4: // next_txn_L61 + itxn_submit + let appCreateTxn#0: itxn_group_idx = itxn_group_idx(0) + let asset3_txn#0: itxn_group_idx = itxn_group_idx(1) + let appCreateTxn._is_last#0: bool = 0u + let appCreateTxn.Sender#0: bytes = itxn[appCreateTxn#0].Sender + let appCreateTxn.Fee#0: uint64 = itxn[appCreateTxn#0].Fee + let appCreateTxn.FirstValid#0: uint64 = itxn[appCreateTxn#0].FirstValid + let appCreateTxn.FirstValidTime#0: uint64 = itxn[appCreateTxn#0].FirstValidTime + let appCreateTxn.LastValid#0: uint64 = itxn[appCreateTxn#0].LastValid + let appCreateTxn.Note#0: bytes = itxn[appCreateTxn#0].Note + let appCreateTxn.Lease#0: bytes = itxn[appCreateTxn#0].Lease + let appCreateTxn.Receiver#0: bytes = itxn[appCreateTxn#0].Receiver + let appCreateTxn.Amount#0: uint64 = itxn[appCreateTxn#0].Amount + let appCreateTxn.CloseRemainderTo#0: bytes = itxn[appCreateTxn#0].CloseRemainderTo + let appCreateTxn.VotePK#0: bytes = itxn[appCreateTxn#0].VotePK + let appCreateTxn.SelectionPK#0: bytes = itxn[appCreateTxn#0].SelectionPK + let appCreateTxn.VoteFirst#0: uint64 = itxn[appCreateTxn#0].VoteFirst + let appCreateTxn.VoteLast#0: uint64 = itxn[appCreateTxn#0].VoteLast + let appCreateTxn.VoteKeyDilution#0: uint64 = itxn[appCreateTxn#0].VoteKeyDilution + let appCreateTxn.Type#0: bytes = itxn[appCreateTxn#0].Type + let appCreateTxn.TypeEnum#0: uint64 = itxn[appCreateTxn#0].TypeEnum + let appCreateTxn.XferAsset#0: uint64 = itxn[appCreateTxn#0].XferAsset + let appCreateTxn.AssetAmount#0: uint64 = itxn[appCreateTxn#0].AssetAmount + let appCreateTxn.AssetSender#0: bytes = itxn[appCreateTxn#0].AssetSender + let appCreateTxn.AssetReceiver#0: bytes = itxn[appCreateTxn#0].AssetReceiver + let appCreateTxn.AssetCloseTo#0: bytes = itxn[appCreateTxn#0].AssetCloseTo + let appCreateTxn.GroupIndex#0: uint64 = itxn[appCreateTxn#0].GroupIndex + let appCreateTxn.TxID#0: bytes = itxn[appCreateTxn#0].TxID + let appCreateTxn.ApplicationID#0: uint64 = itxn[appCreateTxn#0].ApplicationID + let appCreateTxn.OnCompletion#0: uint64 = itxn[appCreateTxn#0].OnCompletion + let appCreateTxn.NumAppArgs#0: uint64 = itxn[appCreateTxn#0].NumAppArgs + let appCreateTxn.NumAccounts#0: uint64 = itxn[appCreateTxn#0].NumAccounts + let appCreateTxn.ApprovalProgram#0: bytes = itxn[appCreateTxn#0].ApprovalProgram + let appCreateTxn.ClearStateProgram#0: bytes = itxn[appCreateTxn#0].ClearStateProgram + let appCreateTxn.RekeyTo#0: bytes = itxn[appCreateTxn#0].RekeyTo + let appCreateTxn.ConfigAsset#0: uint64 = itxn[appCreateTxn#0].ConfigAsset + let appCreateTxn.ConfigAssetTotal#0: uint64 = itxn[appCreateTxn#0].ConfigAssetTotal + let appCreateTxn.ConfigAssetDecimals#0: uint64 = itxn[appCreateTxn#0].ConfigAssetDecimals + let appCreateTxn.ConfigAssetDefaultFrozen#0: bool = itxn[appCreateTxn#0].ConfigAssetDefaultFrozen + let appCreateTxn.ConfigAssetUnitName#0: bytes = itxn[appCreateTxn#0].ConfigAssetUnitName + let appCreateTxn.ConfigAssetName#0: bytes = itxn[appCreateTxn#0].ConfigAssetName + let appCreateTxn.ConfigAssetURL#0: bytes = itxn[appCreateTxn#0].ConfigAssetURL + let appCreateTxn.ConfigAssetMetadataHash#0: bytes = itxn[appCreateTxn#0].ConfigAssetMetadataHash + let appCreateTxn.ConfigAssetManager#0: bytes = itxn[appCreateTxn#0].ConfigAssetManager + let appCreateTxn.ConfigAssetReserve#0: bytes = itxn[appCreateTxn#0].ConfigAssetReserve + let appCreateTxn.ConfigAssetFreeze#0: bytes = itxn[appCreateTxn#0].ConfigAssetFreeze + let appCreateTxn.ConfigAssetClawback#0: bytes = itxn[appCreateTxn#0].ConfigAssetClawback + let appCreateTxn.FreezeAsset#0: uint64 = itxn[appCreateTxn#0].FreezeAsset + let appCreateTxn.FreezeAssetAccount#0: bytes = itxn[appCreateTxn#0].FreezeAssetAccount + let appCreateTxn.FreezeAssetFrozen#0: bool = itxn[appCreateTxn#0].FreezeAssetFrozen + let appCreateTxn.NumAssets#0: uint64 = itxn[appCreateTxn#0].NumAssets + let appCreateTxn.NumApplications#0: uint64 = itxn[appCreateTxn#0].NumApplications + let appCreateTxn.GlobalNumUint#0: uint64 = itxn[appCreateTxn#0].GlobalNumUint + let appCreateTxn.GlobalNumByteSlice#0: uint64 = itxn[appCreateTxn#0].GlobalNumByteSlice + let appCreateTxn.LocalNumUint#0: uint64 = itxn[appCreateTxn#0].LocalNumUint + let appCreateTxn.LocalNumByteSlice#0: uint64 = itxn[appCreateTxn#0].LocalNumByteSlice + let appCreateTxn.ExtraProgramPages#0: uint64 = itxn[appCreateTxn#0].ExtraProgramPages + let appCreateTxn.Nonparticipation#0: bool = itxn[appCreateTxn#0].Nonparticipation + let appCreateTxn.NumLogs#0: uint64 = itxn[appCreateTxn#0].NumLogs + let appCreateTxn.CreatedAssetID#0: uint64 = itxn[appCreateTxn#0].CreatedAssetID + let appCreateTxn.CreatedApplicationID#0: uint64 = itxn[appCreateTxn#0].CreatedApplicationID + let appCreateTxn.LastLog#0: bytes = itxn[appCreateTxn#0].LastLog + let appCreateTxn.StateProofPK#0: bytes = itxn[appCreateTxn#0].StateProofPK + let appCreateTxn.NumApprovalProgramPages#0: uint64 = itxn[appCreateTxn#0].NumApprovalProgramPages + let appCreateTxn.NumClearStateProgramPages#0: uint64 = itxn[appCreateTxn#0].NumClearStateProgramPages + let asset3_txn._is_last#0: bool = 1u + let asset3_txn.Sender#0: bytes = itxn[asset3_txn#0].Sender + let asset3_txn.Fee#0: uint64 = itxn[asset3_txn#0].Fee + let asset3_txn.FirstValid#0: uint64 = itxn[asset3_txn#0].FirstValid + let asset3_txn.FirstValidTime#0: uint64 = itxn[asset3_txn#0].FirstValidTime + let asset3_txn.LastValid#0: uint64 = itxn[asset3_txn#0].LastValid + let asset3_txn.Note#0: bytes = itxn[asset3_txn#0].Note + let asset3_txn.Lease#0: bytes = itxn[asset3_txn#0].Lease + let asset3_txn.Receiver#0: bytes = itxn[asset3_txn#0].Receiver + let asset3_txn.Amount#0: uint64 = itxn[asset3_txn#0].Amount + let asset3_txn.CloseRemainderTo#0: bytes = itxn[asset3_txn#0].CloseRemainderTo + let asset3_txn.VotePK#0: bytes = itxn[asset3_txn#0].VotePK + let asset3_txn.SelectionPK#0: bytes = itxn[asset3_txn#0].SelectionPK + let asset3_txn.VoteFirst#0: uint64 = itxn[asset3_txn#0].VoteFirst + let asset3_txn.VoteLast#0: uint64 = itxn[asset3_txn#0].VoteLast + let asset3_txn.VoteKeyDilution#0: uint64 = itxn[asset3_txn#0].VoteKeyDilution + let asset3_txn.Type#0: bytes = itxn[asset3_txn#0].Type + let asset3_txn.TypeEnum#0: uint64 = itxn[asset3_txn#0].TypeEnum + let asset3_txn.XferAsset#0: uint64 = itxn[asset3_txn#0].XferAsset + let asset3_txn.AssetAmount#0: uint64 = itxn[asset3_txn#0].AssetAmount + let asset3_txn.AssetSender#0: bytes = itxn[asset3_txn#0].AssetSender + let asset3_txn.AssetReceiver#0: bytes = itxn[asset3_txn#0].AssetReceiver + let asset3_txn.AssetCloseTo#0: bytes = itxn[asset3_txn#0].AssetCloseTo + let asset3_txn.GroupIndex#0: uint64 = itxn[asset3_txn#0].GroupIndex + let asset3_txn.TxID#0: bytes = itxn[asset3_txn#0].TxID + let asset3_txn.ApplicationID#0: uint64 = itxn[asset3_txn#0].ApplicationID + let asset3_txn.OnCompletion#0: uint64 = itxn[asset3_txn#0].OnCompletion + let asset3_txn.NumAppArgs#0: uint64 = itxn[asset3_txn#0].NumAppArgs + let asset3_txn.NumAccounts#0: uint64 = itxn[asset3_txn#0].NumAccounts + let asset3_txn.ApprovalProgram#0: bytes = itxn[asset3_txn#0].ApprovalProgram + let asset3_txn.ClearStateProgram#0: bytes = itxn[asset3_txn#0].ClearStateProgram + let asset3_txn.RekeyTo#0: bytes = itxn[asset3_txn#0].RekeyTo + let asset3_txn.ConfigAsset#0: uint64 = itxn[asset3_txn#0].ConfigAsset + let asset3_txn.ConfigAssetTotal#0: uint64 = itxn[asset3_txn#0].ConfigAssetTotal + let asset3_txn.ConfigAssetDecimals#0: uint64 = itxn[asset3_txn#0].ConfigAssetDecimals + let asset3_txn.ConfigAssetDefaultFrozen#0: bool = itxn[asset3_txn#0].ConfigAssetDefaultFrozen + let asset3_txn.ConfigAssetUnitName#0: bytes = itxn[asset3_txn#0].ConfigAssetUnitName + let asset3_txn.ConfigAssetName#0: bytes = itxn[asset3_txn#0].ConfigAssetName + let asset3_txn.ConfigAssetURL#0: bytes = itxn[asset3_txn#0].ConfigAssetURL + let asset3_txn.ConfigAssetMetadataHash#0: bytes = itxn[asset3_txn#0].ConfigAssetMetadataHash + let asset3_txn.ConfigAssetManager#0: bytes = itxn[asset3_txn#0].ConfigAssetManager + let asset3_txn.ConfigAssetReserve#0: bytes = itxn[asset3_txn#0].ConfigAssetReserve + let asset3_txn.ConfigAssetFreeze#0: bytes = itxn[asset3_txn#0].ConfigAssetFreeze + let asset3_txn.ConfigAssetClawback#0: bytes = itxn[asset3_txn#0].ConfigAssetClawback + let asset3_txn.FreezeAsset#0: uint64 = itxn[asset3_txn#0].FreezeAsset + let asset3_txn.FreezeAssetAccount#0: bytes = itxn[asset3_txn#0].FreezeAssetAccount + let asset3_txn.FreezeAssetFrozen#0: bool = itxn[asset3_txn#0].FreezeAssetFrozen + let asset3_txn.NumAssets#0: uint64 = itxn[asset3_txn#0].NumAssets + let asset3_txn.NumApplications#0: uint64 = itxn[asset3_txn#0].NumApplications + let asset3_txn.GlobalNumUint#0: uint64 = itxn[asset3_txn#0].GlobalNumUint + let asset3_txn.GlobalNumByteSlice#0: uint64 = itxn[asset3_txn#0].GlobalNumByteSlice + let asset3_txn.LocalNumUint#0: uint64 = itxn[asset3_txn#0].LocalNumUint + let asset3_txn.LocalNumByteSlice#0: uint64 = itxn[asset3_txn#0].LocalNumByteSlice + let asset3_txn.ExtraProgramPages#0: uint64 = itxn[asset3_txn#0].ExtraProgramPages + let asset3_txn.Nonparticipation#0: bool = itxn[asset3_txn#0].Nonparticipation + let asset3_txn.NumLogs#0: uint64 = itxn[asset3_txn#0].NumLogs + let asset3_txn.CreatedAssetID#0: uint64 = itxn[asset3_txn#0].CreatedAssetID + let asset3_txn.CreatedApplicationID#0: uint64 = itxn[asset3_txn#0].CreatedApplicationID + let asset3_txn.LastLog#0: bytes = itxn[asset3_txn#0].LastLog + let asset3_txn.StateProofPK#0: bytes = itxn[asset3_txn#0].StateProofPK + let asset3_txn.NumApprovalProgramPages#0: uint64 = itxn[asset3_txn#0].NumApprovalProgramPages + let asset3_txn.NumClearStateProgramPages#0: uint64 = itxn[asset3_txn#0].NumClearStateProgramPages + let reinterpret_bool%0#0: bool = appCreateTxn.ApplicationID#0 + (assert reinterpret_bool%0#0) // app is created + let tmp%4#0: bool = (== asset3_txn.ConfigAssetName#0 "AST3") + (assert tmp%4#0) // asset3_txn is correct + let appCreateParams#1: itxn_field_set = itxn_field_set(4) + let appCreateParams%%param_Note_idx_0#0: bytes = "3rd" + let appCreateParams%%Note_length#1: uint64 = 1u + let assetParams#3: itxn_field_set = itxn_field_set(5) + let assetParams%%param_Note_idx_0#0: bytes = "3rd" + let assetParams%%Note_length#1: uint64 = 1u + itxn_begin + let is_Note_count_gte_1%0#0: bool = (>= appCreateParams%%Note_length#1 1u) + goto is_Note_count_gte_1%0#0 ? block@5 : block@6 + block@5: // set_Note_0_to_0_L72 + ((itxn_field Note) appCreateParams%%param_Note_idx_0#0) + goto block@6 + block@6: // next_field_L72 + ((itxn_field ClearStateProgram) appCreateParams%%param_ClearStateProgram_idx_0#0) + ((itxn_field ApprovalProgram) appCreateParams%%param_ApprovalProgram_idx_0#0) + ((itxn_field Fee) appCreateParams%%param_Fee_idx_0#0) + goto block@7 + block@7: // next_txn_L72 + itxn_next + let is_Note_count_gte_1%1#0: bool = (>= assetParams%%Note_length#1 1u) + goto is_Note_count_gte_1%1#0 ? block@8 : block@9 + block@8: // set_Note_0_to_0_L72 + ((itxn_field Note) assetParams%%param_Note_idx_0#0) + goto block@9 + block@9: // next_field_L72 + ((itxn_field ConfigAssetReserve) assetParams%%param_ConfigAssetReserve_idx_0#0) + ((itxn_field ConfigAssetManager) assetParams%%param_ConfigAssetManager_idx_0#0) + ((itxn_field ConfigAssetDecimals) assetParams%%param_ConfigAssetDecimals_idx_0#0) + ((itxn_field ConfigAssetUnitName) assetParams%%param_ConfigAssetUnitName_idx_0#0) + ((itxn_field ConfigAssetName) assetParams%%param_ConfigAssetName_idx_0#2) + ((itxn_field ConfigAssetTotal) assetParams%%param_ConfigAssetTotal_idx_0#0) + ((itxn_field Fee) assetParams%%param_Fee_idx_0#0) + goto block@10 + block@10: // next_txn_L72 + itxn_submit + return + + subroutine tests/approvals/itxn.algo.ts::ItxnDemoContract.test2() -> void: + block@0: // L75 + let createAppParams%%param_OnCompletion_idx_0#2: uint64 = undefined + let createAppParams%%param_ApplicationArgs_idx_2#3: bytes = undefined + let reinterpret_bool%0#0: bool = (txn NumAppArgs) + goto reinterpret_bool%0#0 ? block@1 : block@2 + block@1: // if_body_L77 + let (args.0#0: bytes, args.1#0: bytes) = ("1", "2") + let createAppParams#0: itxn_field_set = itxn_field_set(0) + let createAppParams%%param_Fee_idx_0#0: uint64 = 0u + let createAppParams%%Fee_length#0: uint64 = 1u + let createAppParams%%param_ApprovalProgram_idx_0#0: bytes = "\t\xc2\x81\x01" + let createAppParams%%ApprovalProgram_length#0: uint64 = 1u + let createAppParams%%param_ClearStateProgram_idx_0#0: bytes = "\t\xc2\x81\x01" + let createAppParams%%ClearStateProgram_length#0: uint64 = 1u + let createAppParams%%param_ApplicationArgs_idx_0#0: bytes = args.0#0 + let createAppParams%%param_ApplicationArgs_idx_1#0: bytes = args.1#0 + let createAppParams%%ApplicationArgs_length#0: uint64 = 2u + let createAppParams%%param_OnCompletion_idx_0#0: uint64 = 0u + let createAppParams%%OnCompletion_length#0: uint64 = 1u + let createAppParams%%param_Note_idx_0#0: bytes = "with args param set" + let createAppParams%%Note_length#0: uint64 = 1u + let createAppParams%%Sender_length#0: uint64 = 0u + let createAppParams%%Receiver_length#0: uint64 = 0u + let createAppParams%%Amount_length#0: uint64 = 0u + let createAppParams%%CloseRemainderTo_length#0: uint64 = 0u + let createAppParams%%VotePK_length#0: uint64 = 0u + let createAppParams%%SelectionPK_length#0: uint64 = 0u + let createAppParams%%VoteFirst_length#0: uint64 = 0u + let createAppParams%%VoteLast_length#0: uint64 = 0u + let createAppParams%%VoteKeyDilution_length#0: uint64 = 0u + let createAppParams%%Type_length#0: uint64 = 0u + let createAppParams%%TypeEnum_length#0: uint64 = 0u + let createAppParams%%XferAsset_length#0: uint64 = 0u + let createAppParams%%AssetAmount_length#0: uint64 = 0u + let createAppParams%%AssetSender_length#0: uint64 = 0u + let createAppParams%%AssetReceiver_length#0: uint64 = 0u + let createAppParams%%AssetCloseTo_length#0: uint64 = 0u + let createAppParams%%ApplicationID_length#0: uint64 = 0u + let createAppParams%%RekeyTo_length#0: uint64 = 0u + let createAppParams%%ConfigAsset_length#0: uint64 = 0u + let createAppParams%%ConfigAssetTotal_length#0: uint64 = 0u + let createAppParams%%ConfigAssetDecimals_length#0: uint64 = 0u + let createAppParams%%ConfigAssetDefaultFrozen_length#0: uint64 = 0u + let createAppParams%%ConfigAssetUnitName_length#0: uint64 = 0u + let createAppParams%%ConfigAssetName_length#0: uint64 = 0u + let createAppParams%%ConfigAssetURL_length#0: uint64 = 0u + let createAppParams%%ConfigAssetMetadataHash_length#0: uint64 = 0u + let createAppParams%%ConfigAssetManager_length#0: uint64 = 0u + let createAppParams%%ConfigAssetReserve_length#0: uint64 = 0u + let createAppParams%%ConfigAssetFreeze_length#0: uint64 = 0u + let createAppParams%%ConfigAssetClawback_length#0: uint64 = 0u + let createAppParams%%FreezeAsset_length#0: uint64 = 0u + let createAppParams%%FreezeAssetAccount_length#0: uint64 = 0u + let createAppParams%%FreezeAssetFrozen_length#0: uint64 = 0u + let createAppParams%%GlobalNumUint_length#0: uint64 = 0u + let createAppParams%%GlobalNumByteSlice_length#0: uint64 = 0u + let createAppParams%%LocalNumUint_length#0: uint64 = 0u + let createAppParams%%LocalNumByteSlice_length#0: uint64 = 0u + let createAppParams%%ExtraProgramPages_length#0: uint64 = 0u + let createAppParams%%Nonparticipation_length#0: uint64 = 0u + let createAppParams%%StateProofPK_length#0: uint64 = 0u + let createAppParams%%Accounts_length#0: uint64 = 0u + let createAppParams%%Assets_length#0: uint64 = 0u + let createAppParams%%Applications_length#0: uint64 = 0u + let createAppParams%%ApprovalProgramPages_length#0: uint64 = 0u + let createAppParams%%ClearStateProgramPages_length#0: uint64 = 0u + goto block@3 + block@2: // else_body_L86 + let createAppParams#1: itxn_field_set = itxn_field_set(1) + let createAppParams%%param_Fee_idx_0#1: uint64 = 0u + let createAppParams%%Fee_length#1: uint64 = 1u + let createAppParams%%param_ApprovalProgram_idx_0#1: bytes = "\t\xc2\x81\x01" + let createAppParams%%ApprovalProgram_length#1: uint64 = 1u + let createAppParams%%param_ClearStateProgram_idx_0#1: bytes = "\t\xc2\x81\x01" + let createAppParams%%ClearStateProgram_length#1: uint64 = 1u + let createAppParams%%param_ApplicationArgs_idx_0#1: bytes = "3" + let createAppParams%%param_ApplicationArgs_idx_1#1: bytes = "4" + let createAppParams%%param_ApplicationArgs_idx_2#0: bytes = "5" + let createAppParams%%ApplicationArgs_length#1: uint64 = 3u + let createAppParams%%param_Note_idx_0#1: bytes = "no args param set" + let createAppParams%%Note_length#1: uint64 = 1u + let createAppParams%%Sender_length#1: uint64 = 0u + let createAppParams%%Receiver_length#1: uint64 = 0u + let createAppParams%%Amount_length#1: uint64 = 0u + let createAppParams%%CloseRemainderTo_length#1: uint64 = 0u + let createAppParams%%VotePK_length#1: uint64 = 0u + let createAppParams%%SelectionPK_length#1: uint64 = 0u + let createAppParams%%VoteFirst_length#1: uint64 = 0u + let createAppParams%%VoteLast_length#1: uint64 = 0u + let createAppParams%%VoteKeyDilution_length#1: uint64 = 0u + let createAppParams%%Type_length#1: uint64 = 0u + let createAppParams%%TypeEnum_length#1: uint64 = 0u + let createAppParams%%XferAsset_length#1: uint64 = 0u + let createAppParams%%AssetAmount_length#1: uint64 = 0u + let createAppParams%%AssetSender_length#1: uint64 = 0u + let createAppParams%%AssetReceiver_length#1: uint64 = 0u + let createAppParams%%AssetCloseTo_length#1: uint64 = 0u + let createAppParams%%ApplicationID_length#1: uint64 = 0u + let createAppParams%%OnCompletion_length#1: uint64 = 0u + let createAppParams%%RekeyTo_length#1: uint64 = 0u + let createAppParams%%ConfigAsset_length#1: uint64 = 0u + let createAppParams%%ConfigAssetTotal_length#1: uint64 = 0u + let createAppParams%%ConfigAssetDecimals_length#1: uint64 = 0u + let createAppParams%%ConfigAssetDefaultFrozen_length#1: uint64 = 0u + let createAppParams%%ConfigAssetUnitName_length#1: uint64 = 0u + let createAppParams%%ConfigAssetName_length#1: uint64 = 0u + let createAppParams%%ConfigAssetURL_length#1: uint64 = 0u + let createAppParams%%ConfigAssetMetadataHash_length#1: uint64 = 0u + let createAppParams%%ConfigAssetManager_length#1: uint64 = 0u + let createAppParams%%ConfigAssetReserve_length#1: uint64 = 0u + let createAppParams%%ConfigAssetFreeze_length#1: uint64 = 0u + let createAppParams%%ConfigAssetClawback_length#1: uint64 = 0u + let createAppParams%%FreezeAsset_length#1: uint64 = 0u + let createAppParams%%FreezeAssetAccount_length#1: uint64 = 0u + let createAppParams%%FreezeAssetFrozen_length#1: uint64 = 0u + let createAppParams%%GlobalNumUint_length#1: uint64 = 0u + let createAppParams%%GlobalNumByteSlice_length#1: uint64 = 0u + let createAppParams%%LocalNumUint_length#1: uint64 = 0u + let createAppParams%%LocalNumByteSlice_length#1: uint64 = 0u + let createAppParams%%ExtraProgramPages_length#1: uint64 = 0u + let createAppParams%%Nonparticipation_length#1: uint64 = 0u + let createAppParams%%StateProofPK_length#1: uint64 = 0u + let createAppParams%%Accounts_length#1: uint64 = 0u + let createAppParams%%Assets_length#1: uint64 = 0u + let createAppParams%%Applications_length#1: uint64 = 0u + let createAppParams%%ApprovalProgramPages_length#1: uint64 = 0u + let createAppParams%%ClearStateProgramPages_length#1: uint64 = 0u + goto block@3 + block@3: // after_if_else_L77 + let createAppParams%%param_Note_idx_0#2: bytes = φ(createAppParams%%param_Note_idx_0#0 <- block@1, createAppParams%%param_Note_idx_0#1 <- block@2) + let createAppParams%%OnCompletion_length#2: uint64 = φ(createAppParams%%OnCompletion_length#0 <- block@1, createAppParams%%OnCompletion_length#1 <- block@2) + let createAppParams%%param_OnCompletion_idx_0#1: uint64 = φ(createAppParams%%param_OnCompletion_idx_0#0 <- block@1, createAppParams%%param_OnCompletion_idx_0#2 <- block@2) + let createAppParams%%param_ApplicationArgs_idx_0#3: bytes = φ(createAppParams%%param_ApplicationArgs_idx_0#0 <- block@1, createAppParams%%param_ApplicationArgs_idx_0#1 <- block@2) + let createAppParams%%param_ApplicationArgs_idx_1#3: bytes = φ(createAppParams%%param_ApplicationArgs_idx_1#0 <- block@1, createAppParams%%param_ApplicationArgs_idx_1#1 <- block@2) + let createAppParams%%ApplicationArgs_length#3: uint64 = φ(createAppParams%%ApplicationArgs_length#0 <- block@1, createAppParams%%ApplicationArgs_length#1 <- block@2) + let createAppParams%%param_ApplicationArgs_idx_2#2: bytes = φ(createAppParams%%param_ApplicationArgs_idx_2#3 <- block@1, createAppParams%%param_ApplicationArgs_idx_2#0 <- block@2) + let createAppParams%%param_ClearStateProgram_idx_0#4: bytes = φ(createAppParams%%param_ClearStateProgram_idx_0#0 <- block@1, createAppParams%%param_ClearStateProgram_idx_0#1 <- block@2) + let createAppParams%%param_ApprovalProgram_idx_0#4: bytes = φ(createAppParams%%param_ApprovalProgram_idx_0#0 <- block@1, createAppParams%%param_ApprovalProgram_idx_0#1 <- block@2) + let createAppParams%%param_Fee_idx_0#4: uint64 = φ(createAppParams%%param_Fee_idx_0#0 <- block@1, createAppParams%%param_Fee_idx_0#1 <- block@2) + itxn_begin + ((itxn_field Note) createAppParams%%param_Note_idx_0#2) + let is_OnCompletion_count_gte_1%0#0: bool = (>= createAppParams%%OnCompletion_length#2 1u) + goto is_OnCompletion_count_gte_1%0#0 ? block@4 : block@5 + block@4: // set_OnCompletion_0_to_0_L94 + ((itxn_field OnCompletion) createAppParams%%param_OnCompletion_idx_0#1) + goto block@5 + block@5: // next_field_L94 + ((itxn_field ApplicationArgs) createAppParams%%param_ApplicationArgs_idx_0#3) + ((itxn_field ApplicationArgs) createAppParams%%param_ApplicationArgs_idx_1#3) + let is_ApplicationArgs_count_gte_3%0#0: bool = (>= createAppParams%%ApplicationArgs_length#3 3u) + goto is_ApplicationArgs_count_gte_3%0#0 ? block@6 : block@7 + block@6: // set_ApplicationArgs_2_to_2_L94 + ((itxn_field ApplicationArgs) createAppParams%%param_ApplicationArgs_idx_2#2) + goto block@7 + block@7: // next_field_L94 + ((itxn_field ClearStateProgram) createAppParams%%param_ClearStateProgram_idx_0#4) + ((itxn_field ApprovalProgram) createAppParams%%param_ApprovalProgram_idx_0#4) + ((itxn_field Fee) createAppParams%%param_Fee_idx_0#4) + goto block@8 + block@8: // next_txn_L94 + itxn_submit + let createAppTxn#0: itxn_group_idx = itxn_group_idx(0) + let createAppTxn._is_last#0: bool = 1u + let createAppTxn.Sender#0: bytes = itxn[createAppTxn#0].Sender + let createAppTxn.Fee#0: uint64 = itxn[createAppTxn#0].Fee + let createAppTxn.FirstValid#0: uint64 = itxn[createAppTxn#0].FirstValid + let createAppTxn.FirstValidTime#0: uint64 = itxn[createAppTxn#0].FirstValidTime + let createAppTxn.LastValid#0: uint64 = itxn[createAppTxn#0].LastValid + let createAppTxn.Note#0: bytes = itxn[createAppTxn#0].Note + let createAppTxn.Lease#0: bytes = itxn[createAppTxn#0].Lease + let createAppTxn.Receiver#0: bytes = itxn[createAppTxn#0].Receiver + let createAppTxn.Amount#0: uint64 = itxn[createAppTxn#0].Amount + let createAppTxn.CloseRemainderTo#0: bytes = itxn[createAppTxn#0].CloseRemainderTo + let createAppTxn.VotePK#0: bytes = itxn[createAppTxn#0].VotePK + let createAppTxn.SelectionPK#0: bytes = itxn[createAppTxn#0].SelectionPK + let createAppTxn.VoteFirst#0: uint64 = itxn[createAppTxn#0].VoteFirst + let createAppTxn.VoteLast#0: uint64 = itxn[createAppTxn#0].VoteLast + let createAppTxn.VoteKeyDilution#0: uint64 = itxn[createAppTxn#0].VoteKeyDilution + let createAppTxn.Type#0: bytes = itxn[createAppTxn#0].Type + let createAppTxn.TypeEnum#0: uint64 = itxn[createAppTxn#0].TypeEnum + let createAppTxn.XferAsset#0: uint64 = itxn[createAppTxn#0].XferAsset + let createAppTxn.AssetAmount#0: uint64 = itxn[createAppTxn#0].AssetAmount + let createAppTxn.AssetSender#0: bytes = itxn[createAppTxn#0].AssetSender + let createAppTxn.AssetReceiver#0: bytes = itxn[createAppTxn#0].AssetReceiver + let createAppTxn.AssetCloseTo#0: bytes = itxn[createAppTxn#0].AssetCloseTo + let createAppTxn.GroupIndex#0: uint64 = itxn[createAppTxn#0].GroupIndex + let createAppTxn.TxID#0: bytes = itxn[createAppTxn#0].TxID + let createAppTxn.ApplicationID#0: uint64 = itxn[createAppTxn#0].ApplicationID + let createAppTxn.OnCompletion#0: uint64 = itxn[createAppTxn#0].OnCompletion + let createAppTxn.NumAppArgs#0: uint64 = itxn[createAppTxn#0].NumAppArgs + let createAppTxn.NumAccounts#0: uint64 = itxn[createAppTxn#0].NumAccounts + let createAppTxn.ApprovalProgram#0: bytes = itxn[createAppTxn#0].ApprovalProgram + let createAppTxn.ClearStateProgram#0: bytes = itxn[createAppTxn#0].ClearStateProgram + let createAppTxn.RekeyTo#0: bytes = itxn[createAppTxn#0].RekeyTo + let createAppTxn.ConfigAsset#0: uint64 = itxn[createAppTxn#0].ConfigAsset + let createAppTxn.ConfigAssetTotal#0: uint64 = itxn[createAppTxn#0].ConfigAssetTotal + let createAppTxn.ConfigAssetDecimals#0: uint64 = itxn[createAppTxn#0].ConfigAssetDecimals + let createAppTxn.ConfigAssetDefaultFrozen#0: bool = itxn[createAppTxn#0].ConfigAssetDefaultFrozen + let createAppTxn.ConfigAssetUnitName#0: bytes = itxn[createAppTxn#0].ConfigAssetUnitName + let createAppTxn.ConfigAssetName#0: bytes = itxn[createAppTxn#0].ConfigAssetName + let createAppTxn.ConfigAssetURL#0: bytes = itxn[createAppTxn#0].ConfigAssetURL + let createAppTxn.ConfigAssetMetadataHash#0: bytes = itxn[createAppTxn#0].ConfigAssetMetadataHash + let createAppTxn.ConfigAssetManager#0: bytes = itxn[createAppTxn#0].ConfigAssetManager + let createAppTxn.ConfigAssetReserve#0: bytes = itxn[createAppTxn#0].ConfigAssetReserve + let createAppTxn.ConfigAssetFreeze#0: bytes = itxn[createAppTxn#0].ConfigAssetFreeze + let createAppTxn.ConfigAssetClawback#0: bytes = itxn[createAppTxn#0].ConfigAssetClawback + let createAppTxn.FreezeAsset#0: uint64 = itxn[createAppTxn#0].FreezeAsset + let createAppTxn.FreezeAssetAccount#0: bytes = itxn[createAppTxn#0].FreezeAssetAccount + let createAppTxn.FreezeAssetFrozen#0: bool = itxn[createAppTxn#0].FreezeAssetFrozen + let createAppTxn.NumAssets#0: uint64 = itxn[createAppTxn#0].NumAssets + let createAppTxn.NumApplications#0: uint64 = itxn[createAppTxn#0].NumApplications + let createAppTxn.GlobalNumUint#0: uint64 = itxn[createAppTxn#0].GlobalNumUint + let createAppTxn.GlobalNumByteSlice#0: uint64 = itxn[createAppTxn#0].GlobalNumByteSlice + let createAppTxn.LocalNumUint#0: uint64 = itxn[createAppTxn#0].LocalNumUint + let createAppTxn.LocalNumByteSlice#0: uint64 = itxn[createAppTxn#0].LocalNumByteSlice + let createAppTxn.ExtraProgramPages#0: uint64 = itxn[createAppTxn#0].ExtraProgramPages + let createAppTxn.Nonparticipation#0: bool = itxn[createAppTxn#0].Nonparticipation + let createAppTxn.NumLogs#0: uint64 = itxn[createAppTxn#0].NumLogs + let createAppTxn.CreatedAssetID#0: uint64 = itxn[createAppTxn#0].CreatedAssetID + let createAppTxn.CreatedApplicationID#0: uint64 = itxn[createAppTxn#0].CreatedApplicationID + let createAppTxn.LastLog#0: bytes = itxn[createAppTxn#0].LastLog + let createAppTxn.StateProofPK#0: bytes = itxn[createAppTxn#0].StateProofPK + let createAppTxn.NumApprovalProgramPages#0: uint64 = itxn[createAppTxn#0].NumApprovalProgramPages + let createAppTxn.NumClearStateProgramPages#0: uint64 = itxn[createAppTxn#0].NumClearStateProgramPages + let tmp%0#0: bytes = itxn[createAppTxn#0].ApplicationArgs[0u] + let tmp%1#0: bool = (== tmp%0#0 "1") + (assert tmp%1#0) // correct args used 1 + let tmp%2#0: bytes = itxn[createAppTxn#0].ApplicationArgs[1u] + let tmp%3#0: bool = (== tmp%2#0 "2") + (assert tmp%3#0) // correct args used 2 + let tmp%4#0: bool = (== createAppTxn.Note#0 "with args param set") + (assert tmp%4#0) + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/itxn.awst b/tests/approvals/out/itxn/itxn.awst similarity index 76% rename from tests/approvals/out/itxn.awst rename to tests/approvals/out/itxn/itxn.awst index 0f1bdcf2..ee7459d8 100644 --- a/tests/approvals/out/itxn.awst +++ b/tests/approvals/out/itxn/itxn.awst @@ -1,16 +1,13 @@ -contract ItxnDemoContract extends @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract +contract ItxnDemoContract { globals { ["name"]: bytes } - constructor(): void - { - void - GlobalState["name"]: bytes = 0x - } - approvalProgram(): bool { + if (!Boolean(txn())) { + this.constructor() + } if (Boolean(txn())) { switch (txnas(0)) { case "test1": @@ -33,10 +30,15 @@ contract ItxnDemoContract extends @algorandfoundation/algorand-typescript/base-c return True } + clearProgram(): bool + { + return True + } + test1(): void { GlobalState["name"]: bytes = "AST1" - assetParams: inner_transaction_fields_acfg = create_inner_transaction(Fee=0, ConfigAssetName=GlobalState["name"], ConfigAssetDecimals=3, ConfigAssetManager=global(), ConfigAssetReserve=global(), ConfigAssetTotal=1000, ConfigAssetUnitName="unit") + assetParams: inner_transaction_fields_acfg = create_inner_transaction(Fee=0, ConfigAssetTotal=1000, ConfigAssetName=GlobalState["name"], ConfigAssetUnitName="unit", ConfigAssetDecimals=3, ConfigAssetManager=global(), ConfigAssetReserve=global()) GlobalState["name"]: bytes = "AST2" asset1_txn: inner_transaction_acfg = submit_txn(assetParams) update_inner_transaction(assetParams, ConfigAssetName=GlobalState["name"]) @@ -59,9 +61,9 @@ contract ItxnDemoContract extends @algorandfoundation/algorand-typescript/base-c { if (Boolean(txn())) { args: readonlytuple[bytes, bytes] = ["1", "2"] - createAppParams: inner_transaction_fields_appl = create_inner_transaction(Fee=0, ApplicationArgs=[args.0, args.1], ApprovalProgram=" ", ClearStateProgram=" ", Note="with args param set", OnCompletion=0) + createAppParams: inner_transaction_fields_appl = create_inner_transaction(Fee=0, ApprovalProgram=" ", ClearStateProgram=" ", ApplicationArgs=[args.0, args.1], OnCompletion=0, Note="with args param set") } else { - createAppParams: inner_transaction_fields_appl = create_inner_transaction(Fee=0, ApplicationArgs=["3", "4", "5"], ApprovalProgram=" ", ClearStateProgram=" ", Note="no args param set") + createAppParams: inner_transaction_fields_appl = create_inner_transaction(Fee=0, ApprovalProgram=" ", ClearStateProgram=" ", ApplicationArgs=["3", "4", "5"], Note="no args param set") } createAppTxn: inner_transaction_appl = submit_txn(createAppParams) assert(createAppTxn.ApplicationArgs[0] == "1") @@ -69,4 +71,15 @@ contract ItxnDemoContract extends @algorandfoundation/algorand-typescript/base-c assert(createAppTxn.Note == "with args param set") } + constructor(): void + { + void + GlobalState["name"]: bytes = 0x + } + + Contract::constructor(): void + { + this.constructor() + } + } \ No newline at end of file diff --git a/tests/approvals/out/itxn.awst.json b/tests/approvals/out/itxn/itxn.awst.json similarity index 82% rename from tests/approvals/out/itxn.awst.json rename to tests/approvals/out/itxn/itxn.awst.json index 4df75ed8..1a9d1611 100644 --- a/tests/approvals/out/itxn.awst.json +++ b/tests/approvals/out/itxn/itxn.awst.json @@ -1,162 +1,27 @@ [ { - "_type": "ContractFragment", + "_type": "Contract", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 7, - "end_line": 99, + "end_line": 7, "column": 0, - "end_column": 1 + "end_column": 52 }, "id": "tests/approvals/itxn.algo.ts::ItxnDemoContract", "name": "ItxnDemoContract", - "bases": [ + "description": null, + "method_resolution_order": [ "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 7, - "end_line": 99, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 7, - "end_line": 99, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 7, - "end_line": 99, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 7, - "end_line": 99, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 8, - "end_line": 8, - "column": 2, - "end_column": 47 - }, - "target": { - "_type": "AppStateExpression", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 8, - "end_line": 8, - "column": 2, - "end_column": 6 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 8, - "end_line": 8, - "column": 2, - "end_column": 6 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "ZeeX@", - "encoding": "utf8" - }, - "exists_assertion_message": null - }, - "value": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 8, - "end_line": 8, - "column": 37, - "end_column": 44 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "", - "encoding": "unknown" - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/itxn.algo.ts::ItxnDemoContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, "approval_program": { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 10, - "end_line": 25, + "end_line": 10, "column": 2, - "end_column": 3 + "end_column": 35 }, "args": [], "return_type": { @@ -169,30 +34,33 @@ "body": { "_type": "Block", "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 10, - "end_line": 25, - "column": 36, - "end_column": 3 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "body": [ { "_type": "IfElse", "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 11, - "end_line": 23, - "column": 4, - "end_column": 5 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "condition": { - "_type": "ReinterpretCast", + "_type": "Not", "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 11, - "end_line": 11, - "column": 8, - "end_column": 22 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "wtype": { "_type": "WType", @@ -202,40 +70,159 @@ "scalar_type": 2 }, "expr": { - "_type": "IntrinsicCall", + "_type": "ReinterpretCast", "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 11, - "end_line": 11, - "column": 8, - "end_column": 22 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "bool", "immutable": true, "ephemeral": false, "scalar_type": 2 }, - "op_code": "txn", - "immediates": [ - "NumAppArgs" - ], - "stack_args": [], - "comment": null + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } } }, "if_branch": { "_type": "Block", "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 11, - "end_line": 23, - "column": 24, - "end_column": 5 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "body": [ { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 10, + "end_line": 25, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 11, + "end_line": 11, + "column": 4, + "end_column": 23 + }, + "condition": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 11, + "end_line": 11, + "column": 8, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 11, + "end_line": 11, + "column": 8, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "NumAppArgs" + ], + "stack_args": [], + "comment": null + } + }, + "if_branch": { "_type": "Block", "source_location": { "file": "tests/approvals/itxn.algo.ts", @@ -249,14 +236,14 @@ "_type": "Block", "source_location": { "file": "tests/approvals/itxn.algo.ts", - "line": 12, - "end_line": 22, - "column": 6, - "end_column": 7 + "line": 11, + "end_line": 23, + "column": 24, + "end_column": 5 }, "body": [ { - "_type": "Switch", + "_type": "Block", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 12, @@ -264,59 +251,24 @@ "column": 6, "end_column": 7 }, - "value": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 12, - "end_line": 12, - "column": 14, - "end_column": 36 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "op_code": "txnas", - "immediates": [ - "ApplicationArgs" - ], - "stack_args": [ - { - "_type": "IntegerConstant", + "body": [ + { + "_type": "Switch", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 12, + "end_line": 22, + "column": 6, + "end_column": 7 + }, + "value": { + "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 12, "end_line": 12, - "column": 34, - "end_column": 35 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "0", - "teal_alias": null - } - ], - "comment": null - }, - "cases": [ - [ - { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 13, - "end_line": 13, - "column": 19, - "end_column": 26 + "column": 14, + "end_column": 36 }, "wtype": { "_type": "WType", @@ -325,216 +277,238 @@ "ephemeral": false, "scalar_type": 1 }, - "value": "bY*jNF#", - "encoding": "utf8" - }, - { - "_type": "Block", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 13, - "end_line": 15, - "column": 8, - "end_column": 15 - }, - "body": [ + "op_code": "txnas", + "immediates": [ + "ApplicationArgs" + ], + "stack_args": [ { - "_type": "Block", + "_type": "IntegerConstant", "source_location": { "file": "tests/approvals/itxn.algo.ts", - "line": 13, - "end_line": 15, - "column": 8, - "end_column": 15 + "line": 12, + "end_line": 12, + "column": 34, + "end_column": 35 }, - "body": [], - "label": "#switch₁ᶜ₀", - "comment": null - }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ], + "comment": null + }, + "cases": [ + [ { - "_type": "ExpressionStatement", + "_type": "BytesConstant", "source_location": { "file": "tests/approvals/itxn.algo.ts", - "line": 14, - "end_line": 14, - "column": 10, - "end_column": 22 + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 26 }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 14, - "end_line": 14, - "column": 10, - "end_column": 22 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "test1" - }, - "args": [] - } + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNF#", + "encoding": "utf8" }, { - "_type": "Goto", + "_type": "Block", "source_location": { "file": "tests/approvals/itxn.algo.ts", - "line": 15, + "line": 13, "end_line": 15, - "column": 10, + "column": 8, "end_column": 15 }, - "target": "#switch₁ᵇ" + "body": [ + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 13, + "end_line": 15, + "column": 8, + "end_column": 15 + }, + "body": [], + "label": "#switch₁ᶜ₀", + "comment": null + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 14, + "end_line": 14, + "column": 10, + "end_column": 22 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 14, + "end_line": 14, + "column": 10, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "test1" + }, + "args": [] + } + }, + { + "_type": "Goto", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 15, + "end_line": 15, + "column": 10, + "end_column": 15 + }, + "target": "#switch₁ᵇ" + } + ], + "label": null, + "comment": null } ], - "label": null, - "comment": null - } - ], - [ - { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 16, - "end_line": 16, - "column": 19, - "end_column": 26 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNG5", - "encoding": "utf8" - }, - { - "_type": "Block", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 16, - "end_line": 18, - "column": 8, - "end_column": 15 - }, - "body": [ + [ { - "_type": "Block", + "_type": "BytesConstant", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 16, - "end_line": 18, - "column": 8, - "end_column": 15 + "end_line": 16, + "column": 19, + "end_column": 26 }, - "body": [], - "label": "#switch₁ᶜ₁", - "comment": null - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 17, - "end_line": 17, - "column": 10, - "end_column": 22 + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 17, - "end_line": 17, - "column": 10, - "end_column": 22 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "test2" - }, - "args": [] - } + "value": "bY*jNG5", + "encoding": "utf8" }, { - "_type": "Goto", + "_type": "Block", "source_location": { "file": "tests/approvals/itxn.algo.ts", - "line": 18, + "line": 16, "end_line": 18, - "column": 10, + "column": 8, "end_column": 15 }, - "target": "#switch₁ᵇ" + "body": [ + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 16, + "end_line": 18, + "column": 8, + "end_column": 15 + }, + "body": [], + "label": "#switch₁ᶜ₁", + "comment": null + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 17, + "end_line": 17, + "column": 10, + "end_column": 22 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 17, + "end_line": 17, + "column": 10, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "test2" + }, + "args": [] + } + }, + { + "_type": "Goto", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 18, + "end_line": 18, + "column": 10, + "end_column": 15 + }, + "target": "#switch₁ᵇ" + } + ], + "label": null, + "comment": null } ], - "label": null, - "comment": null - } - ], - [ - { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 19, - "end_line": 19, - "column": 19, - "end_column": 26 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNGX", - "encoding": "utf8" - }, - { - "_type": "Block", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 19, - "end_line": 19, - "column": 8, - "end_column": 28 - }, - "body": [ + [ { - "_type": "Block", + "_type": "BytesConstant", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 19, "end_line": 19, - "column": 8, - "end_column": 28 + "column": 19, + "end_column": 26 }, - "body": [], - "label": "#switch₁ᶜ₂", - "comment": null + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNGX", + "encoding": "utf8" }, { - "_type": "Goto", + "_type": "Block", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 19, @@ -542,86 +516,113 @@ "column": 8, "end_column": 28 }, - "target": "#switch₁ᶜ₃" + "body": [ + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 19, + "end_line": 19, + "column": 8, + "end_column": 28 + }, + "body": [], + "label": "#switch₁ᶜ₂", + "comment": null + }, + { + "_type": "Goto", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 19, + "end_line": 19, + "column": 8, + "end_column": 28 + }, + "target": "#switch₁ᶜ₃" + } + ], + "label": null, + "comment": null } ], - "label": null, - "comment": null - } - ], - [ - { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 20, - "end_line": 20, - "column": 19, - "end_column": 26 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "bY*jNGy", - "encoding": "utf8" - }, - { - "_type": "Block", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 20, - "end_line": 21, - "column": 8, - "end_column": 15 - }, - "body": [ + [ { - "_type": "Block", + "_type": "BytesConstant", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 20, - "end_line": 21, - "column": 8, - "end_column": 15 + "end_line": 20, + "column": 19, + "end_column": 26 }, - "body": [], - "label": "#switch₁ᶜ₃", - "comment": null + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "bY*jNGy", + "encoding": "utf8" }, { - "_type": "Goto", + "_type": "Block", "source_location": { "file": "tests/approvals/itxn.algo.ts", - "line": 21, + "line": 20, "end_line": 21, - "column": 10, + "column": 8, "end_column": 15 }, - "target": "#switch₁ᵇ" + "body": [ + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 20, + "end_line": 21, + "column": 8, + "end_column": 15 + }, + "body": [], + "label": "#switch₁ᶜ₃", + "comment": null + }, + { + "_type": "Goto", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 21, + "end_line": 21, + "column": 10, + "end_column": 15 + }, + "target": "#switch₁ᵇ" + } + ], + "label": null, + "comment": null } - ], - "label": null, - "comment": null - } - ] + ] + ], + "default_case": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 12, + "end_line": 22, + "column": 6, + "end_column": 7 + }, + "body": [], + "label": "#switch₁ᵇ", + "comment": null + } ], - "default_case": null - }, - { - "_type": "Block", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 12, - "end_line": 22, - "column": 6, - "end_column": 7 - }, - "body": [], - "label": "#switch₁ᵇ", + "label": null, "comment": null } ], @@ -631,30 +632,103 @@ ], "label": null, "comment": null + }, + "else_branch": null + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 24, + "end_line": 24, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 24, + "end_line": 24, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true } - ], - "label": null, - "comment": null - }, - "else_branch": null - }, + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/itxn.algo.ts::ItxnDemoContract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ { "_type": "ReturnStatement", "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 24, - "end_line": 24, - "column": 4, - "end_column": 15 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "value": { "_type": "BoolConstant", "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 24, - "end_line": 24, - "column": 11, - "end_column": 15 + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 }, "wtype": { "_type": "WType", @@ -676,22 +750,19 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/itxn.algo.ts::ItxnDemoContract", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null }, - "clear_program": null, - "subroutines": [ + "methods": [ { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 27, - "end_line": 73, + "end_line": 27, "column": 2, - "end_column": 3 + "end_column": 17 }, "args": [], "return_type": { @@ -842,6 +913,25 @@ "value": "0", "teal_alias": null }, + "ConfigAssetTotal": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 31, + "end_line": 31, + "column": 13, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1000", + "teal_alias": null + }, "ConfigAssetName": { "_type": "AppStateExpression", "source_location": { @@ -879,6 +969,25 @@ }, "exists_assertion_message": "check GlobalState exists" }, + "ConfigAssetUnitName": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 33, + "end_line": 33, + "column": 16, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "b#7^N", + "encoding": "utf8" + }, "ConfigAssetDecimals": { "_type": "IntegerConstant", "source_location": { @@ -943,44 +1052,6 @@ ], "stack_args": [], "comment": null - }, - "ConfigAssetTotal": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 31, - "end_line": 31, - "column": 13, - "end_column": 17 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1000", - "teal_alias": null - }, - "ConfigAssetUnitName": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 33, - "end_line": 33, - "column": 16, - "end_column": 22 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "b#7^N", - "encoding": "utf8" } } } @@ -1558,7 +1629,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -1723,7 +1794,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2011,7 +2082,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2086,7 +2157,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2501,7 +2572,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2578,18 +2649,16 @@ }, "cref": "tests/approvals/itxn.algo.ts::ItxnDemoContract", "member_name": "test1", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true + "arc4_method_config": null }, { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 75, - "end_line": 98, + "end_line": 75, "column": 2, - "end_column": 3 + "end_column": 17 }, "args": [], "return_type": { @@ -2614,9 +2683,9 @@ "source_location": { "file": "tests/approvals/itxn.algo.ts", "line": 77, - "end_line": 93, + "end_line": 77, "column": 4, - "end_column": 5 + "end_column": 23 }, "condition": { "_type": "ReinterpretCast", @@ -2698,7 +2767,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2732,7 +2801,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2860,6 +2929,44 @@ "value": "0", "teal_alias": null }, + "ApprovalProgram": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 5, + "end_line": 5, + "column": 22, + "end_column": 36 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "3BrK^", + "encoding": "utf8" + }, + "ClearStateProgram": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 5, + "end_line": 5, + "column": 22, + "end_column": 36 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "3BrK^", + "encoding": "utf8" + }, "ApplicationArgs": { "_type": "TupleExpression", "source_location": { @@ -2871,7 +2978,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2920,7 +3027,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2972,7 +3079,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -2999,81 +3106,43 @@ } ] }, - "ApprovalProgram": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 5, - "end_line": 5, - "column": 22, - "end_column": 36 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "3BrK^", - "encoding": "utf8" - }, - "ClearStateProgram": { - "_type": "BytesConstant", + "OnCompletion": { + "_type": "IntegerConstant", "source_location": { "file": "tests/approvals/itxn.algo.ts", - "line": 5, - "end_line": 5, + "line": 83, + "end_line": 83, "column": 22, - "end_column": 36 + "end_column": 43 }, "wtype": { "_type": "WType", - "name": "bytes", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, - "value": "3BrK^", - "encoding": "utf8" + "value": "0", + "teal_alias": null }, "Note": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 84, - "end_line": 84, - "column": 14, - "end_column": 35 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "cWHEJAYpQ6b0BbGa$#*Cb7gb", - "encoding": "utf8" - }, - "OnCompletion": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 83, - "end_line": 83, - "column": 22, - "end_column": 43 + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 84, + "end_line": 84, + "column": 14, + "end_column": 35 }, "wtype": { "_type": "WType", - "name": "uint64", + "name": "bytes", "immutable": true, "ephemeral": false, - "scalar_type": 2 + "scalar_type": 1 }, - "value": "0", - "teal_alias": null + "value": "cWHEJAYpQ6b0BbGa$#*Cb7gb", + "encoding": "utf8" } } } @@ -3171,6 +3240,44 @@ "value": "0", "teal_alias": null }, + "ApprovalProgram": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 5, + "end_line": 5, + "column": 22, + "end_column": 36 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "3BrK^", + "encoding": "utf8" + }, + "ClearStateProgram": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 5, + "end_line": 5, + "column": 22, + "end_column": 36 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "3BrK^", + "encoding": "utf8" + }, "ApplicationArgs": { "_type": "TupleExpression", "source_location": { @@ -3182,7 +3289,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "tuple", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -3270,44 +3377,6 @@ } ] }, - "ApprovalProgram": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 5, - "end_line": 5, - "column": 22, - "end_column": 36 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "3BrK^", - "encoding": "utf8" - }, - "ClearStateProgram": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/itxn.algo.ts", - "line": 5, - "end_line": 5, - "column": 22, - "end_column": 36 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "3BrK^", - "encoding": "utf8" - }, "Note": { "_type": "BytesConstant", "source_location": { @@ -3776,13 +3845,222 @@ }, "cref": "tests/approvals/itxn.algo.ts::ItxnDemoContract", "member_name": "test2", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 52 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 52 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 52 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 52 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 8, + "end_line": 8, + "column": 2, + "end_column": 47 + }, + "target": { + "_type": "AppStateExpression", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 8, + "end_line": 8, + "column": 2, + "end_column": 6 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 8, + "end_line": 8, + "column": 2, + "end_column": 6 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "ZeeX@", + "encoding": "utf8" + }, + "exists_assertion_message": null + }, + "value": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/itxn.algo.ts", + "line": 8, + "end_line": 8, + "column": 37, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "unknown" + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/itxn.algo.ts::ItxnDemoContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null } ], - "app_state": { - "name": { + "app_state": [ + { "_type": "AppStorageDefinition", "source_location": { "file": "tests/approvals/itxn.algo.ts", @@ -3822,14 +4100,13 @@ }, "description": null } - }, - "reserved_scratch_space": [], + ], "state_totals": { "globalBytes": null, "globalUints": null, "localBytes": null, "localUints": null }, - "docstring": null + "reserved_scratch_space": [] } ] \ No newline at end of file diff --git a/tests/approvals/out/local-state/LocalStateDemo.arc32.json b/tests/approvals/out/local-state/LocalStateDemo.arc32.json new file mode 100644 index 00000000..33f8f919 --- /dev/null +++ b/tests/approvals/out/local-state/LocalStateDemo.arc32.json @@ -0,0 +1,148 @@ +{ + "hints": { + "setState((uint64,byte[]),uint64[10])void": { + "call_config": { + "no_op": "CALL" + }, + "structs": { + "__0": { + "name": "", + "elements": [ + [ + "a", + "uint64" + ], + [ + "b", + "byte[]" + ] + ] + } + } + }, + "getState()(uint64,uint64,byte[],byte[],uint64[10])": { + "call_config": { + "no_op": "CALL" + }, + "structs": { + "output": { + "name": "", + "elements": [ + [ + "localUint", + "uint64" + ], + [ + "localUint2", + "uint64" + ], + [ + "localBytes", + "byte[]" + ], + [ + "localBytes2", + "byte[]" + ], + [ + "localEncoded", + "uint64[10]" + ] + ] + } + } + }, + "clearState()void": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czo6TG9jYWxTdGF0ZURlbW8uYXBwcm92YWxQcm9ncmFtOgogICAgaW50Y2Jsb2NrIDAgMQogICAgYnl0ZWNibG9jayAibDEiICJsb2NhbFVpbnQyIiAiYjEiICJsb2NhbEJ5dGVzMiIgImxvY2FsRW5jb2RlZCIKICAgIGNhbGxzdWIgX19wdXlhX2FyYzRfcm91dGVyX18KICAgIHJldHVybgoKCi8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjpMb2NhbFN0YXRlRGVtby5fX3B1eWFfYXJjNF9yb3V0ZXJfXygpIC0+IHVpbnQ2NDoKX19wdXlhX2FyYzRfcm91dGVyX186CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czo3CiAgICAvLyBleHBvcnQgY2xhc3MgTG9jYWxTdGF0ZURlbW8gZXh0ZW5kcyBDb250cmFjdCB7CiAgICBwcm90byAwIDEKICAgIHR4biBOdW1BcHBBcmdzCiAgICBieiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19iYXJlX3JvdXRpbmdANwogICAgcHVzaGJ5dGVzcyAweGFhZWZjYjQzIDB4Njc4MTZjYzUgMHgxMTE3MDUzNCAvLyBtZXRob2QgInNldFN0YXRlKCh1aW50NjQsYnl0ZVtdKSx1aW50NjRbMTBdKXZvaWQiLCBtZXRob2QgImdldFN0YXRlKCkodWludDY0LHVpbnQ2NCxieXRlW10sYnl0ZVtdLHVpbnQ2NFsxMF0pIiwgbWV0aG9kICJjbGVhclN0YXRlKCl2b2lkIgogICAgdHhuYSBBcHBsaWNhdGlvbkFyZ3MgMAogICAgbWF0Y2ggX19wdXlhX2FyYzRfcm91dGVyX19fc2V0U3RhdGVfcm91dGVAMiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19nZXRTdGF0ZV9yb3V0ZUAzIF9fcHV5YV9hcmM0X3JvdXRlcl9fX2NsZWFyU3RhdGVfcm91dGVANAogICAgaW50Y18wIC8vIDAKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fc2V0U3RhdGVfcm91dGVAMjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjE0CiAgICAvLyBwdWJsaWMgc2V0U3RhdGUoeyBhLCBiIH06IHsgYTogdWludDY0OyBiOiBieXRlcyB9LCBjOiBTYW1wbGVBcnJheSkgewogICAgdHhuIE9uQ29tcGxldGlvbgogICAgIQogICAgYXNzZXJ0IC8vIE9uQ29tcGxldGlvbiBpcyBOb09wCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYXNzZXJ0IC8vIGlzIG5vdCBjcmVhdGluZwogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6NwogICAgLy8gZXhwb3J0IGNsYXNzIExvY2FsU3RhdGVEZW1vIGV4dGVuZHMgQ29udHJhY3QgewogICAgdHhuYSBBcHBsaWNhdGlvbkFyZ3MgMQogICAgZHVwCiAgICBleHRyYWN0IDAgOCAvLyBvbiBlcnJvcjogSW5kZXggYWNjZXNzIGlzIG91dCBvZiBib3VuZHMKICAgIGJ0b2kKICAgIGRpZyAxCiAgICBwdXNoaW50IDggLy8gOAogICAgZXh0cmFjdF91aW50MTYKICAgIGRpZyAyCiAgICBsZW4KICAgIHVuY292ZXIgMwogICAgY292ZXIgMgogICAgc3Vic3RyaW5nMwogICAgZXh0cmFjdCAyIDAKICAgIHR4bmEgQXBwbGljYXRpb25BcmdzIDIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjE0CiAgICAvLyBwdWJsaWMgc2V0U3RhdGUoeyBhLCBiIH06IHsgYTogdWludDY0OyBiOiBieXRlcyB9LCBjOiBTYW1wbGVBcnJheSkgewogICAgY2FsbHN1YiBzZXRTdGF0ZQogICAgaW50Y18xIC8vIDEKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fZ2V0U3RhdGVfcm91dGVAMzoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjIyCiAgICAvLyBwdWJsaWMgZ2V0U3RhdGUoKSB7CiAgICB0eG4gT25Db21wbGV0aW9uCiAgICAhCiAgICBhc3NlcnQgLy8gT25Db21wbGV0aW9uIGlzIE5vT3AKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBhc3NlcnQgLy8gaXMgbm90IGNyZWF0aW5nCiAgICBjYWxsc3ViIGdldFN0YXRlCiAgICB1bmNvdmVyIDQKICAgIGl0b2IKICAgIHVuY292ZXIgNAogICAgaXRvYgogICAgZGlnIDQKICAgIGxlbgogICAgaXRvYgogICAgZXh0cmFjdCA2IDIKICAgIHVuY292ZXIgNQogICAgY29uY2F0CiAgICBkaWcgNAogICAgbGVuCiAgICBpdG9iCiAgICBleHRyYWN0IDYgMgogICAgdW5jb3ZlciA1CiAgICBjb25jYXQKICAgIHVuY292ZXIgMwogICAgdW5jb3ZlciAzCiAgICBjb25jYXQKICAgIHB1c2hieXRlcyAweDAwNjQKICAgIGNvbmNhdAogICAgZGlnIDIKICAgIGxlbgogICAgcHVzaGludCAxMDAgLy8gMTAwCiAgICArCiAgICBpdG9iCiAgICBleHRyYWN0IDYgMgogICAgY29uY2F0CiAgICB1bmNvdmVyIDMKICAgIGNvbmNhdAogICAgdW5jb3ZlciAyCiAgICBjb25jYXQKICAgIHN3YXAKICAgIGNvbmNhdAogICAgcHVzaGJ5dGVzIDB4MTUxZjdjNzUKICAgIHN3YXAKICAgIGNvbmNhdAogICAgbG9nCiAgICBpbnRjXzEgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19jbGVhclN0YXRlX3JvdXRlQDQ6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czozMgogICAgLy8gcHVibGljIGNsZWFyU3RhdGUoKSB7CiAgICB0eG4gT25Db21wbGV0aW9uCiAgICAhCiAgICBhc3NlcnQgLy8gT25Db21wbGV0aW9uIGlzIE5vT3AKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBhc3NlcnQgLy8gaXMgbm90IGNyZWF0aW5nCiAgICBjYWxsc3ViIGNsZWFyU3RhdGUKICAgIGludGNfMSAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2JhcmVfcm91dGluZ0A3OgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6NwogICAgLy8gZXhwb3J0IGNsYXNzIExvY2FsU3RhdGVEZW1vIGV4dGVuZHMgQ29udHJhY3QgewogICAgdHhuIE9uQ29tcGxldGlvbgogICAgYm56IF9fcHV5YV9hcmM0X3JvdXRlcl9fX2FmdGVyX2lmX2Vsc2VAMTEKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICAhCiAgICBhc3NlcnQgLy8gaXMgY3JlYXRpbmcKICAgIGludGNfMSAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2FmdGVyX2lmX2Vsc2VAMTE6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czo3CiAgICAvLyBleHBvcnQgY2xhc3MgTG9jYWxTdGF0ZURlbW8gZXh0ZW5kcyBDb250cmFjdCB7CiAgICBpbnRjXzAgLy8gMAogICAgcmV0c3ViCgoKLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6OkxvY2FsU3RhdGVEZW1vLnNldFN0YXRlKHAuYTogdWludDY0LCBwLmI6IGJ5dGVzLCBjOiBieXRlcykgLT4gdm9pZDoKc2V0U3RhdGU6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoxNAogICAgLy8gcHVibGljIHNldFN0YXRlKHsgYSwgYiB9OiB7IGE6IHVpbnQ2NDsgYjogYnl0ZXMgfSwgYzogU2FtcGxlQXJyYXkpIHsKICAgIHByb3RvIDMgMAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MTUKICAgIC8vIHRoaXMubG9jYWxVaW50KFR4bi5zZW5kZXIpLnZhbHVlID0gYQogICAgdHhuIFNlbmRlcgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6OAogICAgLy8gbG9jYWxVaW50ID0gTG9jYWxTdGF0ZTx1aW50NjQ+KHsga2V5OiAnbDEnIH0pCiAgICBieXRlY18wIC8vICJsMSIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjE1CiAgICAvLyB0aGlzLmxvY2FsVWludChUeG4uc2VuZGVyKS52YWx1ZSA9IGEKICAgIGZyYW1lX2RpZyAtMwogICAgYXBwX2xvY2FsX3B1dAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MTYKICAgIC8vIHRoaXMubG9jYWxVaW50MihUeG4uc2VuZGVyKS52YWx1ZSA9IGEKICAgIHR4biBTZW5kZXIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjkKICAgIC8vIGxvY2FsVWludDIgPSBMb2NhbFN0YXRlPHVpbnQ2ND4oKQogICAgYnl0ZWNfMSAvLyAibG9jYWxVaW50MiIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjE2CiAgICAvLyB0aGlzLmxvY2FsVWludDIoVHhuLnNlbmRlcikudmFsdWUgPSBhCiAgICBmcmFtZV9kaWcgLTMKICAgIGFwcF9sb2NhbF9wdXQKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjE3CiAgICAvLyB0aGlzLmxvY2FsQnl0ZXMoVHhuLnNlbmRlcikudmFsdWUgPSBiCiAgICB0eG4gU2VuZGVyCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoxMAogICAgLy8gbG9jYWxCeXRlcyA9IExvY2FsU3RhdGU8Ynl0ZXM+KHsga2V5OiAnYjEnIH0pCiAgICBieXRlY18yIC8vICJiMSIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjE3CiAgICAvLyB0aGlzLmxvY2FsQnl0ZXMoVHhuLnNlbmRlcikudmFsdWUgPSBiCiAgICBmcmFtZV9kaWcgLTIKICAgIGFwcF9sb2NhbF9wdXQKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjE4CiAgICAvLyB0aGlzLmxvY2FsQnl0ZXMyKFR4bi5zZW5kZXIpLnZhbHVlID0gYgogICAgdHhuIFNlbmRlcgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MTEKICAgIC8vIGxvY2FsQnl0ZXMyID0gTG9jYWxTdGF0ZTxieXRlcz4oKQogICAgYnl0ZWNfMyAvLyAibG9jYWxCeXRlczIiCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoxOAogICAgLy8gdGhpcy5sb2NhbEJ5dGVzMihUeG4uc2VuZGVyKS52YWx1ZSA9IGIKICAgIGZyYW1lX2RpZyAtMgogICAgYXBwX2xvY2FsX3B1dAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MTkKICAgIC8vIHRoaXMubG9jYWxFbmNvZGVkKFR4bi5zZW5kZXIpLnZhbHVlID0gYy5jb3B5KCkKICAgIHR4biBTZW5kZXIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjEyCiAgICAvLyBsb2NhbEVuY29kZWQgPSBMb2NhbFN0YXRlPFNhbXBsZUFycmF5PigpCiAgICBieXRlYyA0IC8vICJsb2NhbEVuY29kZWQiCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoxOQogICAgLy8gdGhpcy5sb2NhbEVuY29kZWQoVHhuLnNlbmRlcikudmFsdWUgPSBjLmNvcHkoKQogICAgZnJhbWVfZGlnIC0xCiAgICBhcHBfbG9jYWxfcHV0CiAgICByZXRzdWIKCgovLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czo6TG9jYWxTdGF0ZURlbW8uZ2V0U3RhdGUoKSAtPiB1aW50NjQsIHVpbnQ2NCwgYnl0ZXMsIGJ5dGVzLCBieXRlczoKZ2V0U3RhdGU6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoyMgogICAgLy8gcHVibGljIGdldFN0YXRlKCkgewogICAgcHJvdG8gMCA1CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoyNAogICAgLy8gbG9jYWxVaW50OiB0aGlzLmxvY2FsVWludChUeG4uc2VuZGVyKS52YWx1ZSwKICAgIHR4biBTZW5kZXIKICAgIGludGNfMCAvLyAwCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czo4CiAgICAvLyBsb2NhbFVpbnQgPSBMb2NhbFN0YXRlPHVpbnQ2ND4oeyBrZXk6ICdsMScgfSkKICAgIGJ5dGVjXzAgLy8gImwxIgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MjQKICAgIC8vIGxvY2FsVWludDogdGhpcy5sb2NhbFVpbnQoVHhuLnNlbmRlcikudmFsdWUsCiAgICBhcHBfbG9jYWxfZ2V0X2V4CiAgICBhc3NlcnQgLy8gY2hlY2sgTG9jYWxTdGF0ZSBleGlzdHMKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjI1CiAgICAvLyBsb2NhbFVpbnQyOiB0aGlzLmxvY2FsVWludDIoVHhuLnNlbmRlcikudmFsdWUsCiAgICB0eG4gU2VuZGVyCiAgICBpbnRjXzAgLy8gMAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6OQogICAgLy8gbG9jYWxVaW50MiA9IExvY2FsU3RhdGU8dWludDY0PigpCiAgICBieXRlY18xIC8vICJsb2NhbFVpbnQyIgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MjUKICAgIC8vIGxvY2FsVWludDI6IHRoaXMubG9jYWxVaW50MihUeG4uc2VuZGVyKS52YWx1ZSwKICAgIGFwcF9sb2NhbF9nZXRfZXgKICAgIGFzc2VydCAvLyBjaGVjayBMb2NhbFN0YXRlIGV4aXN0cwogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MjYKICAgIC8vIGxvY2FsQnl0ZXM6IHRoaXMubG9jYWxCeXRlcyhUeG4uc2VuZGVyKS52YWx1ZSwKICAgIHR4biBTZW5kZXIKICAgIGludGNfMCAvLyAwCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoxMAogICAgLy8gbG9jYWxCeXRlcyA9IExvY2FsU3RhdGU8Ynl0ZXM+KHsga2V5OiAnYjEnIH0pCiAgICBieXRlY18yIC8vICJiMSIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjI2CiAgICAvLyBsb2NhbEJ5dGVzOiB0aGlzLmxvY2FsQnl0ZXMoVHhuLnNlbmRlcikudmFsdWUsCiAgICBhcHBfbG9jYWxfZ2V0X2V4CiAgICBhc3NlcnQgLy8gY2hlY2sgTG9jYWxTdGF0ZSBleGlzdHMKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjI3CiAgICAvLyBsb2NhbEJ5dGVzMjogdGhpcy5sb2NhbEJ5dGVzMihUeG4uc2VuZGVyKS52YWx1ZSwKICAgIHR4biBTZW5kZXIKICAgIGludGNfMCAvLyAwCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoxMQogICAgLy8gbG9jYWxCeXRlczIgPSBMb2NhbFN0YXRlPGJ5dGVzPigpCiAgICBieXRlY18zIC8vICJsb2NhbEJ5dGVzMiIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjI3CiAgICAvLyBsb2NhbEJ5dGVzMjogdGhpcy5sb2NhbEJ5dGVzMihUeG4uc2VuZGVyKS52YWx1ZSwKICAgIGFwcF9sb2NhbF9nZXRfZXgKICAgIGFzc2VydCAvLyBjaGVjayBMb2NhbFN0YXRlIGV4aXN0cwogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MjgKICAgIC8vIGxvY2FsRW5jb2RlZDogdGhpcy5sb2NhbEVuY29kZWQoVHhuLnNlbmRlcikudmFsdWUuY29weSgpLAogICAgdHhuIFNlbmRlcgogICAgaW50Y18wIC8vIDAKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjEyCiAgICAvLyBsb2NhbEVuY29kZWQgPSBMb2NhbFN0YXRlPFNhbXBsZUFycmF5PigpCiAgICBieXRlYyA0IC8vICJsb2NhbEVuY29kZWQiCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czoyOAogICAgLy8gbG9jYWxFbmNvZGVkOiB0aGlzLmxvY2FsRW5jb2RlZChUeG4uc2VuZGVyKS52YWx1ZS5jb3B5KCksCiAgICBhcHBfbG9jYWxfZ2V0X2V4CiAgICBhc3NlcnQgLy8gY2hlY2sgTG9jYWxTdGF0ZSBleGlzdHMKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjIzLTI5CiAgICAvLyByZXR1cm4gewogICAgLy8gICBsb2NhbFVpbnQ6IHRoaXMubG9jYWxVaW50KFR4bi5zZW5kZXIpLnZhbHVlLAogICAgLy8gICBsb2NhbFVpbnQyOiB0aGlzLmxvY2FsVWludDIoVHhuLnNlbmRlcikudmFsdWUsCiAgICAvLyAgIGxvY2FsQnl0ZXM6IHRoaXMubG9jYWxCeXRlcyhUeG4uc2VuZGVyKS52YWx1ZSwKICAgIC8vICAgbG9jYWxCeXRlczI6IHRoaXMubG9jYWxCeXRlczIoVHhuLnNlbmRlcikudmFsdWUsCiAgICAvLyAgIGxvY2FsRW5jb2RlZDogdGhpcy5sb2NhbEVuY29kZWQoVHhuLnNlbmRlcikudmFsdWUuY29weSgpLAogICAgLy8gfQogICAgcmV0c3ViCgoKLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6OkxvY2FsU3RhdGVEZW1vLmNsZWFyU3RhdGUoKSAtPiB2b2lkOgpjbGVhclN0YXRlOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MzIKICAgIC8vIHB1YmxpYyBjbGVhclN0YXRlKCkgewogICAgcHJvdG8gMCAwCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czozMwogICAgLy8gdGhpcy5sb2NhbFVpbnQoVHhuLnNlbmRlcikuZGVsZXRlKCkKICAgIHR4biBTZW5kZXIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjgKICAgIC8vIGxvY2FsVWludCA9IExvY2FsU3RhdGU8dWludDY0Pih7IGtleTogJ2wxJyB9KQogICAgYnl0ZWNfMCAvLyAibDEiCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czozMwogICAgLy8gdGhpcy5sb2NhbFVpbnQoVHhuLnNlbmRlcikuZGVsZXRlKCkKICAgIGFwcF9sb2NhbF9kZWwKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjM0CiAgICAvLyB0aGlzLmxvY2FsVWludDIoVHhuLnNlbmRlcikuZGVsZXRlKCkKICAgIHR4biBTZW5kZXIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjkKICAgIC8vIGxvY2FsVWludDIgPSBMb2NhbFN0YXRlPHVpbnQ2ND4oKQogICAgYnl0ZWNfMSAvLyAibG9jYWxVaW50MiIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjM0CiAgICAvLyB0aGlzLmxvY2FsVWludDIoVHhuLnNlbmRlcikuZGVsZXRlKCkKICAgIGFwcF9sb2NhbF9kZWwKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjM1CiAgICAvLyB0aGlzLmxvY2FsQnl0ZXMoVHhuLnNlbmRlcikuZGVsZXRlKCkKICAgIHR4biBTZW5kZXIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjEwCiAgICAvLyBsb2NhbEJ5dGVzID0gTG9jYWxTdGF0ZTxieXRlcz4oeyBrZXk6ICdiMScgfSkKICAgIGJ5dGVjXzIgLy8gImIxIgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MzUKICAgIC8vIHRoaXMubG9jYWxCeXRlcyhUeG4uc2VuZGVyKS5kZWxldGUoKQogICAgYXBwX2xvY2FsX2RlbAogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MzYKICAgIC8vIHRoaXMubG9jYWxCeXRlczIoVHhuLnNlbmRlcikuZGVsZXRlKCkKICAgIHR4biBTZW5kZXIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjExCiAgICAvLyBsb2NhbEJ5dGVzMiA9IExvY2FsU3RhdGU8Ynl0ZXM+KCkKICAgIGJ5dGVjXzMgLy8gImxvY2FsQnl0ZXMyIgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MzYKICAgIC8vIHRoaXMubG9jYWxCeXRlczIoVHhuLnNlbmRlcikuZGVsZXRlKCkKICAgIGFwcF9sb2NhbF9kZWwKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjM3CiAgICAvLyB0aGlzLmxvY2FsRW5jb2RlZChUeG4uc2VuZGVyKS5kZWxldGUoKQogICAgdHhuIFNlbmRlcgogICAgLy8gdGVzdHMvYXBwcm92YWxzL2xvY2FsLXN0YXRlLmFsZ28udHM6MTIKICAgIC8vIGxvY2FsRW5jb2RlZCA9IExvY2FsU3RhdGU8U2FtcGxlQXJyYXk+KCkKICAgIGJ5dGVjIDQgLy8gImxvY2FsRW5jb2RlZCIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9sb2NhbC1zdGF0ZS5hbGdvLnRzOjM3CiAgICAvLyB0aGlzLmxvY2FsRW5jb2RlZChUeG4uc2VuZGVyKS5kZWxldGUoKQogICAgYXBwX2xvY2FsX2RlbAogICAgcmV0c3ViCg==", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvbG9jYWwtc3RhdGUuYWxnby50czo6TG9jYWxTdGF0ZURlbW8uY2xlYXJTdGF0ZVByb2dyYW06CiAgICBwdXNoaW50IDEgLy8gMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 3, + "num_uints": 2 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "localBytes": { + "type": "bytes", + "key": "b1" + }, + "localBytes2": { + "type": "bytes", + "key": "localBytes2" + }, + "localEncoded": { + "type": "bytes", + "key": "localEncoded" + }, + "localUint": { + "type": "uint64", + "key": "l1" + }, + "localUint2": { + "type": "uint64", + "key": "localUint2" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "LocalStateDemo", + "methods": [ + { + "name": "setState", + "args": [ + { + "type": "(uint64,byte[])", + "name": "p" + }, + { + "type": "uint64[10]", + "name": "c" + } + ], + "readonly": false, + "returns": { + "type": "void" + } + }, + { + "name": "getState", + "args": [], + "readonly": false, + "returns": { + "type": "(uint64,uint64,byte[],byte[],uint64[10])" + } + }, + { + "name": "clearState", + "args": [], + "readonly": false, + "returns": { + "type": "void" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/local-state/LocalStateDemo.ssa.ir b/tests/approvals/out/local-state/LocalStateDemo.ssa.ir new file mode 100644 index 00000000..29758dcc --- /dev/null +++ b/tests/approvals/out/local-state/LocalStateDemo.ssa.ir @@ -0,0 +1,168 @@ +contract tests/approvals/local-state.algo.ts::LocalStateDemo: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/local-state.algo.ts::LocalStateDemo.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/local-state.algo.ts::LocalStateDemo.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/local-state.algo.ts::LocalStateDemo.constructor() -> void: + block@0: // L7 + return + + subroutine tests/approvals/local-state.algo.ts::LocalStateDemo.__puya_arc4_router__() -> bool: + block@0: // L7 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@7 + block@1: // abi_routing_L7 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "setState((uint64,byte[]),uint64[10])void" => block@2, method "getState()(uint64,uint64,byte[],byte[],uint64[10])" => block@3, method "clearState()void" => block@4, * => block@5} + block@2: // setState_route_L14 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // is not creating + let tmp%7#0: bytes = (txna ApplicationArgs 1) + let item0%0#0: bytes = (extract3 tmp%7#0 0u 8u) // on error: Index access is out of bounds + let item0%0%0#0: uint64 = (btoi item0%0#0) + let item_start_offset%0#0: uint64 = (extract_uint16 tmp%7#0 8u) + let item_end_offset%0#0: uint64 = (len tmp%7#0) + let item1%0#0: bytes = (substring3 tmp%7#0 item_start_offset%0#0 item_end_offset%0#0) + let item1%0%0#0: bytes = ((extract 2 0) item1%0#0) + let tmp%8#0: bytes = (txna ApplicationArgs 2) + tests/approvals/local-state.algo.ts::LocalStateDemo.setState(item0%0%0#0, item1%0%0#0, tmp%8#0) + return 1u + block@3: // getState_route_L22 + let tmp%9#0: uint64 = (txn OnCompletion) + let tmp%10#0: bool = (== tmp%9#0 NoOp) + (assert tmp%10#0) // OnCompletion is NoOp + let tmp%11#0: uint64 = (txn ApplicationID) + let tmp%12#0: bool = (!= tmp%11#0 0u) + (assert tmp%12#0) // is not creating + let (elements_to_encode%0#0: uint64, elements_to_encode%1#0: uint64, elements_to_encode%2#0: bytes, elements_to_encode%3#0: bytes, elements_to_encode%4#0: bytes) = tests/approvals/local-state.algo.ts::LocalStateDemo.getState() + let val_as_bytes%0#0: bytes = (itob elements_to_encode%0#0) + let val_as_bytes%1#0: bytes = (itob elements_to_encode%1#0) + let length%0#0: uint64 = (len elements_to_encode%2#0) + let as_bytes%0#0: bytes = (itob length%0#0) + let length_uint16%0#0: bytes = ((extract 6 2) as_bytes%0#0) + let encoded_value%0#0: bytes = (concat length_uint16%0#0 elements_to_encode%2#0) + let length%1#0: uint64 = (len elements_to_encode%3#0) + let as_bytes%1#0: bytes = (itob length%1#0) + let length_uint16%1#0: bytes = ((extract 6 2) as_bytes%1#0) + let encoded_value%1#0: bytes = (concat length_uint16%1#0 elements_to_encode%3#0) + let current_tail_offset%0#0: uint64 = 100u + let encoded_tuple_buffer%0#0: bytes = 0x + let encoded_tuple_buffer%1#0: bytes = (concat encoded_tuple_buffer%0#0 val_as_bytes%0#0) + let encoded_tuple_buffer%2#0: bytes = (concat encoded_tuple_buffer%1#0 val_as_bytes%1#0) + let as_bytes%2#0: bytes = (itob current_tail_offset%0#0) + let offset_as_uint16%0#0: bytes = ((extract 6 2) as_bytes%2#0) + let encoded_tuple_buffer%3#0: bytes = (concat encoded_tuple_buffer%2#0 offset_as_uint16%0#0) + let data_length%0#0: uint64 = (len encoded_value%0#0) + let current_tail_offset%1#0: uint64 = (+ current_tail_offset%0#0 data_length%0#0) + let as_bytes%3#0: bytes = (itob current_tail_offset%1#0) + let offset_as_uint16%1#0: bytes = ((extract 6 2) as_bytes%3#0) + let encoded_tuple_buffer%4#0: bytes = (concat encoded_tuple_buffer%3#0 offset_as_uint16%1#0) + let data_length%1#0: uint64 = (len encoded_value%1#0) + let current_tail_offset%2#0: uint64 = (+ current_tail_offset%1#0 data_length%1#0) + let encoded_tuple_buffer%5#0: bytes = (concat encoded_tuple_buffer%4#0 elements_to_encode%4#0) + let encoded_tuple_buffer%6#0: bytes = (concat encoded_tuple_buffer%5#0 encoded_value%0#0) + let encoded_tuple_buffer%7#0: bytes = (concat encoded_tuple_buffer%6#0 encoded_value%1#0) + let tmp%13#0: bytes = (concat 0x151f7c75 encoded_tuple_buffer%7#0) + (log tmp%13#0) + return 1u + block@4: // clearState_route_L32 + let tmp%14#0: uint64 = (txn OnCompletion) + let tmp%15#0: bool = (== tmp%14#0 NoOp) + (assert tmp%15#0) // OnCompletion is NoOp + let tmp%16#0: uint64 = (txn ApplicationID) + let tmp%17#0: bool = (!= tmp%16#0 0u) + (assert tmp%17#0) // is not creating + tests/approvals/local-state.algo.ts::LocalStateDemo.clearState() + return 1u + block@5: // switch_case_default_L7 + goto block@6 + block@6: // switch_case_next_L7 + goto block@11 + block@7: // bare_routing_L7 + let tmp%18#0: uint64 = (txn OnCompletion) + switch tmp%18#0 {0u => block@8, * => block@9} + block@8: // __algots__.defaultCreate_L7 + let tmp%19#0: uint64 = (txn ApplicationID) + let tmp%20#0: bool = (== tmp%19#0 0u) + (assert tmp%20#0) // is creating + tests/approvals/local-state.algo.ts::LocalStateDemo.__algots__.defaultCreate() + return 1u + block@9: // switch_case_default_L7 + goto block@10 + block@10: // switch_case_next_L7 + goto block@11 + block@11: // after_if_else_L7 + return 0u + + subroutine tests/approvals/local-state.algo.ts::LocalStateDemo.setState(p.a: uint64, p.b: bytes, c: bytes) -> void: + block@0: // L14 + let a#0: uint64 = p.a#0 + let b#0: bytes = p.b#0 + let tmp%0#0: bytes = (txn Sender) + (app_local_put tmp%0#0 "l1" a#0) + let tmp%1#0: bytes = (txn Sender) + (app_local_put tmp%1#0 "localUint2" a#0) + let tmp%2#0: bytes = (txn Sender) + (app_local_put tmp%2#0 "b1" b#0) + let tmp%3#0: bytes = (txn Sender) + (app_local_put tmp%3#0 "localBytes2" b#0) + let copy%0#0: bytes = c#0 + let tmp%4#0: bytes = (txn Sender) + (app_local_put tmp%4#0 "localEncoded" copy%0#0) + return + + subroutine tests/approvals/local-state.algo.ts::LocalStateDemo.getState() -> : + block@0: // L22 + let tmp%0#0: bytes = (txn Sender) + let (maybe_value%0#0: uint64, maybe_exists%0#0: bool) = (app_local_get_ex tmp%0#0 0u "l1") + (assert maybe_exists%0#0) // check LocalState exists + let tmp%1#0: bytes = (txn Sender) + let (maybe_value%1#0: uint64, maybe_exists%1#0: bool) = (app_local_get_ex tmp%1#0 0u "localUint2") + (assert maybe_exists%1#0) // check LocalState exists + let tmp%2#0: bytes = (txn Sender) + let (maybe_value%2#0: bytes, maybe_exists%2#0: bool) = (app_local_get_ex tmp%2#0 0u "b1") + (assert maybe_exists%2#0) // check LocalState exists + let tmp%3#0: bytes = (txn Sender) + let (maybe_value%3#0: bytes, maybe_exists%3#0: bool) = (app_local_get_ex tmp%3#0 0u "localBytes2") + (assert maybe_exists%3#0) // check LocalState exists + let tmp%4#0: bytes = (txn Sender) + let (maybe_value%4#0: bytes, maybe_exists%4#0: bool) = (app_local_get_ex tmp%4#0 0u "localEncoded") + (assert maybe_exists%4#0) // check LocalState exists + let copy%0#0: bytes = maybe_value%4#0 + return maybe_value%0#0 maybe_value%1#0 maybe_value%2#0 maybe_value%3#0 copy%0#0 + + subroutine tests/approvals/local-state.algo.ts::LocalStateDemo.clearState() -> void: + block@0: // L32 + let tmp%0#0: bytes = (txn Sender) + (app_local_del tmp%0#0 "l1") + let tmp%1#0: bytes = (txn Sender) + (app_local_del tmp%1#0 "localUint2") + let tmp%2#0: bytes = (txn Sender) + (app_local_del tmp%2#0 "b1") + let tmp%3#0: bytes = (txn Sender) + (app_local_del tmp%3#0 "localBytes2") + let tmp%4#0: bytes = (txn Sender) + (app_local_del tmp%4#0 "localEncoded") + return + + subroutine tests/approvals/local-state.algo.ts::LocalStateDemo.__algots__.defaultCreate() -> void: + block@0: // L7 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/local-state.awst b/tests/approvals/out/local-state/local-state.awst similarity index 50% rename from tests/approvals/out/local-state.awst rename to tests/approvals/out/local-state/local-state.awst index c10820fc..99a8f94b 100644 --- a/tests/approvals/out/local-state.awst +++ b/tests/approvals/out/local-state/local-state.awst @@ -1,4 +1,4 @@ -contract LocalStateDemo extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract +contract LocalStateDemo { globals { ["l1"]: uint64 @@ -7,14 +7,22 @@ contract LocalStateDemo extends @algorandfoundation/algorand-typescript/arc4/ind ["localBytes2"]: bytes ["localEncoded"]: arc4.static_array } - constructor(): void + approvalProgram(): bool { - void + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True } setState(): void { - [a, b]: readonlytuple[uint64, bytes] = p + { a: a, b: b }: { a: uint64, b: bytes } = p LocalState[txn()]["l1"]: uint64 = a LocalState[txn()]["localUint2"]: uint64 = a LocalState[txn()]["b1"]: bytes = b @@ -22,9 +30,9 @@ contract LocalStateDemo extends @algorandfoundation/algorand-typescript/arc4/ind LocalState[txn()]["localEncoded"]: arc4.static_array = copy(c) } - getState(): tuple[bytes, bytes, arc4.static_array, uint64, uint64] + getState(): { localUint: uint64, localUint2: uint64, localBytes: bytes, localBytes2: bytes, localEncoded: arc4.static_array } { - return [LocalState[txn()]["b1"], LocalState[txn()]["localBytes2"], copy(LocalState[txn()]["localEncoded"]), LocalState[txn()]["l1"], LocalState[txn()]["localUint2"]] + return { localUint: LocalState[txn()]["l1"], localUint2: LocalState[txn()]["localUint2"], localBytes: LocalState[txn()]["b1"], localBytes2: LocalState[txn()]["localBytes2"], localEncoded: copy(LocalState[txn()]["localEncoded"]) } } clearState(): void @@ -36,4 +44,22 @@ contract LocalStateDemo extends @algorandfoundation/algorand-typescript/arc4/ind STATE_DEL(LocalState[txn()]["localEncoded"]) } + constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + + __algots__.defaultCreate(): void + { + } + } \ No newline at end of file diff --git a/tests/approvals/out/local-state.awst.json b/tests/approvals/out/local-state/local-state.awst.json similarity index 82% rename from tests/approvals/out/local-state.awst.json rename to tests/approvals/out/local-state/local-state.awst.json index f478b839..16c2ef2f 100644 --- a/tests/approvals/out/local-state.awst.json +++ b/tests/approvals/out/local-state/local-state.awst.json @@ -1,71 +1,285 @@ [ { - "_type": "ContractFragment", + "_type": "Contract", "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 7, - "end_line": 39, + "end_line": 7, "column": 0, - "end_column": 1 + "end_column": 46 }, "id": "tests/approvals/local-state.algo.ts::LocalStateDemo", "name": "LocalStateDemo", - "bases": [ + "description": null, + "method_resolution_order": [ "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" ], - "init": { + "approval_program": { "_type": "ContractMethod", "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 7, - "end_line": 39, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "args": [], "return_type": { "_type": "WType", - "name": "void", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": null + "scalar_type": 2 }, "body": { "_type": "Block", "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 7, - "end_line": 39, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "body": [ { - "_type": "ExpressionStatement", + "_type": "IfElse", "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 7, - "end_line": 39, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, - "expr": { - "_type": "VoidConstant", + "condition": { + "_type": "Not", "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 7, - "end_line": 39, + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, "column": 0, "end_column": 1 }, "wtype": { "_type": "WType", - "name": "void", + "name": "bool", "immutable": true, "ephemeral": false, - "scalar_type": null + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true } } ], @@ -78,23 +292,19 @@ "args": {}, "returns": null }, - "cref": "tests/approvals/local-state.algo.ts::LocalStateDemo", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null }, - "approval_program": null, - "clear_program": null, - "subroutines": [ + "methods": [ { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 14, - "end_line": 20, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 68 }, "args": [ { @@ -102,8 +312,8 @@ "name": "p", "wtype": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ @@ -121,6 +331,10 @@ "ephemeral": false, "scalar_type": 1 } + ], + "names": [ + "a", + "b" ] }, "source_location": { @@ -140,7 +354,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -149,7 +364,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -206,9 +422,9 @@ "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 14, - "end_line": 20, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 68 }, "body": [ { @@ -216,9 +432,9 @@ "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 14, - "end_line": 20, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 68 }, "body": [ { @@ -241,7 +457,7 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "", "immutable": true, "ephemeral": false, "scalar_type": null, @@ -260,6 +476,10 @@ "ephemeral": false, "scalar_type": 1 } + ], + "names": [ + "a", + "b" ] }, "items": [ @@ -312,8 +532,8 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ @@ -331,6 +551,10 @@ "ephemeral": false, "scalar_type": 1 } + ], + "names": [ + "a", + "b" ] }, "name": "p" @@ -726,7 +950,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -735,7 +960,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -830,7 +1056,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -839,7 +1066,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -890,7 +1118,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -899,7 +1128,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -960,9 +1190,9 @@ "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 14, - "end_line": 20, + "end_line": 14, "column": 2, - "end_column": 3 + "end_column": 68 }, "name": "setState", "is_bare": false, @@ -972,28 +1202,54 @@ 0 ], "default_args": {}, - "structs": {} - }, - "synthetic": false, - "inheritable": true + "structs": { + "__0": { + "name": "", + "elements": [ + [ + "a", + "uint64" + ], + [ + "b", + "byte[]" + ] + ] + } + } + } }, { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 22, - "end_line": 30, + "end_line": 22, "column": 2, - "end_column": 3 + "end_column": 19 }, "args": [], "return_type": { "_type": "WTuple", - "name": "WTuple", - "immutable": false, + "name": "", + "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, { "_type": "WType", "name": "bytes", @@ -1014,7 +1270,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -1023,7 +1280,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -1058,21 +1316,14 @@ }, "source_location": null, "array_size": "10" - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 } + ], + "names": [ + "localUint", + "localUint2", + "localBytes", + "localBytes2", + "localEncoded" ] }, "body": { @@ -1105,11 +1356,25 @@ }, "wtype": { "_type": "WTuple", - "name": "WTuple", + "name": "", "immutable": true, "ephemeral": false, "scalar_type": null, "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, { "_type": "WType", "name": "bytes", @@ -1130,7 +1395,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -1139,7 +1405,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -1174,21 +1441,14 @@ }, "source_location": null, "array_size": "10" - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 } + ], + "names": [ + "localUint", + "localUint2", + "localBytes", + "localBytes2", + "localEncoded" ] }, "items": [ @@ -1196,24 +1456,24 @@ "_type": "AppAccountStateExpression", "source_location": { "file": "tests/approvals/local-state.algo.ts", - "line": 26, - "end_line": 26, - "column": 18, - "end_column": 51 + "line": 24, + "end_line": 24, + "column": 17, + "end_column": 49 }, "wtype": { "_type": "WType", - "name": "bytes", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, "key": { "_type": "BytesConstant", "source_location": { "file": "tests/approvals/local-state.algo.ts", - "line": 10, - "end_line": 10, + "line": 8, + "end_line": 8, "column": 40, "end_column": 44 }, @@ -1224,7 +1484,7 @@ "ephemeral": false, "scalar_type": 1 }, - "value": "Vle", + "value": "Y%u", "encoding": "utf8" }, "exists_assertion_message": "check LocalState exists", @@ -1232,10 +1492,10 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/local-state.algo.ts", - "line": 26, - "end_line": 26, - "column": 34, - "end_column": 44 + "line": 24, + "end_line": 24, + "column": 32, + "end_column": 42 }, "wtype": { "_type": "WType", @@ -1256,26 +1516,26 @@ "_type": "AppAccountStateExpression", "source_location": { "file": "tests/approvals/local-state.algo.ts", - "line": 27, - "end_line": 27, - "column": 19, - "end_column": 53 + "line": 25, + "end_line": 25, + "column": 18, + "end_column": 51 }, "wtype": { "_type": "WType", - "name": "bytes", + "name": "uint64", "immutable": true, "ephemeral": false, - "scalar_type": 1 + "scalar_type": 2 }, "key": { "_type": "BytesConstant", "source_location": { "file": "tests/approvals/local-state.algo.ts", - "line": 11, - "end_line": 11, + "line": 9, + "end_line": 9, "column": 2, - "end_column": 13 + "end_column": 12 }, "wtype": { "_type": "WType", @@ -1284,7 +1544,7 @@ "ephemeral": false, "scalar_type": 1 }, - "value": "Y;R*>Y(jZ-Wpgq", + "value": "Y;R*>Y*lG)bTR", "encoding": "utf8" }, "exists_assertion_message": "check LocalState exists", @@ -1292,10 +1552,10 @@ "_type": "IntrinsicCall", "source_location": { "file": "tests/approvals/local-state.algo.ts", - "line": 27, - "end_line": 27, - "column": 36, - "end_column": 46 + "line": 25, + "end_line": 25, + "column": 34, + "end_column": 44 }, "wtype": { "_type": "WType", @@ -1313,21 +1573,142 @@ } }, { - "_type": "Copy", + "_type": "AppAccountStateExpression", "source_location": { "file": "tests/approvals/local-state.algo.ts", - "line": 28, - "end_line": 28, - "column": 20, - "end_column": 62 - }, + "line": 26, + "end_line": 26, + "column": 18, + "end_column": 51 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 10, + "end_line": 10, + "column": 40, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Vle", + "encoding": "utf8" + }, + "exists_assertion_message": "check LocalState exists", + "account": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 26, + "end_line": 26, + "column": 34, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Sender" + ], + "stack_args": [], + "comment": null + } + }, + { + "_type": "AppAccountStateExpression", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 27, + "end_line": 27, + "column": 19, + "end_column": 53 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "key": { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 11, + "end_line": 11, + "column": 2, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "state_key", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Y;R*>Y(jZ-Wpgq", + "encoding": "utf8" + }, + "exists_assertion_message": "check LocalState exists", + "account": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 27, + "end_line": 27, + "column": 36, + "end_column": 46 + }, + "wtype": { + "_type": "WType", + "name": "account", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txn", + "immediates": [ + "Sender" + ], + "stack_args": [], + "comment": null + } + }, + { + "_type": "Copy", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 28, + "end_line": 28, + "column": 20, + "end_column": 62 + }, "wtype": { "_type": "ARC4StaticArray", "name": "arc4.static_array", "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -1336,7 +1717,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -1387,7 +1769,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -1396,7 +1779,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -1476,126 +1860,6 @@ "comment": null } } - }, - { - "_type": "AppAccountStateExpression", - "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 24, - "end_line": 24, - "column": 17, - "end_column": 49 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 8, - "end_line": 8, - "column": 40, - "end_column": 44 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "Y%u", - "encoding": "utf8" - }, - "exists_assertion_message": "check LocalState exists", - "account": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 24, - "end_line": 24, - "column": 32, - "end_column": 42 - }, - "wtype": { - "_type": "WType", - "name": "account", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "op_code": "txn", - "immediates": [ - "Sender" - ], - "stack_args": [], - "comment": null - } - }, - { - "_type": "AppAccountStateExpression", - "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 25, - "end_line": 25, - "column": 18, - "end_column": 51 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "key": { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 9, - "end_line": 9, - "column": 2, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "state_key", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "Y;R*>Y*lG)bTR", - "encoding": "utf8" - }, - "exists_assertion_message": "check LocalState exists", - "account": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/local-state.algo.ts", - "line": 25, - "end_line": 25, - "column": 34, - "end_column": 44 - }, - "wtype": { - "_type": "WType", - "name": "account", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "op_code": "txn", - "immediates": [ - "Sender" - ], - "stack_args": [], - "comment": null - } } ] } @@ -1617,9 +1881,9 @@ "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 22, - "end_line": 30, + "end_line": 22, "column": 2, - "end_column": 3 + "end_column": 19 }, "name": "getState", "is_bare": false, @@ -1629,19 +1893,43 @@ 0 ], "default_args": {}, - "structs": {} - }, - "synthetic": false, - "inheritable": true + "structs": { + "output": { + "name": "", + "elements": [ + [ + "localUint", + "uint64" + ], + [ + "localUint2", + "uint64" + ], + [ + "localBytes", + "byte[]" + ], + [ + "localBytes2", + "byte[]" + ], + [ + "localEncoded", + "uint64[10]" + ] + ] + } + } + } }, { "_type": "ContractMethod", "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 32, - "end_line": 38, + "end_line": 32, "column": 2, - "end_column": 3 + "end_column": 21 }, "args": [], "return_type": { @@ -2049,7 +2337,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -2058,7 +2347,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -2157,9 +2447,9 @@ "source_location": { "file": "tests/approvals/local-state.algo.ts", "line": 32, - "end_line": 38, + "end_line": 32, "column": 2, - "end_column": 3 + "end_column": 21 }, "name": "clearState", "is_bare": false, @@ -2170,13 +2460,252 @@ ], "default_args": {}, "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 46 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 46 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 46 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 46 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/local-state.algo.ts::LocalStateDemo", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 46 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 46 + }, + "body": [], + "label": null, + "comment": null }, - "synthetic": false, - "inheritable": true + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/local-state.algo.ts::LocalStateDemo", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/local-state.algo.ts", + "line": 7, + "end_line": 7, + "column": 0, + "end_column": 46 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } } ], - "app_state": { - "localUint": { + "app_state": [ + { "_type": "AppStorageDefinition", "source_location": { "file": "tests/approvals/local-state.algo.ts", @@ -2216,7 +2745,7 @@ }, "description": null }, - "localUint2": { + { "_type": "AppStorageDefinition", "source_location": { "file": "tests/approvals/local-state.algo.ts", @@ -2256,7 +2785,7 @@ }, "description": null }, - "localBytes": { + { "_type": "AppStorageDefinition", "source_location": { "file": "tests/approvals/local-state.algo.ts", @@ -2296,7 +2825,7 @@ }, "description": null }, - "localBytes2": { + { "_type": "AppStorageDefinition", "source_location": { "file": "tests/approvals/local-state.algo.ts", @@ -2336,7 +2865,7 @@ }, "description": null }, - "localEncoded": { + { "_type": "AppStorageDefinition", "source_location": { "file": "tests/approvals/local-state.algo.ts", @@ -2353,7 +2882,8 @@ "immutable": false, "ephemeral": false, "scalar_type": 1, - "decode_type": null, + "puya_type_name": "ARC4Type", + "native_type": null, "arc4_name": "uint64[10]", "other_encodeable_types": [], "element_type": { @@ -2362,7 +2892,8 @@ "immutable": true, "ephemeral": false, "scalar_type": 1, - "decode_type": { + "puya_type_name": "ARC4Type", + "native_type": { "_type": "WType", "name": "uint64", "immutable": true, @@ -2420,14 +2951,13 @@ }, "description": null } - }, - "reserved_scratch_space": [], + ], "state_totals": { "globalBytes": null, "globalUints": null, "localBytes": null, "localUints": null }, - "docstring": null + "reserved_scratch_space": [] } ] \ No newline at end of file diff --git a/tests/approvals/out/named-types.awst b/tests/approvals/out/named-types.awst deleted file mode 100644 index 28636479..00000000 --- a/tests/approvals/out/named-types.awst +++ /dev/null @@ -1,31 +0,0 @@ -contract MyContract extends @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract, @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract -{ - constructor(): void - { - void - } - - getXY(): tuple[uint64, uint64] - { - return [1, 2] - } - - getYX(): tuple[uint64, uint64] - { - return [222, 111] - } - - getAnon(): tuple[uint64, uint64] - { - return [3, 4] - } - - testing(): readonlytuple[tuple[uint64, uint64], tuple[uint64, uint64], tuple[uint64, uint64]] - { - a: tuple[uint64, uint64] = this.getXY() - b: tuple[uint64, uint64] = this.getYX() - c: tuple[uint64, uint64] = this.getAnon() - return [a, b, c] - } - -} \ No newline at end of file diff --git a/tests/approvals/out/named-types.awst.json b/tests/approvals/out/named-types.awst.json deleted file mode 100644 index aea00568..00000000 --- a/tests/approvals/out/named-types.awst.json +++ /dev/null @@ -1,1161 +0,0 @@ -[ - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 21, - "end_line": 49, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/named-types.algo.ts::MyContract", - "name": "MyContract", - "bases": [ - "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 21, - "end_line": 49, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 21, - "end_line": 49, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 21, - "end_line": 49, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 21, - "end_line": 49, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/named-types.algo.ts::MyContract", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": null, - "clear_program": null, - "subroutines": [ - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 22, - "end_line": 27, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 22, - "end_line": 27, - "column": 21, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 23, - "end_line": 26, - "column": 4, - "end_column": 5 - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 23, - "end_line": 26, - "column": 11, - "end_column": 5 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 24, - "end_line": 24, - "column": 9, - "end_column": 10 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - }, - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 25, - "end_line": 25, - "column": 9, - "end_column": 10 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "2", - "teal_alias": null - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/named-types.algo.ts::MyContract", - "member_name": "getXY", - "arc4_method_config": { - "_type": "ARC4ABIMethodConfig", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 22, - "end_line": 27, - "column": 2, - "end_column": 3 - }, - "name": "getXY", - "is_bare": false, - "create": 3, - "readonly": false, - "allowed_completion_types": [ - 0 - ], - "default_args": {}, - "structs": {} - }, - "synthetic": false, - "inheritable": true - }, - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 29, - "end_line": 34, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 29, - "end_line": 34, - "column": 21, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 30, - "end_line": 33, - "column": 4, - "end_column": 5 - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 30, - "end_line": 33, - "column": 11, - "end_column": 5 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 31, - "end_line": 31, - "column": 9, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "222", - "teal_alias": null - }, - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 32, - "end_line": 32, - "column": 9, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "111", - "teal_alias": null - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/named-types.algo.ts::MyContract", - "member_name": "getYX", - "arc4_method_config": { - "_type": "ARC4ABIMethodConfig", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 29, - "end_line": 34, - "column": 2, - "end_column": 3 - }, - "name": "getYX", - "is_bare": false, - "create": 3, - "readonly": false, - "allowed_completion_types": [ - 0 - ], - "default_args": {}, - "structs": {} - }, - "synthetic": false, - "inheritable": true - }, - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 36, - "end_line": 41, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 36, - "end_line": 41, - "column": 19, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 37, - "end_line": 40, - "column": 4, - "end_column": 5 - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 37, - "end_line": 40, - "column": 11, - "end_column": 5 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 38, - "end_line": 38, - "column": 16, - "end_column": 17 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "3", - "teal_alias": null - }, - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 39, - "end_line": 39, - "column": 16, - "end_column": 17 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "4", - "teal_alias": null - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/named-types.algo.ts::MyContract", - "member_name": "getAnon", - "arc4_method_config": { - "_type": "ARC4ABIMethodConfig", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 36, - "end_line": 41, - "column": 2, - "end_column": 3 - }, - "name": "getAnon", - "is_bare": false, - "create": 3, - "readonly": false, - "allowed_completion_types": [ - 0 - ], - "default_args": {}, - "structs": {} - }, - "synthetic": false, - "inheritable": true - }, - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 43, - "end_line": 48, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - } - ] - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 43, - "end_line": 48, - "column": 19, - "end_column": 3 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 44, - "end_line": 44, - "column": 10, - "end_column": 26 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 44, - "end_line": 44, - "column": 10, - "end_column": 11 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "a" - }, - "value": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 44, - "end_line": 44, - "column": 14, - "end_column": 26 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "getXY" - }, - "args": [] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 45, - "end_line": 45, - "column": 10, - "end_column": 26 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 45, - "end_line": 45, - "column": 10, - "end_column": 11 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "b" - }, - "value": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 45, - "end_line": 45, - "column": 14, - "end_column": 26 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "getYX" - }, - "args": [] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 46, - "end_line": 46, - "column": 10, - "end_column": 28 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 46, - "end_line": 46, - "column": 10, - "end_column": 11 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "c" - }, - "value": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 46, - "end_line": 46, - "column": 14, - "end_column": 28 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "target": { - "_type": "InstanceMethodTarget", - "member_name": "getAnon" - }, - "args": [] - } - }, - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 47, - "end_line": 47, - "column": 4, - "end_column": 29 - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 47, - "end_line": 47, - "column": 11, - "end_column": 20 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 47, - "end_line": 47, - "column": 12, - "end_column": 13 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "a" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 47, - "end_line": 47, - "column": 15, - "end_column": 16 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "b" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 47, - "end_line": 47, - "column": 18, - "end_column": 19 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "c" - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/named-types.algo.ts::MyContract", - "member_name": "testing", - "arc4_method_config": { - "_type": "ARC4ABIMethodConfig", - "source_location": { - "file": "tests/approvals/named-types.algo.ts", - "line": 43, - "end_line": 48, - "column": 2, - "end_column": 3 - }, - "name": "testing", - "is_bare": false, - "create": 3, - "readonly": false, - "allowed_completion_types": [ - 0 - ], - "default_args": {}, - "structs": {} - }, - "synthetic": false, - "inheritable": true - } - ], - "app_state": {}, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - } -] \ No newline at end of file diff --git a/tests/approvals/out/named-types/MyContract.arc32.json b/tests/approvals/out/named-types/MyContract.arc32.json new file mode 100644 index 00000000..f26e6d91 --- /dev/null +++ b/tests/approvals/out/named-types/MyContract.arc32.json @@ -0,0 +1,134 @@ +{ + "hints": { + "getXY()(uint64,uint64)": { + "call_config": { + "no_op": "CALL" + }, + "structs": { + "output": { + "name": "XY", + "elements": [ + [ + "x", + "uint64" + ], + [ + "y", + "uint64" + ] + ] + } + } + }, + "getYX()(uint64,uint64)": { + "call_config": { + "no_op": "CALL" + }, + "structs": { + "output": { + "name": "YX", + "elements": [ + [ + "y", + "uint64" + ], + [ + "x", + "uint64" + ] + ] + } + } + }, + "getAnon()(uint64,uint64)": { + "call_config": { + "no_op": "CALL" + }, + "structs": { + "output": { + "name": "", + "elements": [ + [ + "x", + "uint64" + ], + [ + "y", + "uint64" + ] + ] + } + } + }, + "testing()((uint64,uint64),(uint64,uint64),(uint64,uint64))": { + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvbmFtZWQtdHlwZXMuYWxnby50czo6TXlDb250cmFjdC5hcHByb3ZhbFByb2dyYW06CiAgICBpbnRjYmxvY2sgMSAwCiAgICBieXRlY2Jsb2NrIDB4MTUxZjdjNzUKICAgIGNhbGxzdWIgX19wdXlhX2FyYzRfcm91dGVyX18KICAgIHJldHVybgoKCi8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjpNeUNvbnRyYWN0Ll9fcHV5YV9hcmM0X3JvdXRlcl9fKCkgLT4gdWludDY0OgpfX3B1eWFfYXJjNF9yb3V0ZXJfXzoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjIxCiAgICAvLyBleHBvcnQgY2xhc3MgTXlDb250cmFjdCBleHRlbmRzIENvbnRyYWN0IHsKICAgIHByb3RvIDAgMQogICAgdHhuIE51bUFwcEFyZ3MKICAgIGJ6IF9fcHV5YV9hcmM0X3JvdXRlcl9fX2JhcmVfcm91dGluZ0A4CiAgICBwdXNoYnl0ZXNzIDB4ZjAyMjI4YjAgMHhkOTA4NTc1YiAweDU3N2IxZmZjIDB4MDQwZTJlNGUgLy8gbWV0aG9kICJnZXRYWSgpKHVpbnQ2NCx1aW50NjQpIiwgbWV0aG9kICJnZXRZWCgpKHVpbnQ2NCx1aW50NjQpIiwgbWV0aG9kICJnZXRBbm9uKCkodWludDY0LHVpbnQ2NCkiLCBtZXRob2QgInRlc3RpbmcoKSgodWludDY0LHVpbnQ2NCksKHVpbnQ2NCx1aW50NjQpLCh1aW50NjQsdWludDY0KSkiCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAwCiAgICBtYXRjaCBfX3B1eWFfYXJjNF9yb3V0ZXJfX19nZXRYWV9yb3V0ZUAyIF9fcHV5YV9hcmM0X3JvdXRlcl9fX2dldFlYX3JvdXRlQDMgX19wdXlhX2FyYzRfcm91dGVyX19fZ2V0QW5vbl9yb3V0ZUA0IF9fcHV5YV9hcmM0X3JvdXRlcl9fX3Rlc3Rpbmdfcm91dGVANQogICAgaW50Y18xIC8vIDAKICAgIHJldHN1YgoKX19wdXlhX2FyYzRfcm91dGVyX19fZ2V0WFlfcm91dGVAMjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjIyCiAgICAvLyBwdWJsaWMgZ2V0WFkoKTogWFkgewogICAgdHhuIE9uQ29tcGxldGlvbgogICAgIQogICAgYXNzZXJ0IC8vIE9uQ29tcGxldGlvbiBpcyBOb09wCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYXNzZXJ0IC8vIGlzIG5vdCBjcmVhdGluZwogICAgY2FsbHN1YiBnZXRYWQogICAgc3dhcAogICAgaXRvYgogICAgc3dhcAogICAgaXRvYgogICAgY29uY2F0CiAgICBieXRlY18wIC8vIDB4MTUxZjdjNzUKICAgIHN3YXAKICAgIGNvbmNhdAogICAgbG9nCiAgICBpbnRjXzAgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19nZXRZWF9yb3V0ZUAzOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL25hbWVkLXR5cGVzLmFsZ28udHM6MjkKICAgIC8vIHB1YmxpYyBnZXRZWCgpOiBZWCB7CiAgICB0eG4gT25Db21wbGV0aW9uCiAgICAhCiAgICBhc3NlcnQgLy8gT25Db21wbGV0aW9uIGlzIE5vT3AKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBhc3NlcnQgLy8gaXMgbm90IGNyZWF0aW5nCiAgICBjYWxsc3ViIGdldFlYCiAgICBzd2FwCiAgICBpdG9iCiAgICBzd2FwCiAgICBpdG9iCiAgICBjb25jYXQKICAgIGJ5dGVjXzAgLy8gMHgxNTFmN2M3NQogICAgc3dhcAogICAgY29uY2F0CiAgICBsb2cKICAgIGludGNfMCAvLyAxCiAgICByZXRzdWIKCl9fcHV5YV9hcmM0X3JvdXRlcl9fX2dldEFub25fcm91dGVANDoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjM2CiAgICAvLyBwdWJsaWMgZ2V0QW5vbigpIHsKICAgIHR4biBPbkNvbXBsZXRpb24KICAgICEKICAgIGFzc2VydCAvLyBPbkNvbXBsZXRpb24gaXMgTm9PcAogICAgdHhuIEFwcGxpY2F0aW9uSUQKICAgIGFzc2VydCAvLyBpcyBub3QgY3JlYXRpbmcKICAgIGNhbGxzdWIgZ2V0QW5vbgogICAgc3dhcAogICAgaXRvYgogICAgc3dhcAogICAgaXRvYgogICAgY29uY2F0CiAgICBieXRlY18wIC8vIDB4MTUxZjdjNzUKICAgIHN3YXAKICAgIGNvbmNhdAogICAgbG9nCiAgICBpbnRjXzAgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX190ZXN0aW5nX3JvdXRlQDU6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbmFtZWQtdHlwZXMuYWxnby50czo0MwogICAgLy8gcHVibGljIHRlc3RpbmcoKSB7CiAgICB0eG4gT25Db21wbGV0aW9uCiAgICAhCiAgICBhc3NlcnQgLy8gT25Db21wbGV0aW9uIGlzIE5vT3AKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBhc3NlcnQgLy8gaXMgbm90IGNyZWF0aW5nCiAgICBjYWxsc3ViIHRlc3RpbmcKICAgIHVuY292ZXIgNQogICAgaXRvYgogICAgdW5jb3ZlciA1CiAgICBpdG9iCiAgICBjb25jYXQKICAgIHVuY292ZXIgNAogICAgaXRvYgogICAgdW5jb3ZlciA0CiAgICBpdG9iCiAgICBjb25jYXQKICAgIHVuY292ZXIgMwogICAgaXRvYgogICAgdW5jb3ZlciAzCiAgICBpdG9iCiAgICBjb25jYXQKICAgIGNvdmVyIDIKICAgIGNvbmNhdAogICAgc3dhcAogICAgY29uY2F0CiAgICBieXRlY18wIC8vIDB4MTUxZjdjNzUKICAgIHN3YXAKICAgIGNvbmNhdAogICAgbG9nCiAgICBpbnRjXzAgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19iYXJlX3JvdXRpbmdAODoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjIxCiAgICAvLyBleHBvcnQgY2xhc3MgTXlDb250cmFjdCBleHRlbmRzIENvbnRyYWN0IHsKICAgIHR4biBPbkNvbXBsZXRpb24KICAgIGJueiBfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDEyCiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgIQogICAgYXNzZXJ0IC8vIGlzIGNyZWF0aW5nCiAgICBpbnRjXzAgLy8gMQogICAgcmV0c3ViCgpfX3B1eWFfYXJjNF9yb3V0ZXJfX19hZnRlcl9pZl9lbHNlQDEyOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL25hbWVkLXR5cGVzLmFsZ28udHM6MjEKICAgIC8vIGV4cG9ydCBjbGFzcyBNeUNvbnRyYWN0IGV4dGVuZHMgQ29udHJhY3QgewogICAgaW50Y18xIC8vIDAKICAgIHJldHN1YgoKCi8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjpNeUNvbnRyYWN0LmdldFhZKCkgLT4gdWludDY0LCB1aW50NjQ6CmdldFhZOgogICAgLy8gdGVzdHMvYXBwcm92YWxzL25hbWVkLXR5cGVzLmFsZ28udHM6MjIKICAgIC8vIHB1YmxpYyBnZXRYWSgpOiBYWSB7CiAgICBwcm90byAwIDIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjI0CiAgICAvLyB4OiAxLAogICAgaW50Y18wIC8vIDEKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjI1CiAgICAvLyB5OiAyLAogICAgcHVzaGludCAyIC8vIDIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjIzLTI2CiAgICAvLyByZXR1cm4gewogICAgLy8gICB4OiAxLAogICAgLy8gICB5OiAyLAogICAgLy8gfQogICAgcmV0c3ViCgoKLy8gdGVzdHMvYXBwcm92YWxzL25hbWVkLXR5cGVzLmFsZ28udHM6Ok15Q29udHJhY3QuZ2V0WVgoKSAtPiB1aW50NjQsIHVpbnQ2NDoKZ2V0WVg6CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbmFtZWQtdHlwZXMuYWxnby50czoyOQogICAgLy8gcHVibGljIGdldFlYKCk6IFlYIHsKICAgIHByb3RvIDAgMgogICAgLy8gdGVzdHMvYXBwcm92YWxzL25hbWVkLXR5cGVzLmFsZ28udHM6MzEtMzIKICAgIC8vIHg6IDIyMiwKICAgIC8vIHk6IDExMSwKICAgIHB1c2hpbnRzIDExMSAyMjIgLy8gMTExLCAyMjIKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjMwLTMzCiAgICAvLyByZXR1cm4gewogICAgLy8gICB4OiAyMjIsCiAgICAvLyAgIHk6IDExMSwKICAgIC8vIH0KICAgIHJldHN1YgoKCi8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjpNeUNvbnRyYWN0LmdldEFub24oKSAtPiB1aW50NjQsIHVpbnQ2NDoKZ2V0QW5vbjoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjM2CiAgICAvLyBwdWJsaWMgZ2V0QW5vbigpIHsKICAgIHByb3RvIDAgMgogICAgLy8gdGVzdHMvYXBwcm92YWxzL25hbWVkLXR5cGVzLmFsZ28udHM6MzgtMzkKICAgIC8vIHg6IFVpbnQ2NCgzKSwKICAgIC8vIHk6IFVpbnQ2NCg0KSwKICAgIHB1c2hpbnRzIDMgNCAvLyAzLCA0CiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbmFtZWQtdHlwZXMuYWxnby50czozNy00MAogICAgLy8gcmV0dXJuIHsKICAgIC8vICAgeDogVWludDY0KDMpLAogICAgLy8gICB5OiBVaW50NjQoNCksCiAgICAvLyB9CiAgICByZXRzdWIKCgovLyB0ZXN0cy9hcHByb3ZhbHMvbmFtZWQtdHlwZXMuYWxnby50czo6TXlDb250cmFjdC50ZXN0aW5nKCkgLT4gdWludDY0LCB1aW50NjQsIHVpbnQ2NCwgdWludDY0LCB1aW50NjQsIHVpbnQ2NDoKdGVzdGluZzoKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjQzCiAgICAvLyBwdWJsaWMgdGVzdGluZygpIHsKICAgIHByb3RvIDAgNgogICAgLy8gdGVzdHMvYXBwcm92YWxzL25hbWVkLXR5cGVzLmFsZ28udHM6NDQKICAgIC8vIGNvbnN0IGEgPSB0aGlzLmdldFhZKCkKICAgIGNhbGxzdWIgZ2V0WFkKICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjQ1CiAgICAvLyBjb25zdCBiID0gdGhpcy5nZXRZWCgpCiAgICBjYWxsc3ViIGdldFlYCiAgICAvLyB0ZXN0cy9hcHByb3ZhbHMvbmFtZWQtdHlwZXMuYWxnby50czo0NgogICAgLy8gY29uc3QgYyA9IHRoaXMuZ2V0QW5vbigpCiAgICBjYWxsc3ViIGdldEFub24KICAgIC8vIHRlc3RzL2FwcHJvdmFscy9uYW1lZC10eXBlcy5hbGdvLnRzOjQ3CiAgICAvLyByZXR1cm4gW2EsIGIsIGNdIGFzIGNvbnN0CiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgp0ZXN0cy9hcHByb3ZhbHMvbmFtZWQtdHlwZXMuYWxnby50czo6TXlDb250cmFjdC5jbGVhclN0YXRlUHJvZ3JhbToKICAgIHB1c2hpbnQgMSAvLyAxCiAgICByZXR1cm4K" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": {}, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "MyContract", + "methods": [ + { + "name": "getXY", + "args": [], + "readonly": false, + "returns": { + "type": "(uint64,uint64)" + } + }, + { + "name": "getYX", + "args": [], + "readonly": false, + "returns": { + "type": "(uint64,uint64)" + } + }, + { + "name": "getAnon", + "args": [], + "readonly": false, + "returns": { + "type": "(uint64,uint64)" + } + }, + { + "name": "testing", + "args": [], + "readonly": false, + "returns": { + "type": "((uint64,uint64),(uint64,uint64),(uint64,uint64))" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/tests/approvals/out/named-types/MyContract.ssa.ir b/tests/approvals/out/named-types/MyContract.ssa.ir new file mode 100644 index 00000000..b8fbcbc7 --- /dev/null +++ b/tests/approvals/out/named-types/MyContract.ssa.ir @@ -0,0 +1,157 @@ +contract tests/approvals/named-types.algo.ts::MyContract: + program approval: + subroutine @algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract.approvalProgram() -> bool: + block@0: // L1 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/named-types.algo.ts::MyContract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let tmp%0#0: bool = tests/approvals/named-types.algo.ts::MyContract.__puya_arc4_router__() + return tmp%0#0 + + subroutine tests/approvals/named-types.algo.ts::MyContract.constructor() -> void: + block@0: // L21 + return + + subroutine tests/approvals/named-types.algo.ts::MyContract.__puya_arc4_router__() -> bool: + block@0: // L21 + let tmp%0#0: uint64 = (txn NumAppArgs) + let tmp%1#0: bool = (!= tmp%0#0 0u) + goto tmp%1#0 ? block@1 : block@8 + block@1: // abi_routing_L21 + let tmp%2#0: bytes = (txna ApplicationArgs 0) + switch tmp%2#0 {method "getXY()(uint64,uint64)" => block@2, method "getYX()(uint64,uint64)" => block@3, method "getAnon()(uint64,uint64)" => block@4, method "testing()((uint64,uint64),(uint64,uint64),(uint64,uint64))" => block@5, * => block@6} + block@2: // getXY_route_L22 + let tmp%3#0: uint64 = (txn OnCompletion) + let tmp%4#0: bool = (== tmp%3#0 NoOp) + (assert tmp%4#0) // OnCompletion is NoOp + let tmp%5#0: uint64 = (txn ApplicationID) + let tmp%6#0: bool = (!= tmp%5#0 0u) + (assert tmp%6#0) // is not creating + let (elements_to_encode%0#0: uint64, elements_to_encode%1#0: uint64) = tests/approvals/named-types.algo.ts::MyContract.getXY() + let val_as_bytes%0#0: bytes = (itob elements_to_encode%0#0) + let val_as_bytes%1#0: bytes = (itob elements_to_encode%1#0) + let current_tail_offset%0#0: uint64 = 16u + let encoded_tuple_buffer%0#0: bytes = 0x + let encoded_tuple_buffer%1#0: bytes = (concat encoded_tuple_buffer%0#0 val_as_bytes%0#0) + let encoded_tuple_buffer%2#0: bytes = (concat encoded_tuple_buffer%1#0 val_as_bytes%1#0) + let tmp%7#0: bytes = (concat 0x151f7c75 encoded_tuple_buffer%2#0) + (log tmp%7#0) + return 1u + block@3: // getYX_route_L29 + let tmp%8#0: uint64 = (txn OnCompletion) + let tmp%9#0: bool = (== tmp%8#0 NoOp) + (assert tmp%9#0) // OnCompletion is NoOp + let tmp%10#0: uint64 = (txn ApplicationID) + let tmp%11#0: bool = (!= tmp%10#0 0u) + (assert tmp%11#0) // is not creating + let (elements_to_encode%2#0: uint64, elements_to_encode%3#0: uint64) = tests/approvals/named-types.algo.ts::MyContract.getYX() + let val_as_bytes%2#0: bytes = (itob elements_to_encode%2#0) + let val_as_bytes%3#0: bytes = (itob elements_to_encode%3#0) + let current_tail_offset%1#0: uint64 = 16u + let encoded_tuple_buffer%3#0: bytes = 0x + let encoded_tuple_buffer%4#0: bytes = (concat encoded_tuple_buffer%3#0 val_as_bytes%2#0) + let encoded_tuple_buffer%5#0: bytes = (concat encoded_tuple_buffer%4#0 val_as_bytes%3#0) + let tmp%12#0: bytes = (concat 0x151f7c75 encoded_tuple_buffer%5#0) + (log tmp%12#0) + return 1u + block@4: // getAnon_route_L36 + let tmp%13#0: uint64 = (txn OnCompletion) + let tmp%14#0: bool = (== tmp%13#0 NoOp) + (assert tmp%14#0) // OnCompletion is NoOp + let tmp%15#0: uint64 = (txn ApplicationID) + let tmp%16#0: bool = (!= tmp%15#0 0u) + (assert tmp%16#0) // is not creating + let (elements_to_encode%4#0: uint64, elements_to_encode%5#0: uint64) = tests/approvals/named-types.algo.ts::MyContract.getAnon() + let val_as_bytes%4#0: bytes = (itob elements_to_encode%4#0) + let val_as_bytes%5#0: bytes = (itob elements_to_encode%5#0) + let current_tail_offset%2#0: uint64 = 16u + let encoded_tuple_buffer%6#0: bytes = 0x + let encoded_tuple_buffer%7#0: bytes = (concat encoded_tuple_buffer%6#0 val_as_bytes%4#0) + let encoded_tuple_buffer%8#0: bytes = (concat encoded_tuple_buffer%7#0 val_as_bytes%5#0) + let tmp%17#0: bytes = (concat 0x151f7c75 encoded_tuple_buffer%8#0) + (log tmp%17#0) + return 1u + block@5: // testing_route_L43 + let tmp%18#0: uint64 = (txn OnCompletion) + let tmp%19#0: bool = (== tmp%18#0 NoOp) + (assert tmp%19#0) // OnCompletion is NoOp + let tmp%20#0: uint64 = (txn ApplicationID) + let tmp%21#0: bool = (!= tmp%20#0 0u) + (assert tmp%21#0) // is not creating + let (elements_to_encode%6#0: uint64, elements_to_encode%7#0: uint64, elements_to_encode%8#0: uint64, elements_to_encode%9#0: uint64, elements_to_encode%10#0: uint64, elements_to_encode%11#0: uint64) = tests/approvals/named-types.algo.ts::MyContract.testing() + let val_as_bytes%6#0: bytes = (itob elements_to_encode%6#0) + let val_as_bytes%7#0: bytes = (itob elements_to_encode%7#0) + let current_tail_offset%3#0: uint64 = 16u + let encoded_tuple_buffer%9#0: bytes = 0x + let encoded_tuple_buffer%10#0: bytes = (concat encoded_tuple_buffer%9#0 val_as_bytes%6#0) + let encoded_tuple_buffer%11#0: bytes = (concat encoded_tuple_buffer%10#0 val_as_bytes%7#0) + let val_as_bytes%8#0: bytes = (itob elements_to_encode%8#0) + let val_as_bytes%9#0: bytes = (itob elements_to_encode%9#0) + let current_tail_offset%4#0: uint64 = 16u + let encoded_tuple_buffer%12#0: bytes = 0x + let encoded_tuple_buffer%13#0: bytes = (concat encoded_tuple_buffer%12#0 val_as_bytes%8#0) + let encoded_tuple_buffer%14#0: bytes = (concat encoded_tuple_buffer%13#0 val_as_bytes%9#0) + let val_as_bytes%10#0: bytes = (itob elements_to_encode%10#0) + let val_as_bytes%11#0: bytes = (itob elements_to_encode%11#0) + let current_tail_offset%5#0: uint64 = 16u + let encoded_tuple_buffer%15#0: bytes = 0x + let encoded_tuple_buffer%16#0: bytes = (concat encoded_tuple_buffer%15#0 val_as_bytes%10#0) + let encoded_tuple_buffer%17#0: bytes = (concat encoded_tuple_buffer%16#0 val_as_bytes%11#0) + let current_tail_offset%6#0: uint64 = 48u + let encoded_tuple_buffer%18#0: bytes = 0x + let encoded_tuple_buffer%19#0: bytes = (concat encoded_tuple_buffer%18#0 encoded_tuple_buffer%11#0) + let encoded_tuple_buffer%20#0: bytes = (concat encoded_tuple_buffer%19#0 encoded_tuple_buffer%14#0) + let encoded_tuple_buffer%21#0: bytes = (concat encoded_tuple_buffer%20#0 encoded_tuple_buffer%17#0) + let tmp%22#0: bytes = (concat 0x151f7c75 encoded_tuple_buffer%21#0) + (log tmp%22#0) + return 1u + block@6: // switch_case_default_L21 + goto block@7 + block@7: // switch_case_next_L21 + goto block@12 + block@8: // bare_routing_L21 + let tmp%23#0: uint64 = (txn OnCompletion) + switch tmp%23#0 {0u => block@9, * => block@10} + block@9: // __algots__.defaultCreate_L21 + let tmp%24#0: uint64 = (txn ApplicationID) + let tmp%25#0: bool = (== tmp%24#0 0u) + (assert tmp%25#0) // is creating + tests/approvals/named-types.algo.ts::MyContract.__algots__.defaultCreate() + return 1u + block@10: // switch_case_default_L21 + goto block@11 + block@11: // switch_case_next_L21 + goto block@12 + block@12: // after_if_else_L21 + return 0u + + subroutine tests/approvals/named-types.algo.ts::MyContract.getXY() -> : + block@0: // L22 + return 1u 2u + + subroutine tests/approvals/named-types.algo.ts::MyContract.getYX() -> : + block@0: // L29 + return 111u 222u + + subroutine tests/approvals/named-types.algo.ts::MyContract.getAnon() -> : + block@0: // L36 + return 3u 4u + + subroutine tests/approvals/named-types.algo.ts::MyContract.testing() -> : + block@0: // L43 + let (a.x#0: uint64, a.y#0: uint64) = tests/approvals/named-types.algo.ts::MyContract.getXY() + let (b.y#0: uint64, b.x#0: uint64) = tests/approvals/named-types.algo.ts::MyContract.getYX() + let (c.x#0: uint64, c.y#0: uint64) = tests/approvals/named-types.algo.ts::MyContract.getAnon() + return a.x#0 a.y#0 b.y#0 b.x#0 c.x#0 c.y#0 + + subroutine tests/approvals/named-types.algo.ts::MyContract.__algots__.defaultCreate() -> void: + block@0: // L21 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/named-types/named-types.awst b/tests/approvals/out/named-types/named-types.awst new file mode 100644 index 00000000..b54b3171 --- /dev/null +++ b/tests/approvals/out/named-types/named-types.awst @@ -0,0 +1,57 @@ +contract MyContract +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + return arc4Router() + } + + clearProgram(): bool + { + return True + } + + getXY(): XY{ x: uint64, y: uint64 } + { + return { x: (#9 = { x: 1, y: 2 }).x, y: #9.y } + } + + getYX(): YX{ y: uint64, x: uint64 } + { + return { y: (#10 = { x: 222, y: 111 }).y, x: #10.x } + } + + getAnon(): { x: uint64, y: uint64 } + { + return { x: 3, y: 4 } + } + + testing(): readonlytuple[XY{ x: uint64, y: uint64 }, YX{ y: uint64, x: uint64 }, { x: uint64, y: uint64 }] + { + a: XY{ x: uint64, y: uint64 } = this.getXY() + b: YX{ y: uint64, x: uint64 } = this.getYX() + c: { x: uint64, y: uint64 } = this.getAnon() + return [a, b, c] + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + } + + Contract::constructor(): void + { + this.constructor() + } + + __algots__.defaultCreate(): void + { + } + +} \ No newline at end of file diff --git a/tests/approvals/out/named-types/named-types.awst.json b/tests/approvals/out/named-types/named-types.awst.json new file mode 100644 index 00000000..c48dff3b --- /dev/null +++ b/tests/approvals/out/named-types/named-types.awst.json @@ -0,0 +1,2185 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "id": "tests/approvals/named-types.algo.ts::MyContract", + "name": "MyContract", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "ARC4Router", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 22, + "end_line": 22, + "column": 2, + "end_column": 20 + }, + "args": [], + "return_type": { + "_type": "WTuple", + "name": "XY", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 22, + "end_line": 27, + "column": 21, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 4, + "end_column": 5 + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "XY", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 25, + "end_line": 25, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + ] + }, + "id": "9" + }, + "name": "x" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 23, + "end_line": 26, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 24, + "end_line": 24, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 25, + "end_line": 25, + "column": 9, + "end_column": 10 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + ] + }, + "id": "9" + }, + "name": "y" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/named-types.algo.ts::MyContract", + "member_name": "getXY", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 22, + "end_line": 22, + "column": 2, + "end_column": 20 + }, + "name": "getXY", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": { + "output": { + "name": "XY", + "elements": [ + [ + "x", + "uint64" + ], + [ + "y", + "uint64" + ] + ] + } + } + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 29, + "end_line": 29, + "column": 2, + "end_column": 20 + }, + "args": [], + "return_type": { + "_type": "WTuple", + "name": "YX", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x" + ] + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 29, + "end_line": 34, + "column": 21, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 4, + "end_column": 5 + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "YX", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 31, + "end_line": 31, + "column": 9, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "222", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 32, + "end_line": 32, + "column": 9, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "111", + "teal_alias": null + } + ] + }, + "id": "10" + }, + "name": "y" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 30, + "end_line": 33, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 31, + "end_line": 31, + "column": 9, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "222", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 32, + "end_line": 32, + "column": 9, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "111", + "teal_alias": null + } + ] + }, + "id": "10" + }, + "name": "x" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/named-types.algo.ts::MyContract", + "member_name": "getYX", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 29, + "end_line": 29, + "column": 2, + "end_column": 20 + }, + "name": "getYX", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": { + "output": { + "name": "YX", + "elements": [ + [ + "y", + "uint64" + ], + [ + "x", + "uint64" + ] + ] + } + } + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 36, + "end_line": 36, + "column": 2, + "end_column": 18 + }, + "args": [], + "return_type": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 36, + "end_line": 41, + "column": 19, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 37, + "end_line": 40, + "column": 4, + "end_column": 5 + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 37, + "end_line": 40, + "column": 11, + "end_column": 5 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 38, + "end_line": 38, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "3", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 39, + "end_line": 39, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "4", + "teal_alias": null + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/named-types.algo.ts::MyContract", + "member_name": "getAnon", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 36, + "end_line": 36, + "column": 2, + "end_column": 18 + }, + "name": "getAnon", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": { + "output": { + "name": "", + "elements": [ + [ + "x", + "uint64" + ], + [ + "y", + "uint64" + ] + ] + } + } + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 43, + "end_line": 43, + "column": 2, + "end_column": 18 + }, + "args": [], + "return_type": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "XY", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + { + "_type": "WTuple", + "name": "YX", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + } + ] + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 43, + "end_line": 48, + "column": 19, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 44, + "end_line": 44, + "column": 10, + "end_column": 26 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 44, + "end_line": 44, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "WTuple", + "name": "XY", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "name": "a" + }, + "value": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 44, + "end_line": 44, + "column": 14, + "end_column": 26 + }, + "wtype": { + "_type": "WTuple", + "name": "XY", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "getXY" + }, + "args": [] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 45, + "end_line": 45, + "column": 10, + "end_column": 26 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 45, + "end_line": 45, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "WTuple", + "name": "YX", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x" + ] + }, + "name": "b" + }, + "value": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 45, + "end_line": 45, + "column": 14, + "end_column": 26 + }, + "wtype": { + "_type": "WTuple", + "name": "YX", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x" + ] + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "getYX" + }, + "args": [] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 46, + "end_line": 46, + "column": 10, + "end_column": 28 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 46, + "end_line": 46, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "name": "c" + }, + "value": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 46, + "end_line": 46, + "column": 14, + "end_column": 28 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "getAnon" + }, + "args": [] + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 4, + "end_column": 29 + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 11, + "end_column": 20 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "XY", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + { + "_type": "WTuple", + "name": "YX", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x" + ] + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + } + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 12, + "end_column": 13 + }, + "wtype": { + "_type": "WTuple", + "name": "XY", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "name": "a" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 15, + "end_column": 16 + }, + "wtype": { + "_type": "WTuple", + "name": "YX", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x" + ] + }, + "name": "b" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 47, + "end_line": 47, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y" + ] + }, + "name": "c" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/named-types.algo.ts::MyContract", + "member_name": "testing", + "arc4_method_config": { + "_type": "ARC4ABIMethodConfig", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 43, + "end_line": 43, + "column": 2, + "end_column": 18 + }, + "name": "testing", + "is_bare": false, + "create": 3, + "readonly": false, + "allowed_completion_types": [ + 0 + ], + "default_args": {}, + "structs": {} + } + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/named-types.algo.ts::MyContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": "Implicitly generated create method", + "args": {}, + "returns": null + }, + "cref": "tests/approvals/named-types.algo.ts::MyContract", + "member_name": "__algots__.defaultCreate", + "arc4_method_config": { + "_type": "ARC4BareMethodConfig", + "source_location": { + "file": "tests/approvals/named-types.algo.ts", + "line": 21, + "end_line": 21, + "column": 0, + "end_column": 42 + }, + "allowed_completion_types": [ + 0 + ], + "create": 2, + "is_bare": true + } + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/non-arc4.awst.json b/tests/approvals/out/non-arc4.awst.json deleted file mode 100644 index b445f853..00000000 --- a/tests/approvals/out/non-arc4.awst.json +++ /dev/null @@ -1,432 +0,0 @@ -[ - { - "_type": "ContractFragment", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 3, - "end_line": 13, - "column": 0, - "end_column": 1 - }, - "id": "tests/approvals/non-arc4.algo.ts::default", - "name": "HelloWorldContract", - "bases": [ - "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" - ], - "init": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 3, - "end_line": 13, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 3, - "end_line": 13, - "column": 0, - "end_column": 1 - }, - "body": [ - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 3, - "end_line": 13, - "column": 0, - "end_column": 1 - }, - "expr": { - "_type": "VoidConstant", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 3, - "end_line": 13, - "column": 0, - "end_column": 1 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/non-arc4.algo.ts::default", - "member_name": "constructor", - "arc4_method_config": null, - "synthetic": true, - "inheritable": true - }, - "approval_program": { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 4, - "end_line": 8, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 4, - "end_line": 8, - "column": 36, - "end_column": 3 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 5, - "end_line": 5, - "column": 10, - "end_column": 50 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 5, - "end_line": 5, - "column": 10, - "end_column": 14 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "name" - }, - "value": { - "_type": "ReinterpretCast", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 5, - "end_line": 5, - "column": 17, - "end_column": 50 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "expr": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 5, - "end_line": 5, - "column": 24, - "end_column": 49 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "op_code": "txnas", - "immediates": [ - "ApplicationArgs" - ], - "stack_args": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 5, - "end_line": 5, - "column": 47, - "end_column": 48 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "0", - "teal_alias": null - } - ], - "comment": null - } - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 6, - "end_line": 6, - "column": 4, - "end_column": 25 - }, - "expr": { - "_type": "IntrinsicCall", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 6, - "end_line": 6, - "column": 4, - "end_column": 25 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "op_code": "log", - "immediates": [], - "stack_args": [ - { - "_type": "ReinterpretCast", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 6, - "end_line": 6, - "column": 4, - "end_column": 25 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "expr": { - "_type": "BytesBinaryOperation", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 6, - "end_line": 6, - "column": 8, - "end_column": 24 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "left": { - "_type": "StringConstant", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 6, - "end_line": 6, - "column": 8, - "end_column": 24 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "Hello, " - }, - "op": "+", - "right": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 6, - "end_line": 6, - "column": 18, - "end_column": 22 - }, - "wtype": { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "name" - } - } - } - ], - "comment": null - } - }, - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 7, - "end_line": 7, - "column": 4, - "end_column": 15 - }, - "value": { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 7, - "end_line": 7, - "column": 11, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/non-arc4.algo.ts::default", - "member_name": "approvalProgram", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - }, - "clear_program": null, - "subroutines": [ - { - "_type": "ContractMethod", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 10, - "end_line": 12, - "column": 2, - "end_column": 3 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 10, - "end_line": 12, - "column": 31, - "end_column": 3 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 11, - "end_line": 11, - "column": 4, - "end_column": 15 - }, - "value": { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/non-arc4.algo.ts", - "line": 11, - "end_line": 11, - "column": 11, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "cref": "tests/approvals/non-arc4.algo.ts::default", - "member_name": "clearState", - "arc4_method_config": null, - "synthetic": false, - "inheritable": true - } - ], - "app_state": {}, - "reserved_scratch_space": [], - "state_totals": { - "globalBytes": null, - "globalUints": null, - "localBytes": null, - "localUints": null - }, - "docstring": null - } -] \ No newline at end of file diff --git a/tests/approvals/out/non-arc4/HelloWorldContract.ssa.ir b/tests/approvals/out/non-arc4/HelloWorldContract.ssa.ir new file mode 100644 index 00000000..7ea246e9 --- /dev/null +++ b/tests/approvals/out/non-arc4/HelloWorldContract.ssa.ir @@ -0,0 +1,23 @@ +contract tests/approvals/non-arc4.algo.ts::HelloWorldContract: + program approval: + subroutine tests/approvals/non-arc4.algo.ts::HelloWorldContract.approvalProgram() -> bool: + block@0: // L4 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/non-arc4.algo.ts::HelloWorldContract.constructor() + goto block@2 + block@2: // after_if_else_L1 + let name#0: bytes = ((txnas ApplicationArgs) 0u) + let tmp%0#0: bytes = (concat "Hello, " name#0) + (log tmp%0#0) + return 1u + + subroutine tests/approvals/non-arc4.algo.ts::HelloWorldContract.constructor() -> void: + block@0: // L3 + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/non-arc4.awst b/tests/approvals/out/non-arc4/non-arc4.awst similarity index 55% rename from tests/approvals/out/non-arc4.awst rename to tests/approvals/out/non-arc4/non-arc4.awst index 4d900fb6..f5fe9150 100644 --- a/tests/approvals/out/non-arc4.awst +++ b/tests/approvals/out/non-arc4/non-arc4.awst @@ -1,20 +1,33 @@ -contract HelloWorldContract extends @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract +contract HelloWorldContract { - constructor(): void - { - void - } - approvalProgram(): bool { + if (!Boolean(txn())) { + this.constructor() + } name: string = reinterpret_cast(txnas(0)) log(reinterpret_cast("Hello, " + name)) return True } + clearProgram(): bool + { + return True + } + clearState(): bool { return True } + constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + } \ No newline at end of file diff --git a/tests/approvals/out/non-arc4/non-arc4.awst.json b/tests/approvals/out/non-arc4/non-arc4.awst.json new file mode 100644 index 00000000..61600782 --- /dev/null +++ b/tests/approvals/out/non-arc4/non-arc4.awst.json @@ -0,0 +1,711 @@ +[ + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 62 + }, + "id": "tests/approvals/non-arc4.algo.ts::HelloWorldContract", + "name": "HelloWorldContract", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 4, + "end_line": 4, + "column": 2, + "end_column": 35 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 4, + "end_line": 8, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 5, + "end_line": 5, + "column": 10, + "end_column": 50 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 5, + "end_line": 5, + "column": 10, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "name" + }, + "value": { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 5, + "end_line": 5, + "column": 17, + "end_column": 50 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 5, + "end_line": 5, + "column": 24, + "end_column": 49 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "op_code": "txnas", + "immediates": [ + "ApplicationArgs" + ], + "stack_args": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 5, + "end_line": 5, + "column": 47, + "end_column": 48 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "0", + "teal_alias": null + } + ], + "comment": null + } + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 6, + "end_line": 6, + "column": 4, + "end_column": 25 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 6, + "end_line": 6, + "column": 4, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "op_code": "log", + "immediates": [], + "stack_args": [ + { + "_type": "ReinterpretCast", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 6, + "end_line": 6, + "column": 4, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "expr": { + "_type": "BytesBinaryOperation", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 6, + "end_line": 6, + "column": 8, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "left": { + "_type": "StringConstant", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 6, + "end_line": 6, + "column": 8, + "end_column": 24 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "Hello, " + }, + "op": "+", + "right": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 6, + "end_line": 6, + "column": 18, + "end_column": 22 + }, + "wtype": { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "name" + } + } + } + ], + "comment": null + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 7, + "end_line": 7, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 7, + "end_line": 7, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/non-arc4.algo.ts::HelloWorldContract", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 10, + "end_line": 10, + "column": 2, + "end_column": 30 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 10, + "end_line": 12, + "column": 31, + "end_column": 3 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 11, + "end_line": 11, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 11, + "end_line": 11, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/non-arc4.algo.ts::HelloWorldContract", + "member_name": "clearState", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 62 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 62 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 62 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/non-arc4.algo.ts", + "line": 3, + "end_line": 3, + "column": 0, + "end_column": 62 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/non-arc4.algo.ts::HelloWorldContract", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/numeric-literal-expressions.awst b/tests/approvals/out/numeric-literal-expressions/numeric-literal-expressions.awst similarity index 100% rename from tests/approvals/out/numeric-literal-expressions.awst rename to tests/approvals/out/numeric-literal-expressions/numeric-literal-expressions.awst diff --git a/tests/approvals/out/numeric-literal-expressions.awst.json b/tests/approvals/out/numeric-literal-expressions/numeric-literal-expressions.awst.json similarity index 99% rename from tests/approvals/out/numeric-literal-expressions.awst.json rename to tests/approvals/out/numeric-literal-expressions/numeric-literal-expressions.awst.json index af3c52a8..037e89ce 100644 --- a/tests/approvals/out/numeric-literal-expressions.awst.json +++ b/tests/approvals/out/numeric-literal-expressions/numeric-literal-expressions.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/numeric-literal-expressions.algo.ts", "line": 3, - "end_line": 11, + "end_line": 3, "column": 0, - "end_column": 1 + "end_column": 22 }, "args": [], "return_type": { @@ -244,9 +244,9 @@ "source_location": { "file": "tests/approvals/numeric-literal-expressions.algo.ts", "line": 7, - "end_line": 9, + "end_line": 7, "column": 2, - "end_column": 3 + "end_column": 24 }, "condition": { "_type": "BooleanBinaryOperation", @@ -480,9 +480,9 @@ "source_location": { "file": "tests/approvals/numeric-literal-expressions.algo.ts", "line": 13, - "end_line": 17, + "end_line": 13, "column": 0, - "end_column": 1 + "end_column": 23 }, "args": [], "return_type": { diff --git a/tests/approvals/out/object-destructuring.awst b/tests/approvals/out/object-destructuring.awst deleted file mode 100644 index b12451ca..00000000 --- a/tests/approvals/out/object-destructuring.awst +++ /dev/null @@ -1,34 +0,0 @@ -subroutine testPartialDestructure(arg: tuple[uint64, uint64, uint64]): void -{ - [x, _, _₁]: readonlytuple[uint64, uint64, uint64] = arg - [[_₂, y, _₃]]: readonlytuple[readonlytuple[uint64, uint64, uint64]] = [arg] -} -subroutine test(): void -{ - [a, b, c, d]: readonlytuple[uint64, bytes, bool, biguint] = tests/approvals/object-destructuring.algo.ts::produceItems() - [_, _₁, _₂, e]: readonlytuple[uint64, bytes, bool, biguint] = tests/approvals/object-destructuring.algo.ts::produceItems() - f: tuple[uint64, bytes, bool, biguint] = ([g, _₃, _₄, i] = tests/approvals/object-destructuring.algo.ts::produceItems()) - tests/approvals/object-destructuring.algo.ts::receivePartial([(#0 = tests/approvals/object-destructuring.algo.ts::produceItems()).0, #0.3]) -} -subroutine produceItems(): tuple[uint64, bytes, bool, biguint] -{ - return [1, "", False, 999] -} -subroutine receivePartial(x: tuple[uint64, biguint]): void -{ -} -subroutine testLiteralToLiteral(): void -{ - a: uint64 = 4 - b: uint64 = 1 - [e, f]: readonlytuple[uint64, uint64] = ([c, d] = [a, b]) -} -subroutine testNumericResolution(): void -{ - x: tuple[uint64] = (y = [434]) -} -subroutine test2(args: tuple[bool, bool, readonlytuple[string, string]]): void -{ - [a, [x, y, _], b]: readonlytuple[bool, readonlytuple[bool, bool, readonlytuple[string, string]], bool] = [True, args, False] - args2: tuple[bool, bool, readonlytuple[string, string]] = [True, True, args.2] -} \ No newline at end of file diff --git a/tests/approvals/out/object-destructuring.awst.json b/tests/approvals/out/object-destructuring.awst.json deleted file mode 100644 index c80c1aaa..00000000 --- a/tests/approvals/out/object-destructuring.awst.json +++ /dev/null @@ -1,3096 +0,0 @@ -[ - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 4, - "end_line": 9, - "column": 0, - "end_column": 1 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "arg", - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 4, - "end_line": 4, - "column": 32, - "end_column": 72 - } - } - ], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 4, - "end_line": 9, - "column": 74, - "end_column": 1 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 5, - "end_line": 5, - "column": 8, - "end_column": 19 - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 5, - "end_line": 5, - "column": 8, - "end_column": 19 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 5, - "end_line": 5, - "column": 10, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "x" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 5, - "end_line": 5, - "column": 8, - "end_column": 19 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "_" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 5, - "end_line": 5, - "column": 8, - "end_column": 19 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "_₁" - } - ] - }, - "value": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 5, - "end_line": 5, - "column": 16, - "end_column": 19 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "arg" - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 6, - "end_line": 8, - "column": 8, - "end_column": 21 - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 6, - "end_line": 8, - "column": 8, - "end_column": 21 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - } - ] - }, - "items": [ - { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 6, - "end_line": 8, - "column": 8, - "end_column": 21 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 6, - "end_line": 8, - "column": 8, - "end_column": 21 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "_₂" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 7, - "end_line": 7, - "column": 14, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "y" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 6, - "end_line": 8, - "column": 8, - "end_column": 21 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "_₃" - } - ] - } - ] - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 8, - "end_line": 8, - "column": 6, - "end_column": 21 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 8, - "end_line": 8, - "column": 16, - "end_column": 19 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "arg" - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/object-destructuring.algo.ts::testPartialDestructure", - "name": "testPartialDestructure" - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 11, - "end_line": 17, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 11, - "end_line": 17, - "column": 16, - "end_column": 1 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 12, - "end_line": 12, - "column": 8, - "end_column": 39 - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 12, - "end_line": 12, - "column": 8, - "end_column": 39 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 12, - "end_line": 12, - "column": 10, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 12, - "end_line": 12, - "column": 13, - "end_column": 14 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "b" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 12, - "end_line": 12, - "column": 16, - "end_column": 17 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "c" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 12, - "end_line": 12, - "column": 19, - "end_column": 20 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "d" - } - ] - }, - "value": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 12, - "end_line": 12, - "column": 25, - "end_column": 39 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/object-destructuring.algo.ts::produceItems" - }, - "args": [] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 13, - "end_line": 13, - "column": 8, - "end_column": 33 - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 13, - "end_line": 13, - "column": 8, - "end_column": 33 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 13, - "end_line": 13, - "column": 8, - "end_column": 33 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "_" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 13, - "end_line": 13, - "column": 8, - "end_column": 33 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "_₁" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 13, - "end_line": 13, - "column": 8, - "end_column": 33 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "_₂" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 13, - "end_line": 13, - "column": 13, - "end_column": 14 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "e" - } - ] - }, - "value": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 13, - "end_line": 13, - "column": 19, - "end_column": 33 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/object-destructuring.algo.ts::produceItems" - }, - "args": [] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 8, - "end_column": 45 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "name": "f" - }, - "value": { - "_type": "AssignmentExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 13, - "end_column": 44 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 13, - "end_column": 44 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 18, - "end_column": 19 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "g" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 13, - "end_column": 44 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "_₃" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 13, - "end_column": 44 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "_₄" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 24, - "end_column": 25 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "name": "i" - } - ] - }, - "value": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 15, - "end_line": 15, - "column": 30, - "end_column": 44 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/object-destructuring.algo.ts::produceItems" - }, - "args": [] - } - } - }, - { - "_type": "ExpressionStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 2, - "end_column": 32 - }, - "expr": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 2, - "end_column": 32 - }, - "wtype": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/object-destructuring.algo.ts::receivePartial" - }, - "args": [ - { - "_type": "CallArg", - "name": null, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 17, - "end_column": 31 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "items": [ - { - "_type": "TupleItemExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 17, - "end_column": 31 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "base": { - "_type": "SingleEvaluation", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 17, - "end_column": 31 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "source": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 17, - "end_column": 31 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/object-destructuring.algo.ts::produceItems" - }, - "args": [] - }, - "id": "0" - }, - "index": "0" - }, - { - "_type": "TupleItemExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 17, - "end_column": 31 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "base": { - "_type": "SingleEvaluation", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 17, - "end_column": 31 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "source": { - "_type": "SubroutineCallExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 16, - "end_line": 16, - "column": 17, - "end_column": 31 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "target": { - "_type": "SubroutineID", - "target": "tests/approvals/object-destructuring.algo.ts::produceItems" - }, - "args": [] - }, - "id": "0" - }, - "index": "3" - } - ] - } - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/object-destructuring.algo.ts::test", - "name": "test" - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 19, - "end_line": 26, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 19, - "end_line": 26, - "column": 73, - "end_column": 1 - }, - "body": [ - { - "_type": "ReturnStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 20, - "end_line": 25, - "column": 2, - "end_column": 3 - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 20, - "end_line": 25, - "column": 9, - "end_column": 3 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "items": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 21, - "end_line": 21, - "column": 7, - "end_column": 8 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - }, - { - "_type": "BytesConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 22, - "end_line": 22, - "column": 13, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "bytes", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "", - "encoding": "utf8" - }, - { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 23, - "end_line": 23, - "column": 7, - "end_column": 12 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": false - }, - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 24, - "end_line": 24, - "column": 7, - "end_column": 11 - }, - "wtype": { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - "value": "999", - "teal_alias": null - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/object-destructuring.algo.ts::produceItems", - "name": "produceItems" - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 28, - "end_line": 28, - "column": 0, - "end_column": 56 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "x", - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "biguint", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 28, - "end_line": 28, - "column": 24, - "end_column": 52 - } - } - ], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 28, - "end_line": 28, - "column": 54, - "end_column": 56 - }, - "body": [], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/object-destructuring.algo.ts::receivePartial", - "name": "receivePartial" - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 30, - "end_line": 37, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 30, - "end_line": 37, - "column": 32, - "end_column": 1 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 31, - "end_line": 31, - "column": 8, - "end_column": 21 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 31, - "end_line": 31, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 31, - "end_line": 31, - "column": 20, - "end_column": 21 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "4", - "teal_alias": null - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 32, - "end_line": 32, - "column": 8, - "end_column": 21 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 32, - "end_line": 32, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - }, - "value": { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 32, - "end_line": 32, - "column": 20, - "end_column": 21 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "1", - "teal_alias": null - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 8, - "end_column": 52 - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 8, - "end_column": 52 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 13, - "end_column": 14 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "e" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 19, - "end_column": 20 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "f" - } - ] - }, - "value": { - "_type": "AssignmentExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 26, - "end_column": 51 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 26, - "end_column": 51 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 31, - "end_column": 32 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "c" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 37, - "end_column": 38 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "d" - } - ] - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 43, - "end_column": 51 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 45, - "end_column": 46 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 36, - "end_line": 36, - "column": 48, - "end_column": 49 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - } - ] - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/object-destructuring.algo.ts::testLiteralToLiteral", - "name": "testLiteralToLiteral" - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 39, - "end_line": 42, - "column": 0, - "end_column": 1 - }, - "args": [], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 39, - "end_line": 42, - "column": 33, - "end_column": 1 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 41, - "end_line": 41, - "column": 8, - "end_column": 43 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 41, - "end_line": 41, - "column": 8, - "end_column": 9 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "x" - }, - "value": { - "_type": "AssignmentExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 41, - "end_line": 41, - "column": 28, - "end_column": 42 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 41, - "end_line": 41, - "column": 28, - "end_column": 29 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "name": "y" - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 41, - "end_line": 41, - "column": 32, - "end_column": 42 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "IntegerConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 41, - "end_line": 41, - "column": 37, - "end_column": 40 - }, - "wtype": { - "_type": "WType", - "name": "uint64", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": "434", - "teal_alias": null - } - ] - } - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/object-destructuring.algo.ts::testNumericResolution", - "name": "testNumericResolution" - }, - { - "_type": "Subroutine", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 44, - "end_line": 52, - "column": 0, - "end_column": 1 - }, - "args": [ - { - "_type": "SubroutineArgument", - "name": "args", - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 44, - "end_line": 44, - "column": 15, - "end_column": 77 - } - } - ], - "return_type": { - "_type": "WType", - "name": "void", - "immutable": true, - "ephemeral": false, - "scalar_type": null - }, - "body": { - "_type": "Block", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 44, - "end_line": 52, - "column": 79, - "end_column": 1 - }, - "body": [ - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 45, - "end_line": 49, - "column": 8, - "end_column": 33 - }, - "target": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 45, - "end_line": 49, - "column": 8, - "end_column": 33 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 46, - "end_line": 46, - "column": 4, - "end_column": 5 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "a" - }, - { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 45, - "end_line": 49, - "column": 8, - "end_column": 33 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - "items": [ - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 48, - "end_line": 48, - "column": 12, - "end_column": 13 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "x" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 48, - "end_line": 48, - "column": 15, - "end_column": 16 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "y" - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 45, - "end_line": 49, - "column": 8, - "end_column": 33 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "name": "_" - } - ] - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 47, - "end_line": 47, - "column": 4, - "end_column": 5 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "name": "b" - } - ] - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 49, - "end_line": 49, - "column": 6, - "end_column": 33 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - } - ] - }, - "items": [ - { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 49, - "end_line": 49, - "column": 11, - "end_column": 15 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - }, - { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 49, - "end_line": 49, - "column": 27, - "end_column": 31 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - "name": "args" - }, - { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 49, - "end_line": 49, - "column": 20, - "end_column": 25 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": false - } - ] - } - }, - { - "_type": "AssignmentStatement", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 51, - "end_line": 51, - "column": 8, - "end_column": 45 - }, - "target": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 51, - "end_line": 51, - "column": 8, - "end_column": 13 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - "name": "args2" - }, - "value": { - "_type": "TupleExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 51, - "end_line": 51, - "column": 16, - "end_column": 45 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - "items": [ - { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 51, - "end_line": 51, - "column": 30, - "end_column": 34 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - }, - { - "_type": "BoolConstant", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 51, - "end_line": 51, - "column": 39, - "end_column": 43 - }, - "wtype": { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - "value": true - }, - { - "_type": "TupleItemExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 51, - "end_line": 51, - "column": 16, - "end_column": 45 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - }, - "base": { - "_type": "VarExpression", - "source_location": { - "file": "tests/approvals/object-destructuring.algo.ts", - "line": 51, - "end_line": 51, - "column": 21, - "end_column": 25 - }, - "wtype": { - "_type": "WTuple", - "name": "WTuple", - "immutable": false, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WType", - "name": "bool", - "immutable": true, - "ephemeral": false, - "scalar_type": 2 - }, - { - "_type": "WTuple", - "name": "WTuple", - "immutable": true, - "ephemeral": false, - "scalar_type": null, - "types": [ - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - }, - { - "_type": "WType", - "name": "string", - "immutable": true, - "ephemeral": false, - "scalar_type": 1 - } - ] - } - ] - }, - "name": "args" - }, - "index": "2" - } - ] - } - } - ], - "label": null, - "comment": null - }, - "documentation": { - "_type": "MethodDocumentation", - "description": null, - "args": {}, - "returns": null - }, - "id": "tests/approvals/object-destructuring.algo.ts::test2", - "name": "test2" - } -] \ No newline at end of file diff --git a/tests/approvals/out/object-destructuring/object-destructuring.awst b/tests/approvals/out/object-destructuring/object-destructuring.awst new file mode 100644 index 00000000..f363b04e --- /dev/null +++ b/tests/approvals/out/object-destructuring/object-destructuring.awst @@ -0,0 +1,34 @@ +subroutine testPartialDestructure(arg: { x: uint64, y: uint64, z: uint64 }): void +{ + { x: x, y: _, z: _₁ }: { x: uint64, y: uint64, z: uint64 } = arg + { nested: { y: y, x: _₂, z: _₃ } }: { nested: { y: uint64, x: uint64, z: uint64 } } = { nested: (#2 = { nested: { y: arg.y, x: arg.x, z: arg.z } }).nested } +} +subroutine test(): void +{ + { a: a, b: b, c: c, d: d }: { a: uint64, b: bytes, c: bool, d: biguint } = tests/approvals/object-destructuring.algo.ts::produceItems() + { d: e, a: _, b: _₁, c: _₂ }: { d: biguint, a: uint64, b: bytes, c: bool } = { d: (#3 = tests/approvals/object-destructuring.algo.ts::produceItems()).d, a: #3.a, b: #3.b, c: #3.c } + f: { a: uint64, b: bytes, c: bool, d: biguint } = { a: (#5 = ({ a: g, d: i, b: _₃, c: _₄ } = { a: (#4 = tests/approvals/object-destructuring.algo.ts::produceItems()).a, d: #4.d, b: #4.b, c: #4.c })).a, b: #5.b, c: #5.c, d: #5.d } + tests/approvals/object-destructuring.algo.ts::receivePartial({ a: (#6 = tests/approvals/object-destructuring.algo.ts::produceItems()).a, d: #6.d }) +} +subroutine produceItems(): { a: uint64, b: bytes, c: bool, d: biguint } +{ + return { a: (#7 = { a: 1, b: "", c: False, d: 999 }).a, b: #7.b, c: #7.c, d: #7.d } +} +subroutine receivePartial(x: { a: uint64, d: biguint }): void +{ +} +subroutine testLiteralToLiteral(): void +{ + a: uint64 = 4 + b: uint64 = 1 + { a: e, b: f }: { a: uint64, b: uint64 } = ({ a: c, b: d } = { a: a, b: b }) +} +subroutine testNumericResolution(): void +{ + x: { a: uint64 } = (y = { a: (#8 = { a: 434 }).a }) +} +subroutine test2(args: { x: bool, y: bool, z: readonlytuple[string, string] }): void +{ + { a: a, b: b, args: { x: x, y: y, z: _ } }: { a: bool, b: bool, args: { x: bool, y: bool, z: readonlytuple[string, string] } } = { a: True, b: False, args: args } + args2: { x: bool, y: bool, z: readonlytuple[string, string] } = { x: True, y: True, z: args.z } +} \ No newline at end of file diff --git a/tests/approvals/out/object-destructuring/object-destructuring.awst.json b/tests/approvals/out/object-destructuring/object-destructuring.awst.json new file mode 100644 index 00000000..4f69a4ad --- /dev/null +++ b/tests/approvals/out/object-destructuring/object-destructuring.awst.json @@ -0,0 +1,8117 @@ +[ + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 4, + "end_line": 4, + "column": 0, + "end_column": 73 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "arg", + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 4, + "end_line": 4, + "column": 32, + "end_column": 72 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 4, + "end_line": 9, + "column": 74, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 5, + "end_line": 5, + "column": 8, + "end_column": 19 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 5, + "end_line": 5, + "column": 8, + "end_column": 19 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 5, + "end_line": 5, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "x" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 5, + "end_line": 5, + "column": 8, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 5, + "end_line": 5, + "column": 8, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₁" + } + ] + }, + "value": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 5, + "end_line": 5, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "name": "arg" + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 6, + "end_line": 8, + "column": 8, + "end_column": 21 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 6, + "end_line": 8, + "column": 8, + "end_column": 21 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x", + "z" + ] + } + ], + "names": [ + "nested" + ] + }, + "items": [ + { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 6, + "end_line": 8, + "column": 8, + "end_column": 21 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x", + "z" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 7, + "end_line": 7, + "column": 14, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "y" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 6, + "end_line": 8, + "column": 8, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₂" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 6, + "end_line": 8, + "column": 8, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₃" + } + ] + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 6, + "end_column": 21 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x", + "z" + ] + } + ], + "names": [ + "nested" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 6, + "end_column": 21 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x", + "z" + ] + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 6, + "end_column": 21 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x", + "z" + ] + } + ], + "names": [ + "nested" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 6, + "end_column": 21 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x", + "z" + ] + } + ], + "names": [ + "nested" + ] + }, + "items": [ + { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "y", + "x", + "z" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "name": "arg" + }, + "name": "y" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "name": "arg" + }, + "name": "x" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 8, + "end_line": 8, + "column": 16, + "end_column": 19 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "name": "arg" + }, + "name": "z" + } + ] + } + ] + }, + "id": "2" + }, + "name": "nested" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/object-destructuring.algo.ts::testPartialDestructure", + "name": "testPartialDestructure" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 11, + "end_line": 11, + "column": 0, + "end_column": 15 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 11, + "end_line": 17, + "column": 16, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 12, + "end_line": 12, + "column": 8, + "end_column": 39 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 12, + "end_line": 12, + "column": 8, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 12, + "end_line": 12, + "column": 10, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 12, + "end_line": 12, + "column": 13, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "b" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 12, + "end_line": 12, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "c" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 12, + "end_line": 12, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "d" + } + ] + }, + "value": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 12, + "end_line": 12, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 33 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "d", + "a", + "b", + "c" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 13, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "e" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "_₁" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₂" + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "d", + "a", + "b", + "c" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "3" + }, + "name": "d" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "3" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "3" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 13, + "end_line": 13, + "column": 19, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "3" + }, + "name": "c" + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 8, + "end_column": 45 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "name": "f" + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "source": { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "g" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 24, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "i" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "_₃" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₄" + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "d" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "c" + } + ] + } + }, + "id": "5" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "source": { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "g" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 24, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "i" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "_₃" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₄" + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "d" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "c" + } + ] + } + }, + "id": "5" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "source": { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "g" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 24, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "i" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "_₃" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₄" + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "d" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "c" + } + ] + } + }, + "id": "5" + }, + "name": "c" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "source": { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 18, + "end_column": 19 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "g" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 24, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "i" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "name": "_₃" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 13, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "_₄" + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "d", + "b", + "c" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "d" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 15, + "end_line": 15, + "column": 30, + "end_column": 44 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "4" + }, + "name": "c" + } + ] + } + }, + "id": "5" + }, + "name": "d" + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 32 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 2, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::receivePartial" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 17, + "end_column": 31 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "d" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 17, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 17, + "end_column": 31 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 17, + "end_column": 31 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "6" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 17, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 17, + "end_column": 31 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 16, + "end_line": 16, + "column": 17, + "end_column": 31 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/object-destructuring.algo.ts::produceItems" + }, + "args": [] + }, + "id": "6" + }, + "name": "d" + } + ] + } + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/object-destructuring.algo.ts::test", + "name": "test" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 19, + "end_line": 19, + "column": 0, + "end_column": 72 + }, + "args": [], + "return_type": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 19, + "end_line": 26, + "column": 73, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 2, + "end_column": 3 + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 21, + "end_line": 21, + "column": 7, + "end_column": 8 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 22, + "end_line": 22, + "column": 13, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 23, + "end_line": 23, + "column": 7, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 24, + "end_line": 24, + "column": 7, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "999", + "teal_alias": null + } + ] + }, + "id": "7" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 21, + "end_line": 21, + "column": 7, + "end_column": 8 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 22, + "end_line": 22, + "column": 13, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 23, + "end_line": 23, + "column": 7, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 24, + "end_line": 24, + "column": 7, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "999", + "teal_alias": null + } + ] + }, + "id": "7" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 21, + "end_line": 21, + "column": 7, + "end_column": 8 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 22, + "end_line": 22, + "column": 13, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 23, + "end_line": 23, + "column": 7, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 24, + "end_line": 24, + "column": 7, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "999", + "teal_alias": null + } + ] + }, + "id": "7" + }, + "name": "c" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 20, + "end_line": 25, + "column": 9, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "b", + "c", + "d" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 21, + "end_line": 21, + "column": 7, + "end_column": 8 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + }, + { + "_type": "BytesConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 22, + "end_line": 22, + "column": 13, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bytes", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "", + "encoding": "utf8" + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 23, + "end_line": 23, + "column": 7, + "end_column": 12 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 24, + "end_line": 24, + "column": 7, + "end_column": 11 + }, + "wtype": { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + "value": "999", + "teal_alias": null + } + ] + }, + "id": "7" + }, + "name": "d" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/object-destructuring.algo.ts::produceItems", + "name": "produceItems" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 28, + "end_line": 28, + "column": 0, + "end_column": 53 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "x", + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "biguint", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ], + "names": [ + "a", + "d" + ] + }, + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 28, + "end_line": 28, + "column": 24, + "end_column": 52 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 28, + "end_line": 28, + "column": 54, + "end_column": 56 + }, + "body": [], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/object-destructuring.algo.ts::receivePartial", + "name": "receivePartial" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 30, + "end_line": 30, + "column": 0, + "end_column": 31 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 30, + "end_line": 37, + "column": 32, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 31, + "end_line": 31, + "column": 8, + "end_column": 21 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 31, + "end_line": 31, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 31, + "end_line": 31, + "column": 20, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "4", + "teal_alias": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 32, + "end_line": 32, + "column": 8, + "end_column": 21 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 32, + "end_line": 32, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + }, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 32, + "end_line": 32, + "column": 20, + "end_column": 21 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "1", + "teal_alias": null + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 8, + "end_column": 52 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 8, + "end_column": 52 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 13, + "end_column": 14 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "e" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 19, + "end_column": 20 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "f" + } + ] + }, + "value": { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 26, + "end_column": 51 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 26, + "end_column": 51 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 31, + "end_column": 32 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "c" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 37, + "end_column": 38 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "d" + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 43, + "end_column": 51 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 45, + "end_column": 46 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 36, + "end_line": 36, + "column": 48, + "end_column": 49 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + ] + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/object-destructuring.algo.ts::testLiteralToLiteral", + "name": "testLiteralToLiteral" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 39, + "end_line": 39, + "column": 0, + "end_column": 32 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 39, + "end_line": 42, + "column": 33, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 8, + "end_column": 43 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a" + ] + }, + "name": "x" + }, + "value": { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 28, + "end_column": 42 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a" + ] + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 28, + "end_column": 29 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a" + ] + }, + "name": "y" + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 32, + "end_column": 42 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 32, + "end_column": 42 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 32, + "end_column": 42 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 32, + "end_column": 42 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 41, + "end_line": 41, + "column": 37, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "434", + "teal_alias": null + } + ] + }, + "id": "8" + }, + "name": "a" + } + ] + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/object-destructuring.algo.ts::testNumericResolution", + "name": "testNumericResolution" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 44, + "end_line": 44, + "column": 0, + "end_column": 78 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "args", + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 44, + "end_line": 44, + "column": 15, + "end_column": 77 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 44, + "end_line": 52, + "column": 79, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 45, + "end_line": 49, + "column": 8, + "end_column": 33 + }, + "target": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 45, + "end_line": 49, + "column": 8, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + } + ], + "names": [ + "a", + "b", + "args" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 46, + "end_line": 46, + "column": 4, + "end_column": 5 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "a" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 47, + "end_line": 47, + "column": 4, + "end_column": 5 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + }, + { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 45, + "end_line": 49, + "column": 8, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "items": [ + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 48, + "end_line": 48, + "column": 12, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "x" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 48, + "end_line": 48, + "column": 15, + "end_column": 16 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "y" + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 45, + "end_line": 49, + "column": 8, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + }, + "name": "_" + } + ] + } + ] + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 49, + "end_line": 49, + "column": 6, + "end_column": 33 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + } + ], + "names": [ + "a", + "b", + "args" + ] + }, + "items": [ + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 49, + "end_line": 49, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 49, + "end_line": 49, + "column": 20, + "end_column": 25 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": false + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 49, + "end_line": 49, + "column": 27, + "end_column": 31 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "name": "args" + } + ] + } + }, + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 51, + "end_line": 51, + "column": 8, + "end_column": 45 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 51, + "end_line": 51, + "column": 8, + "end_column": 13 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "name": "args2" + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 51, + "end_line": 51, + "column": 16, + "end_column": 45 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "items": [ + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 51, + "end_line": 51, + "column": 30, + "end_column": 34 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + }, + { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 51, + "end_line": 51, + "column": 39, + "end_column": 43 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 51, + "end_line": 51, + "column": 16, + "end_column": 45 + }, + "wtype": { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/object-destructuring.algo.ts", + "line": 51, + "end_line": 51, + "column": 21, + "end_column": 25 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WTuple", + "name": "tuple", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + }, + { + "_type": "WType", + "name": "string", + "immutable": true, + "ephemeral": false, + "scalar_type": 1 + } + ] + } + ], + "names": [ + "x", + "y", + "z" + ] + }, + "name": "args" + }, + "name": "z" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/object-destructuring.algo.ts::test2", + "name": "test2" + } +] \ No newline at end of file diff --git a/tests/approvals/out/prefix-postfix-operators.awst b/tests/approvals/out/prefix-postfix-operators/prefix-postfix-operators.awst similarity index 100% rename from tests/approvals/out/prefix-postfix-operators.awst rename to tests/approvals/out/prefix-postfix-operators/prefix-postfix-operators.awst diff --git a/tests/approvals/out/prefix-postfix-operators.awst.json b/tests/approvals/out/prefix-postfix-operators/prefix-postfix-operators.awst.json similarity index 99% rename from tests/approvals/out/prefix-postfix-operators.awst.json rename to tests/approvals/out/prefix-postfix-operators/prefix-postfix-operators.awst.json index 9673c0d2..6e1808dc 100644 --- a/tests/approvals/out/prefix-postfix-operators.awst.json +++ b/tests/approvals/out/prefix-postfix-operators/prefix-postfix-operators.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/prefix-postfix-operators.algo.ts", "line": 3, - "end_line": 10, + "end_line": 3, "column": 0, - "end_column": 1 + "end_column": 42 }, "args": [ { @@ -535,9 +535,9 @@ "source_location": { "file": "tests/approvals/prefix-postfix-operators.algo.ts", "line": 11, - "end_line": 17, + "end_line": 11, "column": 0, - "end_column": 1 + "end_column": 45 }, "args": [ { @@ -1024,9 +1024,9 @@ "source_location": { "file": "tests/approvals/prefix-postfix-operators.algo.ts", "line": 18, - "end_line": 20, + "end_line": 18, "column": 0, - "end_column": 1 + "end_column": 29 }, "args": [ { diff --git a/tests/approvals/out/property-ordering/Demo.ssa.ir b/tests/approvals/out/property-ordering/Demo.ssa.ir new file mode 100644 index 00000000..cc975cf3 --- /dev/null +++ b/tests/approvals/out/property-ordering/Demo.ssa.ir @@ -0,0 +1,34 @@ +contract tests/approvals/property-ordering.algo.ts::Demo: + program approval: + subroutine tests/approvals/property-ordering.algo.ts::Demo.approvalProgram() -> bool: + block@0: // L19 + let reinterpret_bool%0#0: bool = (txn ApplicationID) + goto reinterpret_bool%0#0 ? block@2 : block@1 + block@1: // if_body_L1 + tests/approvals/property-ordering.algo.ts::Demo.constructor() + goto block@2 + block@2: // after_if_else_L1 + tests/approvals/property-ordering.algo.ts::test_assign_from_literal(4u) + tests/approvals/property-ordering.algo.ts::test_assign_from_var(3u, 4u) + return 1u + + subroutine tests/approvals/property-ordering.algo.ts::Demo.constructor() -> void: + block@0: // L18 + return + + subroutine tests/approvals/property-ordering.algo.ts::test_assign_from_literal(x: uint64) -> void: + block@0: // L10 + let b#0: uint64 = (* x#0 2u) + let b#1: uint64 = (* x#0 2u) + let (obj.a#0: uint64, obj.z#0: uint64) = (b#0, b#1) + return + + subroutine tests/approvals/property-ordering.algo.ts::test_assign_from_var(x.a: uint64, x.b: uint64) -> void: + block@0: // L6 + let (obj.b#0: uint64, obj.a#0: uint64) = (x.b#0, x.a#0) + return + + program clear-state: + subroutine @algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract.clearStateProgram() -> bool: + block@0: // L1 + return 1u \ No newline at end of file diff --git a/tests/approvals/out/property-ordering/property-ordering.awst b/tests/approvals/out/property-ordering/property-ordering.awst new file mode 100644 index 00000000..cbbc3c74 --- /dev/null +++ b/tests/approvals/out/property-ordering/property-ordering.awst @@ -0,0 +1,36 @@ +subroutine test_assign_from_var(x: { a: uint64, b: uint64 }): void +{ + obj: BthenA{ b: uint64, a: uint64 } = { b: x.b, a: x.a } +} +subroutine test_assign_from_literal(x: uint64): void +{ + obj: { a: uint64, z: uint64 } = { a: (#0 = { z: (b = x * 2), a: b }).a, z: #0.z } +} +contract Demo +{ + approvalProgram(): bool + { + if (!Boolean(txn())) { + this.constructor() + } + tests/approvals/property-ordering.algo.ts::test_assign_from_literal(4) + tests/approvals/property-ordering.algo.ts::test_assign_from_var({ a: (#1 = { a: 3, b: 4 }).a, b: #1.b }) + return True + } + + clearProgram(): bool + { + return True + } + + constructor(): void + { + void + } + + Contract::constructor(): void + { + this.constructor() + } + +} \ No newline at end of file diff --git a/tests/approvals/out/property-ordering/property-ordering.awst.json b/tests/approvals/out/property-ordering/property-ordering.awst.json new file mode 100644 index 00000000..be37efda --- /dev/null +++ b/tests/approvals/out/property-ordering/property-ordering.awst.json @@ -0,0 +1,1679 @@ +[ + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 6, + "end_line": 6, + "column": 0, + "end_column": 58 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "x", + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 6, + "end_line": 6, + "column": 30, + "end_column": 57 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 6, + "end_line": 8, + "column": 59, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 7, + "end_line": 7, + "column": 8, + "end_column": 23 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 7, + "end_line": 7, + "column": 8, + "end_column": 11 + }, + "wtype": { + "_type": "WTuple", + "name": "BthenA", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "b", + "a" + ] + }, + "name": "obj" + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 7, + "end_line": 7, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WTuple", + "name": "BthenA", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "b", + "a" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 7, + "end_line": 7, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 7, + "end_line": 7, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "name": "x" + }, + "name": "b" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 7, + "end_line": 7, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 7, + "end_line": 7, + "column": 22, + "end_column": 23 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "name": "x" + }, + "name": "a" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/property-ordering.algo.ts::test_assign_from_var", + "name": "test_assign_from_var" + }, + { + "_type": "Subroutine", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 10, + "end_line": 10, + "column": 0, + "end_column": 44 + }, + "args": [ + { + "_type": "SubroutineArgument", + "name": "x", + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 10, + "end_line": 10, + "column": 34, + "end_column": 43 + } + } + ], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 10, + "end_line": 16, + "column": 45, + "end_column": 1 + }, + "body": [ + { + "_type": "AssignmentStatement", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 8, + "end_column": 3 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 12, + "column": 8, + "end_column": 11 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "z" + ] + }, + "name": "obj" + }, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 40, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "z" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 40, + "end_column": 3 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 40, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "z", + "a" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 40, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "z", + "a" + ] + }, + "items": [ + { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + }, + "value": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 12, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 12, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "x" + }, + "op": "*", + "right": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + } + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 14, + "end_line": 14, + "column": 7, + "end_column": 8 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + ] + }, + "id": "0" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 40, + "end_column": 3 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 40, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "z", + "a" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 12, + "end_line": 15, + "column": 40, + "end_column": 3 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "z", + "a" + ] + }, + "items": [ + { + "_type": "AssignmentExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "target": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 8, + "end_column": 9 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + }, + "value": { + "_type": "UInt64BinaryOperation", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 12, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "left": { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 12, + "end_column": 13 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "x" + }, + "op": "*", + "right": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 13, + "end_line": 13, + "column": 16, + "end_column": 17 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "2", + "teal_alias": null + } + } + }, + { + "_type": "VarExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 14, + "end_line": 14, + "column": 7, + "end_column": 8 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "name": "b" + } + ] + }, + "id": "0" + }, + "name": "z" + } + ] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "id": "tests/approvals/property-ordering.algo.ts::test_assign_from_literal", + "name": "test_assign_from_literal" + }, + { + "_type": "Contract", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 18, + "end_line": 18, + "column": 0, + "end_column": 40 + }, + "id": "tests/approvals/property-ordering.algo.ts::Demo", + "name": "Demo", + "description": null, + "method_resolution_order": [ + "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract" + ], + "approval_program": { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 19, + "end_line": 19, + "column": 2, + "end_column": 35 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "IfElse", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "condition": { + "_type": "Not", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "ReinterpretCast", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "expr": { + "_type": "IntrinsicCall", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "op_code": "txn", + "immediates": [ + "ApplicationID" + ], + "stack_args": [], + "comment": null + } + } + }, + "if_branch": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "else_branch": null + }, + { + "_type": "Block", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 19, + "end_line": 25, + "column": 36, + "end_column": 3 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 20, + "end_line": 20, + "column": 4, + "end_column": 31 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 20, + "end_line": 20, + "column": 4, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/property-ordering.algo.ts::test_assign_from_literal" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 20, + "end_line": 20, + "column": 29, + "end_column": 30 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "4", + "teal_alias": null + } + } + ] + } + }, + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 4, + "end_column": 40 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 4, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "SubroutineID", + "target": "tests/approvals/property-ordering.algo.ts::test_assign_from_var" + }, + "args": [ + { + "_type": "CallArg", + "name": null, + "value": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "3", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 36, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "4", + "teal_alias": null + } + ] + }, + "id": "1" + }, + "name": "a" + }, + { + "_type": "FieldExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "base": { + "_type": "SingleEvaluation", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "source": { + "_type": "TupleExpression", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 25, + "end_column": 39 + }, + "wtype": { + "_type": "WTuple", + "name": "", + "immutable": true, + "ephemeral": false, + "scalar_type": null, + "types": [ + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + } + ], + "names": [ + "a", + "b" + ] + }, + "items": [ + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 30, + "end_column": 31 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "3", + "teal_alias": null + }, + { + "_type": "IntegerConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 22, + "end_line": 22, + "column": 36, + "end_column": 37 + }, + "wtype": { + "_type": "WType", + "name": "uint64", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": "4", + "teal_alias": null + } + ] + }, + "id": "1" + }, + "name": "b" + } + ] + } + } + ] + } + }, + { + "_type": "ReturnStatement", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 24, + "end_line": 24, + "column": 4, + "end_column": 15 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 24, + "end_line": 24, + "column": 11, + "end_column": 15 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/property-ordering.algo.ts::Demo", + "member_name": "approvalProgram", + "arc4_method_config": null + }, + "clear_program": { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ReturnStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "value": { + "_type": "BoolConstant", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "bool", + "immutable": true, + "ephemeral": false, + "scalar_type": 2 + }, + "value": true + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/base-contract.d.ts::BaseContract", + "member_name": "clearStateProgram", + "arc4_method_config": null + }, + "methods": [ + { + "_type": "ContractMethod", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 18, + "end_line": 18, + "column": 0, + "end_column": 40 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 18, + "end_line": 18, + "column": 0, + "end_column": 40 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 18, + "end_line": 18, + "column": 0, + "end_column": 40 + }, + "expr": { + "_type": "VoidConstant", + "source_location": { + "file": "tests/approvals/property-ordering.algo.ts", + "line": 18, + "end_line": 18, + "column": 0, + "end_column": 40 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + } + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "tests/approvals/property-ordering.algo.ts::Demo", + "member_name": "constructor", + "arc4_method_config": null + }, + { + "_type": "ContractMethod", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "args": [], + "return_type": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "body": { + "_type": "Block", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "body": [ + { + "_type": "ExpressionStatement", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "expr": { + "_type": "SubroutineCallExpression", + "source_location": { + "_type": "SourceLocation", + "file": null, + "line": 1, + "end_line": 1, + "column": 0, + "end_column": 1 + }, + "wtype": { + "_type": "WType", + "name": "void", + "immutable": true, + "ephemeral": false, + "scalar_type": null + }, + "target": { + "_type": "InstanceMethodTarget", + "member_name": "constructor" + }, + "args": [] + } + } + ], + "label": null, + "comment": null + }, + "documentation": { + "_type": "MethodDocumentation", + "description": null, + "args": {}, + "returns": null + }, + "cref": "@algorandfoundation/algorand-typescript/arc4/index.d.ts::Contract", + "member_name": "constructor", + "arc4_method_config": null + } + ], + "app_state": [], + "state_totals": { + "globalBytes": null, + "globalUints": null, + "localBytes": null, + "localUints": null + }, + "reserved_scratch_space": [] + } +] \ No newline at end of file diff --git a/tests/approvals/out/shadowed-variables.awst b/tests/approvals/out/shadowed-variables/shadowed-variables.awst similarity index 100% rename from tests/approvals/out/shadowed-variables.awst rename to tests/approvals/out/shadowed-variables/shadowed-variables.awst diff --git a/tests/approvals/out/shadowed-variables.awst.json b/tests/approvals/out/shadowed-variables/shadowed-variables.awst.json similarity index 98% rename from tests/approvals/out/shadowed-variables.awst.json rename to tests/approvals/out/shadowed-variables/shadowed-variables.awst.json index 204cc82f..169733ba 100644 --- a/tests/approvals/out/shadowed-variables.awst.json +++ b/tests/approvals/out/shadowed-variables/shadowed-variables.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/shadowed-variables.algo.ts", "line": 6, - "end_line": 11, + "end_line": 6, "column": 0, - "end_column": 1 + "end_column": 23 }, "args": [ { @@ -50,9 +50,9 @@ "source_location": { "file": "tests/approvals/shadowed-variables.algo.ts", "line": 7, - "end_line": 10, + "end_line": 7, "column": 2, - "end_column": 3 + "end_column": 8 }, "condition": { "_type": "ReinterpretCast", diff --git a/tests/approvals/out/switch-statements.awst b/tests/approvals/out/switch-statements/switch-statements.awst similarity index 100% rename from tests/approvals/out/switch-statements.awst rename to tests/approvals/out/switch-statements/switch-statements.awst diff --git a/tests/approvals/out/switch-statements.awst.json b/tests/approvals/out/switch-statements/switch-statements.awst.json similarity index 99% rename from tests/approvals/out/switch-statements.awst.json rename to tests/approvals/out/switch-statements/switch-statements.awst.json index 75ad59ff..d9385824 100644 --- a/tests/approvals/out/switch-statements.awst.json +++ b/tests/approvals/out/switch-statements/switch-statements.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/switch-statements.algo.ts", "line": 4, - "end_line": 14, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 39 }, "args": [ { @@ -358,9 +358,9 @@ "source_location": { "file": "tests/approvals/switch-statements.algo.ts", "line": 16, - "end_line": 28, + "end_line": 16, "column": 0, - "end_column": 1 + "end_column": 38 }, "args": [ { @@ -939,9 +939,9 @@ "source_location": { "file": "tests/approvals/switch-statements.algo.ts", "line": 30, - "end_line": 39, + "end_line": 30, "column": 0, - "end_column": 1 + "end_column": 36 }, "args": [ { diff --git a/tests/approvals/out/while-loops.awst b/tests/approvals/out/while-loops/while-loops.awst similarity index 100% rename from tests/approvals/out/while-loops.awst rename to tests/approvals/out/while-loops/while-loops.awst diff --git a/tests/approvals/out/while-loops.awst.json b/tests/approvals/out/while-loops/while-loops.awst.json similarity index 99% rename from tests/approvals/out/while-loops.awst.json rename to tests/approvals/out/while-loops/while-loops.awst.json index 335af335..5f358fc8 100644 --- a/tests/approvals/out/while-loops.awst.json +++ b/tests/approvals/out/while-loops/while-loops.awst.json @@ -4,9 +4,9 @@ "source_location": { "file": "tests/approvals/while-loops.algo.ts", "line": 4, - "end_line": 9, + "end_line": 4, "column": 0, - "end_column": 1 + "end_column": 33 }, "args": [ { diff --git a/tests/approvals/property-ordering.algo.ts b/tests/approvals/property-ordering.algo.ts new file mode 100644 index 00000000..d6eb65d7 --- /dev/null +++ b/tests/approvals/property-ordering.algo.ts @@ -0,0 +1,26 @@ +import type { uint64 } from '@algorandfoundation/algorand-typescript' +import { BaseContract } from '@algorandfoundation/algorand-typescript' + +type BthenA = { b: uint64; a: uint64 } + +function test_assign_from_var(x: { a: uint64; b: uint64 }) { + const obj: BthenA = x +} + +function test_assign_from_literal(x: uint64) { + let b: uint64 + const obj: { a: uint64; z: uint64 } = { + z: (b = x * 2), + a: b, + } +} + +export class Demo extends BaseContract { + public approvalProgram(): boolean { + test_assign_from_literal(4) + + test_assign_from_var({ a: 3, b: 4 }) + + return true + } +} diff --git a/tests/expected-output/cant-create.algo.ts b/tests/expected-output/cant-create.algo.ts new file mode 100644 index 00000000..77492cd7 --- /dev/null +++ b/tests/expected-output/cant-create.algo.ts @@ -0,0 +1,16 @@ +import { Contract } from '@algorandfoundation/algorand-typescript' +import { baremethod } from '@algorandfoundation/algorand-typescript/arc4' + +// @expect-error Non-abstract ARC4 contract has no methods which can be called to create the contract... +export class CantCreate extends Contract { + @baremethod({ allowActions: 'NoOp' }) + public handleBare() {} +} + +abstract class CantCreateAbstract extends Contract { + @baremethod({ allowActions: 'NoOp' }) + public handleBare() {} +} + +// @expect-error Non-abstract ARC4 contract has no methods which can be called to create the contract... +export class CantCreateBecauseBase extends CantCreateAbstract {} diff --git a/tests/onchain/abi-decorators.spec.ts b/tests/onchain/abi-decorators.spec.ts new file mode 100644 index 00000000..351e7cc6 --- /dev/null +++ b/tests/onchain/abi-decorators.spec.ts @@ -0,0 +1,17 @@ +import { describe } from 'vitest' +import { createArc4TestFixture } from './util/test-fixture' + +describe('abi-decorators', () => { + const test = createArc4TestFixture('tests/approvals/abi-decorators.algo.ts', { + AbiDecorators: { deployParams: { createParams: { method: 'createMethod' } } }, + }) + test('can be created', async ({ appFactoryAbiDecorators }) => { + await appFactoryAbiDecorators.send.create({ method: 'createMethod' }) + }) + test('methods can be called', async ({ appClientAbiDecorators: appClient, expect }) => { + await appClient.send.call({ method: 'justNoop' }) + await appClient.send.call({ method: 'allActions', onComplete: 1 }) + const { return: returnValue } = await appClient.send.call({ method: 'overrideReadonlyName' }) + expect(returnValue).toBe(5n) + }) +}) diff --git a/tests/onchain/accounts.spec.ts b/tests/onchain/accounts.spec.ts new file mode 100644 index 00000000..d57e54dc --- /dev/null +++ b/tests/onchain/accounts.spec.ts @@ -0,0 +1,32 @@ +import { describe } from 'vitest' +import { createArc4TestFixture } from './util/test-fixture' + +describe('accounts', () => { + const test = createArc4TestFixture('tests/approvals/accounts.algo.ts', { AccountsContract: {} }) + + test('returns account data', async ({ appClientAccountsContract: appClient, expect, assetFactory, testAccount }) => { + const asset = await assetFactory({ assetName: 'Asset 1', sender: testAccount.addr, total: 1n }) + + const result = await appClient.send.call({ method: 'getAccountInfo', args: [testAccount.addr, asset] }) + + const returnValue = result.return as { + bytes: number[] + balance: bigint + minBalance: bigint + authAddress: number[] + totalNumUint: bigint + totalNumByteSlice: bigint + totalExtraAppPages: bigint + totalAppsCreated: bigint + totalAppsOptedIn: bigint + totalAssetsCreated: bigint + totalAssets: bigint + totalBoxes: bigint + totalBoxBytes: bigint + isOptInApp: boolean + isOptInAsset: boolean + } + + expect(returnValue.authAddress).toStrictEqual(new Array(32).fill(0)) + }) +}) diff --git a/tests/onchain/arc4-types.spec.ts b/tests/onchain/arc4-types.spec.ts new file mode 100644 index 00000000..275c5bcb --- /dev/null +++ b/tests/onchain/arc4-types.spec.ts @@ -0,0 +1,10 @@ +import { describe } from 'vitest' +import { createBaseTestFixture } from './util/test-fixture' + +describe('arc4-types', () => { + const test = createBaseTestFixture('tests/approvals/arc4-types.algo.ts', ['Arc4TypesTestContract']) + + test('runs', async ({ Arc4TypesTestContractInvoker, expect, assetFactory, testAccount }) => { + await Arc4TypesTestContractInvoker.send() + }) +}) diff --git a/tests/onchain/implicit-create.spec.ts b/tests/onchain/implicit-create.spec.ts new file mode 100644 index 00000000..63ed0ffa --- /dev/null +++ b/tests/onchain/implicit-create.spec.ts @@ -0,0 +1,26 @@ +import { describe, expect } from 'vitest' +import { createArc4TestFixture } from './util/test-fixture' + +describe('implicit-create', () => { + const test = createArc4TestFixture('tests/approvals/implicit-create.algo.ts', { + NoBare: {}, + NoNoOp: {}, + ExplicitBareCreateFromBase: {}, + ExplicitAbiCreateFromBase: {}, + }) + test('NoBare can be created', async ({ appFactoryNoBare }) => { + await appFactoryNoBare.send.bare.create() + }) + test('NoNoOp can be created', async ({ appFactoryNoNoOp }) => { + await appFactoryNoNoOp.send.bare.create() + }) + test('ExplicitBareCreateFromBase can be created', async ({ appFactoryExplicitBareCreateFromBase }) => { + await appFactoryExplicitBareCreateFromBase.send.bare.create() + }) + test("ExplicitAbiCreateFromBase can't be created with bare", async ({ appFactoryExplicitAbiCreateFromBase }) => { + await expect(() => appFactoryExplicitAbiCreateFromBase.send.bare.create()).rejects.toThrowError() + }) + test('ExplicitAbiCreateFromBase can be created with abi', async ({ appFactoryExplicitAbiCreateFromBase }) => { + await appFactoryExplicitAbiCreateFromBase.send.create({ method: 'create' }) + }) +}) diff --git a/tests/onchain/util/test-fixture.ts b/tests/onchain/util/test-fixture.ts new file mode 100644 index 00000000..4b2ebc8b --- /dev/null +++ b/tests/onchain/util/test-fixture.ts @@ -0,0 +1,231 @@ +import { Config, microAlgos } from '@algorandfoundation/algokit-utils' +import { algorandFixture } from '@algorandfoundation/algokit-utils/testing' +import type { SendAppTransactionResult } from '@algorandfoundation/algokit-utils/types/app' +import type { AppClient } from '@algorandfoundation/algokit-utils/types/app-client' +import type { AppFactory, AppFactoryDeployParams } from '@algorandfoundation/algokit-utils/types/app-factory' +import type { AppSpec } from '@algorandfoundation/algokit-utils/types/app-spec' +import type { AssetCreateParams } from '@algorandfoundation/algokit-utils/types/composer' +import { nullLogger } from '@algorandfoundation/algokit-utils/types/logging' +import type { AlgorandFixture } from '@algorandfoundation/algokit-utils/types/testing' +import type { Use } from '@vitest/runner/types' +import { OnApplicationComplete } from 'algosdk' +import fs from 'fs' +import type { ExpectStatic } from 'vitest' +import { test } from 'vitest' +import { compile } from '../../../src' +import { buildCompileOptions } from '../../../src/compile-options' +import { LoggingContext, LogLevel } from '../../../src/logger' +import { defaultPuyaOptions } from '../../../src/puya/options' +import type { DeliberateAny } from '../../../src/typescript-helpers' +import { invariant } from '../../../src/util' +import { generateTempDir } from '../../../src/util/generate-temp-file' + +const algorandTestFixture = (localnetFixture: AlgorandFixture) => + test.extend<{ + localnet: AlgorandFixture + testAccount: AlgorandFixture['context']['testAccount'] + assetFactory: (assetCreateParams: AssetCreateParams) => Promise + }>({ + localnet: async ({ expect }, use) => { + await localnetFixture.beforeEach() + await use(localnetFixture) + }, + testAccount: async ({ localnet }, use) => { + await use(localnet.context.testAccount) + }, + assetFactory: async ({ localnet }, use) => { + use(async (assetCreateParams: AssetCreateParams) => { + const { assetId } = await localnet.algorand.send.assetCreate(assetCreateParams) + return assetId + }) + }, + }) + +function createLazyCompiler(path: string) { + let result: CompilationArtifacts | undefined = undefined + return { + getCompileResult(expect: ExpectStatic) { + if (!result) result = compilePath(path, expect) + return result + }, + } +} +type ProgramInvokeOptions = { + appId?: bigint + onComplete: + | OnApplicationComplete.NoOpOC + | OnApplicationComplete.OptInOC + | OnApplicationComplete.CloseOutOC + | OnApplicationComplete.ClearStateOC + | OnApplicationComplete.UpdateApplicationOC + | OnApplicationComplete.DeleteApplicationOC + senderAddr: string + args: Uint8Array[] +} + +type ProgramInvoker = { + send(options?: ProgramInvokeOptions): Promise +} + +type BaseFixtureContextFor = { + [key in T as `${key}Invoker`]: ProgramInvoker +} +export function createBaseTestFixture(path: string, contracts: TContracts[]) { + const lazyCompile = createLazyCompiler(path) + const localnet = algorandFixture({ + testAccountFunding: microAlgos(100_000_000_000), + }) + + Config.configure({ + logger: nullLogger, + }) + + const ctx: DeliberateAny = {} + for (const contractName of contracts) { + ctx[`${contractName}Invoker`] = async ( + { expect, localnet }: { expect: ExpectStatic; localnet: AlgorandFixture }, + use: Use, + ) => { + const compiled = lazyCompile.getCompileResult(expect) + + const approvalProgram = compiled.approvalBinaries[contractName] + const clearStateProgram = compiled.clearStateBinaries[contractName] + invariant(approvalProgram, `No approval program found for ${contractName}`) + invariant(clearStateProgram, `No clear state program found for ${contractName}`) + + use({ + async send(options?: ProgramInvokeOptions) { + const common = { + onComplete: options?.onComplete ?? OnApplicationComplete.NoOpOC, + appId: options?.appId ?? 0n, + approvalProgram, + clearStateProgram, + sender: options?.senderAddr ?? localnet.context.testAccount.addr, + args: options?.args ?? [], + } + return localnet.algorand.send.appCall(common as DeliberateAny) + }, + }) + } + } + return algorandTestFixture(localnet).extend>(ctx) +} + +type Arc4FixtureContextFor = { + [key in T as `appFactory${key}`]: AppFactory +} & { + [key in T as `appClient${key}`]: AppClient +} + +type ContractConfig = { + deployParams?: AppFactoryDeployParams +} + +export function createArc4TestFixture(path: string, contracts: Record) { + const lazyCompile = createLazyCompiler(path) + const localnet = algorandFixture({ + testAccountFunding: microAlgos(100_000_000_000), + }) + + Config.configure({ + logger: nullLogger, + }) + + const ctx: DeliberateAny = {} + for (const [contractName, config] of Object.entries(contracts) as Array<[TContracts, ContractConfig]>) { + ctx[`appFactory${contractName}`] = async ( + { expect, localnet }: { expect: ExpectStatic; localnet: AlgorandFixture }, + use: Use, + ) => { + const appSpec = lazyCompile.getCompileResult(expect).appSpecs.find((s) => s.contract.name === contractName) + if (appSpec === undefined) { + expect.fail(`${path} does not contain an ARC4 contract "${contractName}"`) + } + await use( + localnet.algorand.client.getAppFactory({ + defaultSender: localnet.context.testAccount.addr, + appSpec: appSpec!, + }), + ) + } + ctx[`appClient${contractName}`] = async ( + { expect, localnet }: { expect: ExpectStatic; localnet: AlgorandFixture }, + use: Use, + ) => { + const appSpec = lazyCompile.getCompileResult(expect).appSpecs.find((s) => s.contract.name === contractName) + if (appSpec === undefined) { + expect.fail(`${path} does not contain an ARC4 contract "${contractName}"`) + } + const appFactory = localnet.algorand.client.getAppFactory({ + defaultSender: localnet.context.testAccount.addr, + appSpec: appSpec!, + }) + const { appClient } = await appFactory.deploy(config.deployParams ?? {}) + await use(appClient) + } + } + return algorandTestFixture(localnet).extend>(ctx) +} + +type CompilationArtifacts = { + appSpecs: AppSpec[] + approvalBinaries: Record + clearStateBinaries: Record +} + +function compilePath(path: string, expect: ExpectStatic): CompilationArtifacts { + using tempDir = generateTempDir() + using logCtx = LoggingContext.create() + + compile( + buildCompileOptions({ + outputAwstJson: false, + outputAwst: false, + paths: [path], + outDir: tempDir.dirPath, + dryRun: false, + logLevel: LogLevel.Error, + }), + { + ...defaultPuyaOptions, + outputTeal: false, + outputArc32: true, + outputBytecode: true, + }, + ) + for (const log of logCtx.logEvents) { + switch (log.level) { + case LogLevel.Error: + case LogLevel.Critical: + expect.fail(`Compilation error ${log.sourceLocation} [${log.level}]: ${log.message}`) + } + } + + const matchBinary = /(?[^\\/]+)\.(?(approval)|(clear))\.bin$/ + const appSpecs = new Array() + const approvalBinaries: Record = {} + const clearStateBinaries: Record = {} + for (const filePath of tempDir.files()) { + if (filePath.endsWith('.arc32.json')) { + appSpecs.push(JSON.parse(fs.readFileSync(filePath, 'utf-8'))) + } else { + const m = matchBinary.exec(filePath) + if (m?.groups) { + const { appName, programName } = m.groups + const binary = new Uint8Array(fs.readFileSync(filePath)) + if (programName === 'approval') { + approvalBinaries[appName] = binary + } else { + clearStateBinaries[appName] = binary + } + } + } + } + + //TODO: check log context for errors + return { + appSpecs, + approvalBinaries, + clearStateBinaries, + } +} diff --git a/vitest.config.mts b/vitest.config.mts index d385375a..615b636a 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -16,5 +16,6 @@ export default defineConfig({ ], test: { globals: true, + testTimeout: 20_000, }, })