-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: less generic-expression workarounds (#821)
## Summary Prevent expressions-depending-on-unresolved-type-variables passed to `tryConstExpr` from reaching into the compile-time evaluation machinery. This allows for removing multiple workarounds from `mirgen` and `vmgen`. ## Details Before `tryConstExpr` passes the expression to `evalConstExpr`, it now first checks whether the expression either contains unresolved generic parameters or is an unresolved type-parameter-lookup (e.g., `T.param`). If either is the case, `nil` (which signals that the expression cannot be evaluated at compile-time) is returned without passing the expression to `evalConstExpr`. While this approach is fundamentally also a workaround (expressions containing unresolved generic parameters shouldn't be passed to `tryConstExpr` in the first place), it at least prevents unresolved expressions from reaching into `transf`, `mirgen`, and `vmgen`. `mirgen` now doesn't have to push unresolved generic parameters or type-parameter-lookups as `mnkLiteral`s through the MIR phase, and `vmgen` doesn't have to special-case them. More generally, `vmgen` can now treat unexpected nodes reaching it as a defect (via `unreachable`). Since `vmGenDiagCodeGenUnexpectedSym` and `vmGenDiagCannotGenerateCode` are now unused, they are, together with everything related to them, removed.
- Loading branch information
Showing
8 changed files
with
39 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters