-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: ABI type inference - base type inference logic and inferred function inputs #1114
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… have to implement implicit generics
….toml Co-authored-by: Sérgio Torres <30977845+Torres-ssf@users.noreply.github.com>
…mat' into 1071-remove-usage-of-old-abi-format
…rnal comment on the code
Closed until there is completely no need for a CLI tool (after implementation of TS issue 32063). Will be revisited then. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: This PR is merging into branch
ns/feat/abi-type-inference
Due to the importance, size and impact of this PR and the subsequent PRs on the developer experience of users, I've created a separate feature branch feat/abi-type-inference into which all PRs will be merged. When we're satisfied with the results, we'll merge that branch into master.
Issue #1021 will serve as a reference where all the tasks related to this whole feature will be listed.
This PR represents a big improvement to the developer experience of our users and is a stepping stone to trimming down and eventually deleting the
abi-typegen
package altogether.The idea of this endeavor is to load the whole abi into the type system and parse it, which results in correct type safety of everything functions, their inputs and outputs, configurables, ...) on our
Interface
and program types:Contract
,Script
,Predicate
.This PR's scope is to make the functions and their inputs type safe on the
Interface
level. Subsequent PRs will deal with programs, configurables, and everything else relevant.In order to ensure that the type inference logic covers all use cases, I've used the ABIs found in
abi-typegen
and also added some examples from theexhaustiveExamples
sway project where it was necessary. For the time being, I've just copied these abis and referenced them in the tests. In the future this should be automated and based off of their sway programs directly so that the abis never get stale. The ABIs and their corresponding compilation tests can be found in theabi-coder/test/type-inference-tests
folder. These tests get run duringpretest
and the relevant changes to get them running are found inpackage.json
andtsconfig.json
.The type inference logic is located in the
type-inferrer
folder.