diff --git a/src/MacroNamespace.php b/src/MacroNamespace.php index 13ca706bc..cd9ac06fc 100644 --- a/src/MacroNamespace.php +++ b/src/MacroNamespace.php @@ -57,7 +57,7 @@ final class MacroNamespace return $macro->callLegacy($arguments, $source, $line); } - if (null === $macro = $this->resolve($name, $context)) { + if (null === $macro = $this->getParent($context)?->resolve($name, $context)) { if (!str_starts_with($name, 'macro_') || null === $macro = $this->resolve($bareName = substr($name, \strlen('macro_')), $context)) { throw new RuntimeError(\sprintf('Macro "%s" is not defined in template "%s".', $name, $this->template->getTemplateName()), $line, $source); }