-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Compiler-v2] Fix check_variant
#14952
Conversation
⏱️ 3h 57m total CI duration on this PR
🚨 1 job on the last run was significantly faster/slower than expected
|
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @rahxephon89 and the rest of your teammates on Graphite |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14952 +/- ##
===========================================
- Coverage 71.7% 60.1% -11.7%
===========================================
Files 2412 856 -1556
Lines 490526 211110 -279416
===========================================
- Hits 351949 126962 -224987
+ Misses 138577 84148 -54429 ☔ View full report in Codecov by Sentry. |
bdae453
to
1dda9aa
Compare
1dda9aa
to
637157a
Compare
check_variant
check_variant
check_variant
} else { | ||
true | ||
(true, maccess.clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under what condition would this case happen? Do we have tests that cover this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It covers all other cases where maccess cannot be interpreted as a variant so I don't think we need new test cases here.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
In the expansion phase, module access with the form
A::B
is translated into access of the variantB
of enumA
asModuleAccess(M1, M2, Some(B))
whenA
has an aliasM1::M2
whereM1
is the name of the module whereA
is defined.However, when
A
is both the name of a struct/enum type and the name of a module (which meansM1
==A
) andB
is a constant, a struct/enum type, thenA::B
needs to be interpreted asModuleAccess(M1, B, None)
. This PR refactors the implementation ofcheck_variant(maccess: ModuleAccess)-> bool
in themodule_builder
such that, instead of directly returning false whenmaccess
takes the formModuleAccess(M1, M2, Some(B))
, it will returnModuleAccess(M1, B, None)
ifM1::B
is a constant, schema or a struct.Close #14950
How Has This Been Tested?
Key Areas to Review
Corner cases such as when a type has an alias with the same name as the module in which it defines.
Type of Change
Which Components or Systems Does This Change Impact?
Checklist