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

Fixes ReplaceDecls to no longer depend on filter hack. #5541

Merged
merged 4 commits into from
Feb 5, 2024

Conversation

esdrubal
Copy link
Contributor

@esdrubal esdrubal commented Feb 2, 2024

ReplaceDecls was using a hack to replace some function refs based on
the self function parameter, this didn't work for associated functions.

Now DeclMapping sources also contain a typeid that guarantees that the
replacement is done to the correct declaration in case we have nested
trait methods with the same name replaced.

Fixes #5504

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@esdrubal esdrubal added P: critical Should be looked at before anything else compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Feb 2, 2024
@esdrubal esdrubal self-assigned this Feb 2, 2024
@esdrubal esdrubal force-pushed the esdrubal/fix_replace_decls branch 2 times, most recently from e23f23c to 0321952 Compare February 2, 2024 19:38
@esdrubal esdrubal requested a review from a team February 2, 2024 19:38
`ReplaceDecls` was using a hack to replace some function refs based on
the self function parameter, this didn't work for associated functions.

Now DeclMapping sources also contain a typeid that guarantees that the
replacement is done to the correct declaration in case we have nested
trait methods with the same name replaced.

Fixes #5504
@esdrubal esdrubal marked this pull request as ready for review February 2, 2024 19:44
@IGI-111 IGI-111 requested a review from a team February 3, 2024 02:12
Copy link
Member

@ironcev ironcev left a comment

Choose a reason for hiding this comment

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

LGTM. BDW, with this change implementingthe exact TyFunctionDecl::is_constructor method should be straightforward. The TODO I left in that method was exactly about the difficulty of determining the exact Self type for the method. I should give it a try and implement that TODO once this PR gets accepted 😄

@IGI-111 IGI-111 enabled auto-merge (squash) February 5, 2024 12:29
@IGI-111 IGI-111 merged commit 491a07f into master Feb 5, 2024
38 checks passed
@IGI-111 IGI-111 deleted the esdrubal/fix_replace_decls branch February 5, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen P: critical Should be looked at before anything else
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite recursion (stack overflow) calling trait function on tuples
5 participants