Skip to content

Trait coherence fixes #7211

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 6 commits into
base: master
Choose a base branch
from

Conversation

tritao
Copy link
Contributor

@tritao tritao commented Jun 1, 2025

Description

This bundles up a couple fixes related to the trait coherence feature.

Remove LSP workaround for skipping trait coherence checks.

This has been fixed and is not necessary anymore since the underlying issue was fixed in 12eee9e.

Use an hash set for calculating trait coherence unified trait types.

This prevents some duplicated entries from being considered when building the initial unified map for trait coherence checks.

Prevent duplicated trait coherence checks for conflicting types.

This fixes #7187 and fixes coherence checking when multiple versions of the same library exist in the same package.

Improve trait coherence orphan rule error with expressive diagnostics.

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 self-assigned this Jun 1, 2025
@tritao tritao added compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Jun 1, 2025
@tritao tritao force-pushed the trait-map-coherence-fixes branch from 074a665 to 122003c Compare June 1, 2025 18:37
@tritao tritao temporarily deployed to fuel-sway-bot June 1, 2025 18:40 — with GitHub Actions Inactive
@tritao tritao force-pushed the trait-map-coherence-fixes branch from 122003c to dec7f00 Compare June 1, 2025 18:45
@tritao tritao temporarily deployed to fuel-sway-bot June 1, 2025 18:48 — with GitHub Actions Inactive
Copy link

codspeed-hq bot commented Jun 1, 2025

CodSpeed Performance Report

Merging #7211 will degrade performances by 14.29%

Comparing tritao:trait-map-coherence-fixes (8134221) with master (fe8a3ef)

Summary

❌ 1 regressions
✅ 23 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
open_all_example_workspace_members 8.1 s 9.4 s -14.29%

@tritao tritao force-pushed the trait-map-coherence-fixes branch from dec7f00 to 57ce703 Compare June 1, 2025 20:12
@tritao tritao temporarily deployed to fuel-sway-bot June 1, 2025 20:12 — with GitHub Actions Inactive
@tritao tritao force-pushed the trait-map-coherence-fixes branch from 57ce703 to b3199d0 Compare June 9, 2025 09:44
tritao added 4 commits June 9, 2025 10:53
This has been fixed and is not necessary anymore.
This prevents some duplicated entries from appearing up which are
harmless but reduce performance due to duplicated checking.
@tritao tritao force-pushed the trait-map-coherence-fixes branch from b3199d0 to c2dbff0 Compare June 9, 2025 09:57
@tritao tritao force-pushed the trait-map-coherence-fixes branch from c2dbff0 to dc0df1b Compare June 9, 2025 10:05
@tritao tritao temporarily deployed to fuel-sway-bot June 9, 2025 10:05 — with GitHub Actions Inactive
@tritao tritao force-pushed the trait-map-coherence-fixes branch from dc0df1b to f31f990 Compare June 9, 2025 10:18
@tritao tritao temporarily deployed to fuel-sway-bot June 9, 2025 10:20 — with GitHub Actions Inactive
@tritao tritao force-pushed the trait-map-coherence-fixes branch from f31f990 to 8134221 Compare June 9, 2025 10:45
@tritao tritao temporarily deployed to fuel-sway-bot June 9, 2025 10:45 — with GitHub Actions Inactive
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 compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trait Coherence compile error with Mira
1 participant