<NME> CaseOf.txt
<BEF> Elm File
  ElmValueDeclaration(VALUE_DECLARATION)
    ElmFunctionDeclarationLeft(FUNCTION_DECLARATION_LEFT)
      PsiElement(LOWER_CASE_IDENTIFIER)('f')
      PsiWhiteSpace(' ')
      ElmLowerPattern(LOWER_PATTERN)
        PsiElement(LOWER_CASE_IDENTIFIER)('x')
    PsiWhiteSpace(' ')
    PsiElement(EQ)('=')
    PsiWhiteSpace('\n')
    PsiWhiteSpace('    ')
    ElmCaseOfExpr(CASE_OF_EXPR)
      PsiElement(CASE)('case')
      PsiWhiteSpace(' ')
      ElmValueExpr(VALUE_EXPR)
        ElmValueQID(VALUE_QID)
          PsiElement(LOWER_CASE_IDENTIFIER)('x')
      PsiWhiteSpace(' ')
      PsiElement(OF)('of')
      PsiWhiteSpace('\n')
      PsiElement(VIRTUAL_OPEN_SECTION)('        ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmUnionPattern(UNION_PATTERN)
            ElmUpperCaseQID(UPPER_CASE_QID)
              PsiElement(UPPER_CASE_IDENTIFIER)('Just')
            PsiWhiteSpace(' ')
            ElmLowerPattern(LOWER_PATTERN)
              PsiElement(LOWER_CASE_IDENTIFIER)('xx')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace('\n')
        PsiWhiteSpace('            ')
        ElmValueExpr(VALUE_EXPR)
          ElmValueQID(VALUE_QID)
            PsiElement(LOWER_CASE_IDENTIFIER)('xx')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('\n')
      PsiWhiteSpace('        ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmUnionPattern(UNION_PATTERN)
            ElmUpperCaseQID(UPPER_CASE_QID)
              PsiElement(UPPER_CASE_IDENTIFIER)('Nothing')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace('\n')
        PsiWhiteSpace('            ')
        ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
          PsiElement(NUMBER_LITERAL)('0')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('\n')
      PsiWhiteSpace('        ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmUnionPattern(UNION_PATTERN)
            ElmUpperCaseQID(UPPER_CASE_QID)
              PsiElement(UPPER_CASE_IDENTIFIER)('Foo')
            PsiWhiteSpace(' ')
            ElmUpperCaseQID(UPPER_CASE_QID)
              PsiElement(UPPER_CASE_IDENTIFIER)('Bar')
            PsiWhiteSpace(' ')
            ElmLowerPattern(LOWER_PATTERN)
              PsiElement(LOWER_CASE_IDENTIFIER)('baz')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace('\n')
        PsiWhiteSpace('            ')
        ElmValueExpr(VALUE_EXPR)
          ElmValueQID(VALUE_QID)
            PsiElement(LOWER_CASE_IDENTIFIER)('baz')
  PsiElement(VIRTUAL_END_DECL)('\n')
  PsiWhiteSpace('\n')
  ElmValueDeclaration(VALUE_DECLARATION)
    ElmFunctionDeclarationLeft(FUNCTION_DECLARATION_LEFT)
      PsiElement(LOWER_CASE_IDENTIFIER)('g')
      PsiWhiteSpace(' ')
      ElmLowerPattern(LOWER_PATTERN)
        PsiElement(LOWER_CASE_IDENTIFIER)('x')
      PsiWhiteSpace(' ')
      ElmLowerPattern(LOWER_PATTERN)
        PsiElement(LOWER_CASE_IDENTIFIER)('y')
    PsiWhiteSpace(' ')
    PsiElement(EQ)('=')
    PsiWhiteSpace('\n')
    PsiWhiteSpace('    ')
    ElmCaseOfExpr(CASE_OF_EXPR)
      PsiElement(CASE)('case')
      PsiWhiteSpace(' ')
      ElmTupleExpr(TUPLE_EXPR)
        PsiElement(LEFT_PARENTHESIS)('(')
        ElmValueExpr(VALUE_EXPR)
          ElmValueQID(VALUE_QID)
            PsiElement(LOWER_CASE_IDENTIFIER)('x')
        PsiElement(COMMA)(',')
        ElmValueExpr(VALUE_EXPR)
          ElmValueQID(VALUE_QID)
            PsiElement(LOWER_CASE_IDENTIFIER)('y')
        PsiElement(RIGHT_PARENTHESIS)(')')
      PsiWhiteSpace(' ')
      PsiElement(OF)('of')
      PsiWhiteSpace('\n')
      PsiElement(VIRTUAL_OPEN_SECTION)('        ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmTuplePattern(TUPLE_PATTERN)
            PsiElement(LEFT_PARENTHESIS)('(')
            ElmPattern(PATTERN)
              ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
                PsiElement(NUMBER_LITERAL)('0')
            PsiElement(COMMA)(',')
            PsiWhiteSpace(' ')
            ElmPattern(PATTERN)
              ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
                PsiElement(NUMBER_LITERAL)('0')
            PsiElement(RIGHT_PARENTHESIS)(')')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace('\n')
        PsiWhiteSpace('            ')
        ElmStringConstantExpr(STRING_CONSTANT_EXPR)
          PsiElement(OPEN_QUOTE)('"')
          PsiElement(REGULAR_STRING_PART)('origin')
          PsiElement(CLOSE_QUOTE)('"')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('\n')
      PsiWhiteSpace('        ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmTuplePattern(TUPLE_PATTERN)
            PsiElement(LEFT_PARENTHESIS)('(')
            ElmPattern(PATTERN)
              ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
                PsiElement(NUMBER_LITERAL)('0')
            PsiElement(COMMA)(',')
            PsiWhiteSpace(' ')
            ElmPattern(PATTERN)
              ElmLowerPattern(LOWER_PATTERN)
                PsiElement(LOWER_CASE_IDENTIFIER)('y2')
            PsiElement(RIGHT_PARENTHESIS)(')')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace('\n')
        PsiWhiteSpace('            ')
        ElmStringConstantExpr(STRING_CONSTANT_EXPR)
          PsiElement(OPEN_QUOTE)('"')
          PsiElement(REGULAR_STRING_PART)('x-axis')
          PsiElement(CLOSE_QUOTE)('"')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('\n')
      PsiWhiteSpace('        ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmTuplePattern(TUPLE_PATTERN)
            PsiElement(LEFT_PARENTHESIS)('(')
            ElmPattern(PATTERN)
              ElmLowerPattern(LOWER_PATTERN)
                PsiElement(LOWER_CASE_IDENTIFIER)('x2')
            PsiElement(COMMA)(',')
            PsiWhiteSpace(' ')
            ElmPattern(PATTERN)
              ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
                PsiElement(NUMBER_LITERAL)('0')
            PsiElement(RIGHT_PARENTHESIS)(')')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace('\n')
        PsiWhiteSpace('            ')
        ElmStringConstantExpr(STRING_CONSTANT_EXPR)
          PsiElement(OPEN_QUOTE)('"')
          PsiElement(REGULAR_STRING_PART)('y-axis')
          PsiElement(CLOSE_QUOTE)('"')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('\n')
      PsiWhiteSpace('        ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmAnythingPattern(ANYTHING_PATTERN)
            PsiElement(UNDERSCORE)('_')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace('\n')
        PsiWhiteSpace('            ')
        ElmStringConstantExpr(STRING_CONSTANT_EXPR)
          PsiElement(OPEN_QUOTE)('"')
          PsiElement(REGULAR_STRING_PART)('somewhere else')
          PsiElement(CLOSE_QUOTE)('"')
  PsiElement(VIRTUAL_END_DECL)('\n')
  PsiWhiteSpace('\n')
  ElmValueDeclaration(VALUE_DECLARATION)
    ElmFunctionDeclarationLeft(FUNCTION_DECLARATION_LEFT)
      PsiElement(LOWER_CASE_IDENTIFIER)('h')
      PsiWhiteSpace(' ')
      ElmLowerPattern(LOWER_PATTERN)
        PsiElement(LOWER_CASE_IDENTIFIER)('list')
    PsiWhiteSpace(' ')
    PsiElement(EQ)('=')
    PsiWhiteSpace('\n')
    PsiWhiteSpace('  ')
    ElmCaseOfExpr(CASE_OF_EXPR)
      PsiElement(CASE)('case')
      PsiWhiteSpace(' ')
      ElmValueExpr(VALUE_EXPR)
        ElmValueQID(VALUE_QID)
          PsiElement(LOWER_CASE_IDENTIFIER)('list')
      PsiWhiteSpace(' ')
      PsiElement(OF)('of')
      PsiWhiteSpace('\n')
      PsiElement(VIRTUAL_OPEN_SECTION)('    ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmListPattern(LIST_PATTERN)
            PsiElement(LEFT_SQUARE_BRACKET)('[')
            PsiElement(RIGHT_SQUARE_BRACKET)(']')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace(' ')
        ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
          PsiElement(NUMBER_LITERAL)('1')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('    ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmConsPattern(CONS_PATTERN)
            PsiElement(LEFT_PARENTHESIS)('(')
            ElmPattern(PATTERN)
              ElmConsPattern(CONS_PATTERN)
                ElmLowerPattern(LOWER_PATTERN)
                  PsiElement(LOWER_CASE_IDENTIFIER)('single')
                PsiWhiteSpace(' ')
                PsiElement(OPERATOR_IDENTIFIER)('::')
                PsiWhiteSpace(' ')
                ElmListPattern(LIST_PATTERN)
                  PsiElement(LEFT_SQUARE_BRACKET)('[')
                  PsiElement(RIGHT_SQUARE_BRACKET)(']')
            PsiElement(RIGHT_PARENTHESIS)(')')
            PsiWhiteSpace(' ')
            PsiElement(OPERATOR_IDENTIFIER)('::')
            PsiWhiteSpace(' ')
            ElmListPattern(LIST_PATTERN)
              PsiElement(LEFT_SQUARE_BRACKET)('[')
              PsiElement(RIGHT_SQUARE_BRACKET)(']')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace(' ')
        ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
          PsiElement(NUMBER_LITERAL)('2')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('    ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmListPattern(LIST_PATTERN)
            PsiElement(LEFT_SQUARE_BRACKET)('[')
            ElmPattern(PATTERN)
              ElmLowerPattern(LOWER_PATTERN)
                PsiElement(LOWER_CASE_IDENTIFIER)('first')
            PsiElement(COMMA)(',')
            PsiWhiteSpace(' ')
            ElmPattern(PATTERN)
              ElmLowerPattern(LOWER_PATTERN)
                PsiElement(LOWER_CASE_IDENTIFIER)('second')
            PsiElement(RIGHT_SQUARE_BRACKET)(']')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace(' ')
        ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
          PsiElement(NUMBER_LITERAL)('3')
      PsiElement(VIRTUAL_END_DECL)('\n')
      PsiWhiteSpace('    ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmConsPattern(CONS_PATTERN)
            ElmAnythingPattern(ANYTHING_PATTERN)
              PsiElement(UNDERSCORE)('_')
            PsiWhiteSpace(' ')
            PsiElement(OPERATOR_IDENTIFIER)('::')
            PsiWhiteSpace(' ')
            ElmLowerPattern(LOWER_PATTERN)
              PsiElement(LOWER_CASE_IDENTIFIER)('b')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace(' ')
        ElmNumberConstantExpr(NUMBER_CONSTANT_EXPR)
          PsiElement(NUMBER_LITERAL)('4')
  PsiElement(VIRTUAL_END_DECL)('\n')
  PsiWhiteSpace('\n')
  ElmValueDeclaration(VALUE_DECLARATION)
    ElmFunctionDeclarationLeft(FUNCTION_DECLARATION_LEFT)
      PsiElement(LOWER_CASE_IDENTIFIER)('i')
      PsiWhiteSpace(' ')
      ElmLowerPattern(LOWER_PATTERN)
        PsiElement(LOWER_CASE_IDENTIFIER)('record')
    PsiWhiteSpace(' ')
    PsiElement(EQ)('=')
    PsiWhiteSpace('\n')
    PsiWhiteSpace('  ')
    ElmCaseOfExpr(CASE_OF_EXPR)
      PsiElement(CASE)('case')
      PsiWhiteSpace(' ')
      ElmValueExpr(VALUE_EXPR)
        ElmValueQID(VALUE_QID)
          PsiElement(LOWER_CASE_IDENTIFIER)('record')
      PsiWhiteSpace(' ')
      PsiElement(OF)('of')
      PsiWhiteSpace('\n')
      PsiElement(VIRTUAL_OPEN_SECTION)('    ')
      ElmCaseOfBranch(CASE_OF_BRANCH)
        ElmPattern(PATTERN)
          ElmRecordPattern(RECORD_PATTERN)
            PsiElement(LEFT_BRACE)('{')
            ElmLowerPattern(LOWER_PATTERN)
              PsiElement(LOWER_CASE_IDENTIFIER)('x')
            PsiElement(COMMA)(',')
            ElmLowerPattern(LOWER_PATTERN)
              PsiElement(LOWER_CASE_IDENTIFIER)('y')
            PsiElement(RIGHT_BRACE)('}')
        PsiWhiteSpace(' ')
        PsiElement(ARROW)('->')
        PsiWhiteSpace(' ')
        ElmUnitExpr(UNIT_EXPR)
          PsiElement(LEFT_PARENTHESIS)('(')
          PsiElement(RIGHT_PARENTHESIS)(')')

<MSG> Fix references to union constructors in arguments to other constructors in patterns (#534)

The grammar was previously parsing these as `ElmUpperCaseQID`, which is not a reference element. This PR adds a new element types `ElmNullaryConstructorArgumentPattern`, which wraps the QID with a reference element.

I made the name long rather something like `ElmUpperPattern`, because it's a very specific element. A pattern like `Nothing ->` will still parse as `ElmUnionPattern`. This is only used in patterns like `Just Nothing ->`, where the whole pattern will be an `ElmUnionPattern`, and the `Nothing` will now be `ElmNullaryConstructorArgumentPattern`.
<DFF> @@ -57,8 +57,9 @@ Elm File
             ElmUpperCaseQID(UPPER_CASE_QID)
               PsiElement(UPPER_CASE_IDENTIFIER)('Foo')
             PsiWhiteSpace(' ')
-            ElmUpperCaseQID(UPPER_CASE_QID)
-              PsiElement(UPPER_CASE_IDENTIFIER)('Bar')
+            ElmNullaryConstructorArgumentPattern(NULLARY_CONSTRUCTOR_ARGUMENT_PATTERN)
+              ElmUpperCaseQID(UPPER_CASE_QID)
+                PsiElement(UPPER_CASE_IDENTIFIER)('Bar')
             PsiWhiteSpace(' ')
             ElmLowerPattern(LOWER_PATTERN)
               PsiElement(LOWER_CASE_IDENTIFIER)('baz')
@@ -319,4 +320,4 @@ Elm File
         PsiWhiteSpace(' ')
         ElmUnitExpr(UNIT_EXPR)
           PsiElement(LEFT_PARENTHESIS)('(')
-          PsiElement(RIGHT_PARENTHESIS)(')')
\ No newline at end of file
+          PsiElement(RIGHT_PARENTHESIS)(')')

Fix references to union constructors in arguments to other constructors in patterns (#534)