Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement local type inference for let statements #198

Merged
merged 12 commits into from
Jun 14, 2024

Conversation

Gusarich
Copy link
Member

resolves #161

@anton-trunov
Copy link
Member

Let's fix the merge conflict in CHANGELOG and move the tests to their new location

@Gusarich
Copy link
Member Author

@anton-trunov done

Copy link
Member

@anton-trunov anton-trunov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good! Let's add some more tests (see my comment below) and there is one concern with AST cloning

src/grammar/grammar.ohm Outdated Show resolved Hide resolved
src/test/e2e-emulated/contracts/local-type-inference.tact Outdated Show resolved Hide resolved
src/grammar/clone.ts Show resolved Hide resolved
@anton-trunov
Copy link
Member

There is a case when local type inference should break: let foo = null. It's not clear what type to assign to foo in this case, it can be any optional type, e.g. Int? or any map type, like map<Int, Int> or map<Address, Cell>, etc. We should add negative tests for things like that.

@Gusarich
Copy link
Member Author

@anton-trunov everything's done!

Copy link
Member

@anton-trunov anton-trunov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go!

@anton-trunov anton-trunov merged commit c66a567 into tact-lang:main Jun 14, 2024
3 checks passed
QwFRx added a commit to QwFRx/tact that referenced this pull request Jul 22, 2024
In Roadmap.md there was a line "let". The mistake is that the first letter in the sentence should be capitalized. 

I suggest fixing this problem by writing "Let" instead of "let".

Original:
"let-statements can now be used without an explicit type declaration and determine the type automatically if it was not specified: PR tact-lang#198 and PR tact-lang#438"
Improved:
"Let-statements can now be used without an explicit type declaration and determine the type automatically if it was not specified: PR tact-lang#198 and PR tact-lang#438"

Closes tact-lang#591

- [ ] I have updated CHANGELOG.md
- [ ] I have documented my contribution in Tact Docs: https://github.com/tact-lang/tact-docs/pull/PR-NUMBER
- [ ] I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
- [ ] I have run all the tests locally and no test failure was reported
- [ ] I have run the linter, formatter and spellchecker
- [ ] I did not do unrelated and/or undiscussed refactorings
@QwFRx QwFRx mentioned this pull request Jul 22, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local type inference
2 participants