|
| 1 | +//golangcitest:args -Eiotamixing |
| 2 | +package testdata |
| 3 | + |
| 4 | +import "fmt" |
| 5 | + |
| 6 | +// iota mixing in const block containing an iota and r-val declared above. |
| 7 | +const ( // want "iota mixing. keep iotas in separate blocks to consts with r-val" |
| 8 | + InvalidPerBlockIotaDeclAboveAnything = "anything" |
| 9 | + InvalidPerBlockIotaDeclAboveNotZero = iota |
| 10 | + InvalidPerBlockIotaDeclAboveNotOne |
| 11 | + InvalidPerBlockIotaDeclAboveNotTwo |
| 12 | +) |
| 13 | + |
| 14 | +// iota mixing in const block containing an iota and r-val declared below. |
| 15 | +const ( // want "iota mixing. keep iotas in separate blocks to consts with r-val" |
| 16 | + InvalidPerBlockIotaDeclBelowZero = iota |
| 17 | + InvalidPerBlockIotaDeclBelowOne |
| 18 | + InvalidPerBlockIotaDeclBelowTwo |
| 19 | + InvalidPerBlockIotaDeclBelowAnything = "anything" |
| 20 | +) |
| 21 | + |
| 22 | +// iota mixing in const block containing an iota and r-val declared between consts. |
| 23 | +const ( // want "iota mixing. keep iotas in separate blocks to consts with r-val" |
| 24 | + InvalidPerBlockIotaDeclBetweenZero = iota |
| 25 | + InvalidPerBlockIotaDeclBetweenOne |
| 26 | + InvalidPerBlockIotaDeclBetweenAnything = "anything" |
| 27 | + InvalidPerBlockIotaDeclBetweenNotTwo |
| 28 | +) |
| 29 | + |
| 30 | +// iota mixing in const block containing an iota and r-vals declared above, between, and below consts. |
| 31 | +const ( // want "iota mixing. keep iotas in separate blocks to consts with r-val" |
| 32 | + InvalidPerBlockIotaDeclMultipleAbove = "above" |
| 33 | + InvalidPerBlockIotaDeclMultipleNotZero = iota |
| 34 | + InvalidPerBlockIotaDeclMultipleNotOne |
| 35 | + InvalidPerBlockIotaDeclMultipleBetween = "between" |
| 36 | + InvalidPerBlockIotaDeclMultipleNotTwo |
| 37 | + InvalidPerBlockIotaDeclMultipleBelow = "below" |
| 38 | +) |
| 39 | + |
| 40 | +// no iota mixing in a const block containing an iota and no r-vals. |
| 41 | +const ( |
| 42 | + ValidPerBlockIotaZero = iota |
| 43 | + ValidPerBlockIotaOne |
| 44 | + ValidPerBlockIotaTwo |
| 45 | +) |
| 46 | + |
| 47 | +// no iota mixing in a const block containing r-vals and no iota. |
| 48 | +const ( |
| 49 | + ValidPerBlockRegularSomething = "something" |
| 50 | + ValidPerBlockRegularAnything = "anything" |
| 51 | +) |
| 52 | + |
| 53 | +func _() { |
| 54 | + fmt.Println("using the std import so goland doesn't nuke it") |
| 55 | +} |
0 commit comments