You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix superclass resolution for class Foo < Foo and add circular inheritance diagnostic
When a class is defined with a superclass of the same name (e.g.,
`class Foo < Foo` inside a module), the superclass constant was
incorrectly resolving to the class being defined itself, because
TypeProf registers all definitions simultaneously. In Ruby, the
superclass expression is evaluated before the class constant is
created, so it naturally finds the outer definition.
Fix this by using `lenv.cref.outer` for the superclass constant
lookup when the superclass is a bare constant with the same name
as the class being defined.
Also add a diagnostic for circular inheritance detection during
install, covering both direct self-reference (`class A < A`) and
mutual recursion (`class A < B; class B < A`).
Fixes#373
Co-Authored-By: pvcresin <pvcresin0730@gmail.com>
0 commit comments