-
Notifications
You must be signed in to change notification settings - Fork 737
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
Revamp SymbolEnter to properly resolve constants #36538
Comments
Initially, there were 560 failed tests and approximately 1500 tests that were skipped. By addressing the unimplemented cases in the type resolver and constant type checker, we were able to reduce the number of failing unit tests to 65. |
In the current constant type checker, when evaluating the
But according to the current implementation, all are valid cases. We are currently updating the constant type checker to handle these scenarios properly. |
This is fixed by rewriting the constant type checker to use expected type to determine the literal types instead of calculating all possible candidates. |
To allow generic intersection we have to resolve effective type of intersection type definition using depth first approach. But there is a limitation when we have cyclic reference in the type definition.
When resolving B, type A is not resolved completely. So immutable clone will have the partially defined type. To solve this, first we have to calculate partially defined effective type for B. After fully defined the A we will visit type of B and update the effective type. |
Currently working on updating immutable type (effective type of readonly intersection) of
These are the few cyclic tuple case, where we have to update the improperly defined effective type. I'm getting below runtime error for
Currently looking into why is it failing
|
|
inclusion of cyclic record is not handled. We consider it as know issue and attend that later |
For this case we are logging a compile-time error
|
This should result invalid cyclic reference error like record and object type definitions. Currently fixing it |
Description:
Related discussion - #35745
It is necessary to properly type check and resolve constants at the earliest possible stage, since constants may be required to resolve other variables, type defn etc.. According to the spec, constants are known at compile time and they can be only dependent on other constants or type definitions which are also known at compile time. Therefore, we can resolve constants at the SymbolEnter phase.
Describe your problem(s)
In the current implementation, compiler resolves the constants at ConstantValueResolver in semantic analyzer phase. But type nodes of module level variables are already resolved before resolving the constants. Therefore, even compiler updates the constants with correct types in later stage, it will not fix the module level usages (as a type) of the constants.
Describe your solution(s)
Will update once the approach is finalized.
Related Issues (optional):
#28334, #32804, #33890
The text was updated successfully, but these errors were encountered: