Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sem): crash with forward-declared
=destroy
hook (#1252)
## Summary Fix the compiler crashing when using a type with an, at that point, forward-declared `=destroy` hook. ## Details If the `=destroy` hook is forward-declared, its body is an `nkEmpty` node, which caused a `FieldDefect` error in `liftdestructors.createTypeBoundOps`, where the body AST is expected to support `len`. To resolve the issue, the `getBody(...).len` access is guarded by first checking that the destroy hook is not overridden (indicated by the `sfOverriden` flag); only overridden hooks can be forward-declared. This works because `sfOverriden` implies that the attached-to type has the `tfHasAsgn` flag already included.
- Loading branch information