@@ -621,4 +621,108 @@ class FunDefTest extends SimpleScala3ParserTestBase {
621621 | PsiWhiteSpace('\n')
622622 |""" .stripMargin
623623 )
624+
625+ // SCL-23297
626+ def test_indentation_region_in_default_param (): Unit = checkTree(
627+ """
628+ |def foo0(p: Int =
629+ | var x = 1
630+ | var y = 2
631+ | x + y
632+ |) = {
633+ | println(p)
634+ |}
635+ |""" .stripMargin,
636+ """
637+ |ScalaFile
638+ | PsiWhiteSpace('\n')
639+ | ScFunctionDefinition: foo0
640+ | AnnotationsList
641+ | <empty list>
642+ | Modifiers
643+ | <empty list>
644+ | PsiElement(def)('def')
645+ | PsiWhiteSpace(' ')
646+ | PsiElement(identifier)('foo0')
647+ | Parameters
648+ | ParametersClause
649+ | PsiElement(()('(')
650+ | Parameter: p
651+ | AnnotationsList
652+ | <empty list>
653+ | Modifiers
654+ | <empty list>
655+ | PsiElement(identifier)('p')
656+ | PsiElement(:)(':')
657+ | PsiWhiteSpace(' ')
658+ | ParameterType
659+ | SimpleType: Int
660+ | CodeReferenceElement: Int
661+ | PsiElement(identifier)('Int')
662+ | PsiWhiteSpace(' ')
663+ | PsiElement(=)('=')
664+ | BlockExpression
665+ | PsiWhiteSpace('\n ')
666+ | ScVariableDefinition: x
667+ | AnnotationsList
668+ | <empty list>
669+ | Modifiers
670+ | <empty list>
671+ | PsiElement(var)('var')
672+ | PsiWhiteSpace(' ')
673+ | ListOfPatterns
674+ | ReferencePattern: x
675+ | PsiElement(identifier)('x')
676+ | PsiWhiteSpace(' ')
677+ | PsiElement(=)('=')
678+ | PsiWhiteSpace(' ')
679+ | IntegerLiteral
680+ | PsiElement(integer)('1')
681+ | PsiWhiteSpace('\n ')
682+ | ScVariableDefinition: y
683+ | AnnotationsList
684+ | <empty list>
685+ | Modifiers
686+ | <empty list>
687+ | PsiElement(var)('var')
688+ | PsiWhiteSpace(' ')
689+ | ListOfPatterns
690+ | ReferencePattern: y
691+ | PsiElement(identifier)('y')
692+ | PsiWhiteSpace(' ')
693+ | PsiElement(=)('=')
694+ | PsiWhiteSpace(' ')
695+ | IntegerLiteral
696+ | PsiElement(integer)('2')
697+ | PsiWhiteSpace('\n ')
698+ | InfixExpression
699+ | ReferenceExpression: x
700+ | PsiElement(identifier)('x')
701+ | PsiWhiteSpace(' ')
702+ | ReferenceExpression: +
703+ | PsiElement(identifier)('+')
704+ | PsiWhiteSpace(' ')
705+ | ReferenceExpression: y
706+ | PsiElement(identifier)('y')
707+ | PsiWhiteSpace('\n')
708+ | PsiElement())(')')
709+ | PsiWhiteSpace(' ')
710+ | PsiElement(=)('=')
711+ | PsiWhiteSpace(' ')
712+ | BlockExpression
713+ | PsiElement({)('{')
714+ | PsiWhiteSpace('\n ')
715+ | MethodCall
716+ | ReferenceExpression: println
717+ | PsiElement(identifier)('println')
718+ | ArgumentList
719+ | PsiElement(()('(')
720+ | ReferenceExpression: p
721+ | PsiElement(identifier)('p')
722+ | PsiElement())(')')
723+ | PsiWhiteSpace('\n')
724+ | PsiElement(})('}')
725+ | PsiWhiteSpace('\n')
726+ |""" .stripMargin
727+ )
624728}
0 commit comments