-
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.
treat
when
within generic objects as generic (#867)
## Summary Clarify the specification regarding how `when` statements within generic object definitions work and adjust the implementation accordingly. `when` statements inside generic object definitions are now treated as generic. This is a breaking change, but it makes using generic parameters in more complex expressions possible. Most notably, `isnot` now works properly inside generic objects' `when` conditions. ## Details * process `nkElifBranch` conditions of `nkWhenStmt` nodes within generic objects via `semGenericStmt` when analyzing the definition * remove the redundant AST checks in `replaceObjBranches` and `replaceTypeVarsN`; the already take place in `semRecordNode` * use `semConstBoolExpr` instead of `semConstExpr` when evaluating generic `when` conditions * `semConstBoolExpr` not returning an `nkIntLit` happens in case of cascading errors, so don't treat this as an internal error
- Loading branch information
Showing
4 changed files
with
76 additions
and
41 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