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

fix(gnovm): fix nil pointer deref for duplicate declarations #3886

Merged
merged 14 commits into from
Mar 6, 2025

Conversation

ltzmaxwell
Copy link
Contributor

@ltzmaxwell ltzmaxwell commented Mar 6, 2025

close: #2763 .

This PR addresses the nil pointer issue, also fix the redeclaration issue by @thehowl .
filetest is a special case, , redeclaration is still permitted in filetest files(e.g. z_0_filetest, z_1_filetest...) for convenience.

@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Mar 6, 2025
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Mar 6, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: ltzmaxwell/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@ltzmaxwell ltzmaxwell requested review from thehowl and notJoon March 6, 2025 10:33
Copy link
Member

@notJoon notJoon left a comment

Choose a reason for hiding this comment

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

Nice. I confirmed that there is no nil pointer issue. 👍

Personally, I think it would be good to check for redeclarations, but I also agree that adding a separate check for such this cases would be inefficient. However, this seems to be beyond my hand, so I'll let it go.

@thehowl
Copy link
Member

thehowl commented Mar 6, 2025

I'll fix this up a second (adding more tests)

@thehowl thehowl changed the title fix(gnovm): fix nil pointer on predefine fix(gnovm): fix nil pointer deref for duplicate declarations Mar 6, 2025
@ltzmaxwell
Copy link
Contributor Author

thanks @thehowl for the fix, it's elegant and concise. 👍

@thehowl
Copy link
Member

thehowl commented Mar 6, 2025

@ltzmaxwell does the txtar in gno.land make sense in your opinion - or should we remove it? i think it's not testing anything in particular, because test files aren't considered

@ltzmaxwell
Copy link
Contributor Author

ltzmaxwell commented Mar 6, 2025

@ltzmaxwell does the txtar in gno.land make sense in your opinion - or should we remove it? i think it's not testing anything in particular, because test files aren't considered

IMO, it serves as a helpful explanation after adding this part of the clarification:

# Note: addpkg does not add *_test.gno files, so it works as expected without
# causing any redeclaration issues.

@thehowl

@thehowl thehowl merged commit 69af6e2 into gnolang:master Mar 6, 2025
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Nil Pointer Dereference Error When Declaring Duplicate Functions in Main and Test File of the Same Package
4 participants