Commit 9208081f authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix: a variable/input override (in a variant) is always ignored

parent e77f27db
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -297,12 +297,15 @@ def _check_var(
        )
        return err_count
    if root_kicker and _get_var(root_kicker, tbc_var.name):
        # a variant is overriding a variable from the main template: skip
        if declared_input:
        # a variant is overriding a variable from the main template: check same type
        orig_var = _get_var(root_kicker, tbc_var.name)
        if tbc_var.type != orig_var.type:
            print(
                f"  {AnsiColors.RED}✕ <{tbc_var.name}> is an override: must not be declared{AnsiColors.RESET}"
                f"  {AnsiColors.RED}✕ <{tbc_var.name}> is an override: type doesn't match original ({orig_var.type}){AnsiColors.RESET}"
            )
            return err_count + 1

        # a variant is overriding a variable from the main template: skip
        print(
            f"  {AnsiColors.HGRAY}✕ <{tbc_var.name}> is an override: skip{AnsiColors.RESET}"
        )