feat(move): Move view functions (verifier implementation)#11359
Draft
lollobene wants to merge 2 commits intovm-lang/6548-move-view-functionsfrom
Draft
feat(move): Move view functions (verifier implementation)#11359lollobene wants to merge 2 commits intovm-lang/6548-move-view-functionsfrom
lollobene wants to merge 2 commits intovm-lang/6548-move-view-functionsfrom
Conversation
Refactoring Disallow mutable params in view funcs Validate view function parameters for mutability and refine type checks. view_param_ty now receives parameter mutability and emits diagnostics for mutable-by-value or mutable-reference parameters in #[view] functions; an unreachable is added for inconsistent mutable ref cases. contains_user_defined_type_by_value and contains_paramtetric_object_ty were tightened to inspect abilities (copy/drop) and to treat vectors/funcs appropriately. Added new tests (string.move/string.snap) and updated invalid test/snapshot to cover the new diagnostics and line changes. View parameter refined Add '#[view]' lint and signature/type checks Introduce unified handling and checks for the IOTA '#[view]' attribute across the compiler. Changes include: - Linter: consolidate view diagnostics into a single VIEW_FUNCTION code/filter, update diagnostic message and notes, and refactor the view-function visitor to only warn for public functions that satisfy view constraints. Add new tests and update snapshots to reflect the new diagnostic text and filter name. - Typing: add view_signature and view_param_ty validations during typing to enforce public visibility, non-void returns, disallow returning or taking objects by value, disallow mutable object refs, and forbid mutable TxContext params. Implement helpers (contains_object_ty, tx_context_kind) used by both typing and linter logic. - Known attributes & view attribute: minor renames/refactors and formatting updates. - Tests/docs: add true_positive_view_function test and snapshot, update several linter snapshots. Also bump copyright year in updated files and apply small refactors to unify naming and behavior. Assignment implementation
06c4c99 to
969656f
Compare
This file contains hidden or 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
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.
Description of change
IOTA verifier implementation for view functions
Links to any relevant issues
fixes #11256