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
I came across a case where the name of the class Nil is contained in the module in which the class for which we create the settings is defined.
moduleAclassNilendclassBHabiat.create do
setting abc : Array(Something) =Array(Something)
endendend
In this case, the macro does not work correctly because it refers to a local A::Nil and not a global Nil class.
> 19 |# then raise a MissingSettingError
> 20 | @@abc : Array(Something.class) | Nil = begin
> 21 | Array(Something.class).new ^Error: class variable '@@abc' of A::B::HabitatSettings must be (Array(Something.class) | A::Nil), not (Array(Something.class) | Nil)
Without spoiling the idea of how smart it is to have a separate class Nil inside a local namespace, this can be fixed in code
I came across a case where the name of the class
Nil
is contained in the module in which the class for which we create the settings is defined.In this case, the macro does not work correctly because it refers to a local
A::Nil
and not a globalNil
class.Without spoiling the idea of how smart it is to have a separate class
Nil
inside a local namespace, this can be fixed in codebut I propose to explicitly specify the global
::Nil
in this macro body if this possible.habitat/src/habitat.cr
Lines 239 to 293 in 4d242eb
The text was updated successfully, but these errors were encountered: