tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
389 stars 106 forks source link

Tact internal compile error: expression 2079 already has a type #971

Open imartemy1524 opened 2 weeks ago

imartemy1524 commented 2 weeks ago

Are you using the latest released (or pre-released, a.k.a. "next") version?

Tact source code

https://github.com/imartemy1524/ton-invest-contract/tree/tact-error

Relevant Tact/build system log output

(node:70177) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Tact compilation failed
Error: [INTERNAL COMPILER ERROR]: Expression 2079 already has a type
Please report at https://github.com/tact-lang/tact/issues
    at throwInternalCompilerError (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/errors.js:86:11)
    at registerExpType (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveExpression.js:30:49)
    at resolveExpression (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveExpression.js:511:20)
    at resolveFieldAccess (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveExpression.js:244:11)
    at resolveExpression (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveExpression.js:514:20)
    at resolveFieldAccess (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveExpression.js:244:11)
    at resolveExpression (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveExpression.js:514:20)
    at processStatements (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveStatements.js:402:65)
    at processFunctionBody (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveStatements.js:443:17)
    at resolveStatements (/windows/projects/Tact/ton-investor/node_modules/@tact-lang/compiler/dist/types/resolveStatements.js:562:23)
Error: Could not find boc in tact compilation result
    at findTactBoc (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/compile/compile.js:84:15)
    at doCompileTact (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/compile/compile.js:117:18)
    at async doCompileInner (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/compile/compile.js:127:16)
    at async doCompile (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/compile/compile.js:142:17)
    at async buildOne (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/build.js:21:24)
    at async buildAll (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/build.js:62:9)
    at async build (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/cli/build.js:29:9)
    at async main (/windows/projects/Tact/ton-investor/node_modules/@ton/blueprint/dist/cli/cli.js:91:5)

What happened?

Tried to compile tact code, but got some unknown error.

What did you expect?

I expected to get error with stack, showing where the problem is

Steps to reproduce

git clone https://github.com/imartemy1524/ton-invest-contract --branch tact-error
cd ton-invest-contract
npm i
npx blueprint build --all

How do you run Tact?

Blueprint

Anything else?

No response

imartemy1524 commented 2 weeks ago

As I understood, the problem is in next code: This doesn't work:

        foreach(key, task in self.subtasks.tasks){
            if(!task.finished){
                curr += task.amount;
            }
        }

But this does:

        let tasks = self.subtasks.tasks;
        foreach(key, task in tasks){
            if(!task.finished){
                curr += task.amount;
            }
        }

....?????....