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 trait-related type inference propagation bug #6455

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

tritao
Copy link
Contributor

@tritao tritao commented Aug 22, 2024

Description

Trait methods end up passing an extra type parameter related to self.

What was happening is that we ended up creating a placeholder of a
placeholder in some cases, which threw the type inferencing system off.

The fix is to avoid creating a new type for a given type parameter if
its already a placeholder.

Fixes #6372.

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.

@tritao tritao added P: high Should be looked at if there are no critical issues left compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen audit-report Related to the audit report labels Aug 22, 2024
@tritao tritao self-assigned this Aug 22, 2024
@tritao tritao changed the title Fix trait-related type inference propagation bug. Fix trait-related type inference propagation bug Aug 22, 2024
Trait methods end up passing an extra type parameter related to self.

What was happening is that we ended up creating a placeholder of a
placeholder in some cases, which threw the type inferencing system off.

The fix is to avoid creating a new type for a given type parameter if
its already a placeholder.

Fixes FuelLabs#6372.
@tritao tritao force-pushed the trait-type-propagation branch from d317b46 to bb5a201 Compare August 22, 2024 19:09
@tritao tritao marked this pull request as ready for review August 23, 2024 07:58
@tritao tritao requested a review from a team as a code owner August 23, 2024 07:58
@tritao tritao enabled auto-merge (squash) August 23, 2024 07:58
@IGI-111 IGI-111 requested a review from a team August 23, 2024 10:53
@tritao tritao merged commit bb04966 into FuelLabs:master Aug 24, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audit-report Related to the audit report compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen P: high Should be looked at if there are no critical issues left
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type Propagation in Generics
3 participants