Skip to content

Conversation

@copybara-service
Copy link

Adjust indentation of line comments inside expression switches

For statement switches there's some ambiguity about whether a comment documents the previous or next case:

  case 1:
    // case 1 falls through to 2
  case 2:
    doSomething()
  // this is information about case 1
  case 1:
  // this is information about case 2
  case 2:
    doSomething()

For expression switches there is no fall through, so assume that a line comments before a case label always apply to the case label after it.

For statement switches there's some ambiguity about whether a comment documents the previous or next case:

```
  case 1:
    // case 1 falls through to 2
  case 2:
    doSomething()
```

```
  // this is information about case 1
  case 1:
  // this is information about case 2
  case 2:
    doSomething()
```

For expression switches there is no fall through, so assume that a line comments before a case label always apply to the case label after it.

PiperOrigin-RevId: 644163145
@copybara-service copybara-service bot merged commit 3affd63 into master Jun 17, 2024
@copybara-service copybara-service bot deleted the test_644118711 branch June 17, 2024 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant