-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the selective-enforce and tests
- Loading branch information
1 parent
bc6a183
commit c728146
Showing
4 changed files
with
46 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
testdata/src/default-signifies-exhaustive/default-not-required/default_not_required.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package present | ||
|
||
import "default-signifies-exhaustive" | ||
|
||
func _a(t dse.T) { | ||
// No diagnostic because default-require is not set. | ||
switch t { | ||
case dse.A: | ||
case dse.B: | ||
} | ||
} | ||
|
||
func _b(t dse.T) { | ||
//exhaustive:default-require-enforce this is a comment showing that we can turn it on for select switches | ||
switch t { // want "^missing default in switch of type dse.T$" | ||
case dse.A: | ||
case dse.B: | ||
} | ||
} | ||
|
||
func _c(t dse.T) { | ||
//exhaustive:default-require-enforce this is happy because it has a default | ||
switch t { | ||
case dse.A: | ||
case dse.B: | ||
default: | ||
} | ||
} |