Commit 8439485
authored
Add pragma to suppress unreachable pattern warnings (#143)
* Add pragma to suppress unreachable pattern warnings
This commit introduces the `#pragma warning disable CS8510` directive to suppress warnings about unreachable patterns in switch expressions. The directive has been added to `SourceGenerationHelper.cs` and various test files to prevent unnecessary warnings during code generation. The corresponding `#pragma warning restore CS8510` directive has also been included to restore the warning state after the relevant code sections.
* Remove `#pragma warning disable CS8510` directive across multiple files and enhance enum generation functionality. Added methods for parsing and checking defined enum values, along with new extension methods. Introduced tests to verify correct generation of enums with repeated values and flags.
* Enhance `SourceGenerationHelper` to track constant values of enum members using a new `HashSet<object>`. Update logic for appending enum member values to improve clarity, particularly regarding display names. Introduce two new enums, `EnumWithRepeatedValues` and `EnumWithRepeatedValuesWithDisplayNames`, to handle repeated values and display names. Update tests to reflect changes in enum definitions, including the removal of the `Third` member check due to its repeated value.1 parent c2bb4e0 commit 8439485
File tree
4 files changed
+628
-21
lines changed- src/NetEscapades.EnumGenerators
- tests
- NetEscapades.EnumGenerators.IntegrationTests
- NetEscapades.EnumGenerators.Tests
- Snapshots
4 files changed
+628
-21
lines changedLines changed: 35 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
| 192 | + | |
190 | 193 | | |
191 | 194 | | |
192 | | - | |
193 | | - | |
194 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
195 | 200 | | |
196 | | - | |
197 | | - | |
198 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
| |||
236 | 242 | | |
237 | 243 | | |
238 | 244 | | |
| 245 | + | |
239 | 246 | | |
240 | 247 | | |
241 | | - | |
242 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
243 | 252 | | |
244 | 253 | | |
245 | 254 | | |
246 | | - | |
| 255 | + | |
247 | 256 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
| |||
349 | 359 | | |
350 | 360 | | |
351 | 361 | | |
| 362 | + | |
352 | 363 | | |
353 | 364 | | |
354 | | - | |
355 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
356 | 369 | | |
357 | | - | |
358 | | - | |
359 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
360 | 374 | | |
361 | 375 | | |
362 | 376 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
151 | 169 | | |
0 commit comments