The overlay array is an array of functions that take self: super:
. By including import
as the function directly, this is calling import self
, and using that as part of the definition of self
. import
appears to call builtins.toPath
on its argument, which in turn calls toString
(and then interprets the results as an absolute path). toString
can accept a set, if the set contains a __toString = self: …
attribute.
So, as a result, if an entry in the overlays
attribute is the function import
, it tries to evaluate import self
, where self
is a set, and the import
ends up forcing the __toString
attribute, and in order to determine if there is in fact a __toString
attribute it needs to evaluate the overlays, which ends up recursing right back to the import
.