Repository: bombsimon/wsl (go)

Issue:
Expressions can be cuddled with `for` blocks, but not with `if` blocks
![image](https://github.com/bombsimon/wsl/assets/31022056/2eab8c10-774a-4001-9d41-a02494c8e0f2)

**Repro**:

```go
for i := 0; i < 4; i++ {
	fmt.Println()
}
Up(3)

if autoheight != 3 {
	t.Errorf("height should be 3 but is %d", autoheight)
}
Down(3)
```

**wsl command used**: `wsl ./...`
![image](https://github.com/bombsimon/wsl/assets/31022056/bd2a5214-1ec1-4f72-8f24-aecda57099cd)

**wsl -V=full**: `/home/main/go/bin/wsl version devel comments-go-here buildID=e631328272005e19fcb7774191f8cc3535d896a2a0ff3946a982e95dc9b3736c`

**GOOS**: Arch Linux
**GOARCH**: `amd64`

## Expected behaviour

Expressions cannot be cuddled with either `for` nor `if` blocks.

Pull request description:
Fix missing expression cuddle check
Resolves #153 

Patch:
diff --git a/wsl.go b/wsl.go
index 0b8d8c0..76f4abf 100644
--- a/wsl.go
+++ b/wsl.go
@@ -583,7 +583,7 @@ func (p *processor) parseBlockStatements(statements []ast.Stmt) {
 				}
 
 				p.addWhitespaceBeforeError(t, reasonExpressionCuddledWithDeclOrRet)
-			case *ast.IfStmt, *ast.RangeStmt, *ast.SwitchStmt:
+			case *ast.IfStmt, *ast.RangeStmt, *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.ForStmt:
 				p.addWhitespaceBeforeError(t, reasonExpressionCuddledWithBlock)
 			}
 


Test patch:
diff --git a/testdata/src/default_config/generic_handling.go b/testdata/src/default_config/generic_handling.go
index 89490eb..204d71d 100644
--- a/testdata/src/default_config/generic_handling.go
+++ b/testdata/src/default_config/generic_handling.go
@@ -592,3 +592,16 @@ func AnonymousFunc() {
 		return nil // want "return statements should not be cuddled if block has more than two lines"
 	}())
 }
+
+// Issue #153
+func ExpressionForBlock() {
+	for i := 0; i < 4; i++ {
+		fmt.Println()
+	}
+	Up(3) // want "expressions should not be cuddled with blocks"
+
+	if autoheight != 3 {
+		t.Errorf("height should be 3 but is %d", autoheight)
+	}
+	Down(3) // want "expressions should not be cuddled with blocks"
+}
diff --git a/testdata/src/default_config/generic_handling.go.golden b/testdata/src/default_config/generic_handling.go.golden
index 8c6f585..86bd161 100644
--- a/testdata/src/default_config/generic_handling.go.golden
+++ b/testdata/src/default_config/generic_handling.go.golden
@@ -639,3 +639,18 @@ func AnonymousFunc() {
 		return nil // want "return statements should not be cuddled if block has more than two lines"
 	}())
 }
+
+// Issue #153
+func ExpressionForBlock() {
+	for i := 0; i < 4; i++ {
+		fmt.Println()
+	}
+
+	Up(3) // want "expressions should not be cuddled with blocks"
+
+	if autoheight != 3 {
+		t.Errorf("height should be 3 but is %d", autoheight)
+	}
+
+	Down(3) // want "expressions should not be cuddled with blocks"
+}