Skip to content

fix: fix undefined behavior with mutable references #583

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

Draft
wants to merge 29 commits into
base: dev
Choose a base branch
from
Draft

Conversation

joe-p
Copy link
Contributor

@joe-p joe-p commented Apr 9, 2025

Currently TEALScript has undefined behavior with mutable references. The two sceanrios that result in UB are

  • Having multiple mutable references to one object
  • Dynamic (non const) references to mutable objects

This PR adds a reference checker to ensure those scenarios do not occur. The only material change for developers is the need to add a clone here or there, but as seen in this PR it is not needed in many cases.

ab0d526 was the initial reference checking implementation which used the architecture of TEALScript to check problematic areas

702e43b is (the start of) an implementation-agnostic reference checker that works solely on the TypeScript AST. This means the work here should be applicable to both TEALScript and Puya TS.

Copy link

netlify bot commented Apr 9, 2025

Deploy Preview for tealscript ready!

Name Link
🔨 Latest commit e2081b9
🔍 Latest deploy log https://app.netlify.com/projects/tealscript/deploys/68287c91295ac300085cf018
😎 Deploy Preview https://deploy-preview-583--tealscript.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant