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 canonicalization of associated types #1556

Merged
merged 12 commits into from
Aug 17, 2024
Merged

Conversation

kyouko-taiga
Copy link
Contributor

This PR lets the type checker handle abstract associated types of the form Array<X>.T.U, where X is a generic parameter.

Calling `TypeChecker.canonical` on an associated type could return
a non-canonical type if its qualification was a bound generic type.
Given a substitution map [%0 -> %1], reifying %0 should return %1
rather than %0.
There is no reason to keep type variables around if they already
have known substitutions. Doing so only creates more cases to handle
while solving equality or subtyping constraints.
The implementation did not properly handle non-canonical associated
types denoting a generic type parameter.
Copy link

codecov bot commented Aug 17, 2024

Codecov Report

Attention: Patch coverage is 92.77108% with 6 lines in your changes missing coverage. Please review.

Project coverage is 87.62%. Comparing base (3a2840a) to head (a43ac74).
Report is 13 commits behind head on main.

Files Patch % Lines
Sources/CodeGen/LLVM/TypeLowering.swift 93.47% 3 Missing ⚠️
...urces/FrontEnd/TypeChecking/ConstraintSystem.swift 77.77% 2 Missing ⚠️
Sources/FrontEnd/TypeChecking/TypeChecker.swift 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1556      +/-   ##
==========================================
+ Coverage   87.59%   87.62%   +0.02%     
==========================================
  Files         372      372              
  Lines       22511    22530      +19     
==========================================
+ Hits        19719    19741      +22     
+ Misses       2792     2789       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kyouko-taiga kyouko-taiga merged commit 61cf91c into main Aug 17, 2024
16 checks passed
@kyouko-taiga kyouko-taiga deleted the fix-canonicalization branch August 17, 2024 19:53
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