Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
TopLevelVisitor
adding existing ClassDef
type to current scope (
#15067) When a type is reopened, the compiler adds it as nested type to the current scope (i.e. where it's reopened). That's wrong because the reopened type is already scoped to the location of the original location and this could lead to cycles. For example, the following program would crash the compiler with an infinite recursion: ```cr class Foo alias Bar = Foo class Bar end end ``` This fix makes sure to only add newly defined types to the current scope, not reopened ones. All other visitor methods which defined types already do this, only `ClassDef` was unconditionally adding to the current scope.
- Loading branch information