Unexpected "Improperly scoped variable" in an a!match() function

Certified Senior Developer

Hi!

I'm using an a!match function in an interface. I have set the 'value:' parameter of the match function to the output of an expression which outputs a list of CDTs. Subsequently, I'm using this value parameter as 'fv!value' in other parameters. However, I'm receiving the 'improperly scoped variable' warning on multiple occasions when using fv!value (not in all cases). This warning is resolved when calling the same function that is called in the 'value:' parameter over and over again. However, I would prefer to refrain from doing this because of the performance implications of calling the same function multiple times.

A code snippet is attached which shows the following: the times when fv!value is called in the 'whenTrue:' parameter (lines 6 & 14), no warning is given. When fv!value is called in the 'then:' parameter (lines 10, 20 & 23), however, a warning is issued. This does not rhyme with the expected behaviour as described in the documentation. I was hoping someone could shed a light on this!

Thank you for reading.

a!match(
    value: rule!ACE_ReturnACDT(
        input: ri!input
    ),
    whenTrue: contains(
      fv!value.type,
      cons!ACE_ANSWER_TYPE_OPEN
    ),
    then: a!localVariables(
      local!warning1: fv!value,
      /* code redacted for readability */
      ),
    whenTrue: contains(
      fv!value.type,
      cons!ACE_ANSWER_TYPE_MULTIPLE_CHOICE
    ),
    then: if(
      length(fv!value) <= cons!ACE_RADIOBUTTON_DROPDOWN_DIVISION_VALUE,
      rule!ACE_SC_RadioButtonField(
        warning2: fv!value,
      ),
      rule!ACE_SC_DropdownField(
        warning3: fv!value,
    )
    ),
    default: null
)

  Discussion posts and replies are publicly visible