From 07cdc25709996040815d78443cea04517c692eea Mon Sep 17 00:00:00 2001 From: Gusarich Date: Tue, 11 Jun 2024 20:12:47 +0300 Subject: [PATCH] fix --- src/grammar/grammar.ts | 2 +- .../__snapshots__/feature-local-type-inference.spec.ts.snap | 2 +- src/types/resolveStatements.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/grammar/grammar.ts b/src/grammar/grammar.ts index b3fdbdc17..4e5eab083 100644 --- a/src/grammar/grammar.ts +++ b/src/grammar/grammar.ts @@ -596,7 +596,7 @@ semantics.addOperation("astOfStatement", { return createNode({ kind: "statement_let_no_type", name: arg1.sourceString, - expression: arg3.resolve_expression(), + expression: arg3.astOfExpression(), ref: createRef(this), }); }, diff --git a/src/test/__snapshots__/feature-local-type-inference.spec.ts.snap b/src/test/__snapshots__/feature-local-type-inference.spec.ts.snap index a61db0b3d..b649a1459 100644 --- a/src/test/__snapshots__/feature-local-type-inference.spec.ts.snap +++ b/src/test/__snapshots__/feature-local-type-inference.spec.ts.snap @@ -40,7 +40,7 @@ exports[`feature-local-type-inference should automatically set types for let sta "message": "Masterchain support is not enabled for this contract", }, "2": { - "message": "Stack undeflow", + "message": "Stack underflow", }, "3": { "message": "Stack overflow", diff --git a/src/types/resolveStatements.ts b/src/types/resolveStatements.ts index 587a213e6..e82813a1b 100644 --- a/src/types/resolveStatements.ts +++ b/src/types/resolveStatements.ts @@ -193,7 +193,7 @@ function processStatements( const expressionType = getExpType(ctx, s.expression); // Add variable to statement context - if (sctx.vars[s.name]) { + if (sctx.vars.has(s.name)) { throwError(`Variable already exists: ${s.name}`, s.ref); } sctx = addVariable(s.name, expressionType, sctx);