Commit 9eb3406
Fix empty array encoding for all unencodable types and add struct tests
- Broaden isEncodableElemType check to also reject non-enum struct types,
not just boxed reference types. Previously empty struct arrays compiled
but produced invalid custom attribute metadata (encoded as enum type),
causing CustomAttributeFormatException at runtime.
- Add positive test for empty struct array in attribute (compile + ILVerify + run).
- Add negative test for non-empty struct array in attribute (expect error 267).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent d2be16e commit 9eb3406
2 files changed
Lines changed: 75 additions & 9 deletions
File tree
- src/Compiler/CodeGen
- tests/FSharp.Compiler.ComponentTests/Language
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10335 | 10335 | | |
10336 | 10336 | | |
10337 | 10337 | | |
10338 | | - | |
| 10338 | + | |
10339 | 10339 | | |
10340 | | - | |
| 10340 | + | |
10341 | 10341 | | |
10342 | | - | |
10343 | | - | |
10344 | | - | |
10345 | | - | |
10346 | | - | |
10347 | | - | |
| 10342 | + | |
| 10343 | + | |
| 10344 | + | |
| 10345 | + | |
| 10346 | + | |
| 10347 | + | |
| 10348 | + | |
| 10349 | + | |
| 10350 | + | |
| 10351 | + | |
| 10352 | + | |
| 10353 | + | |
| 10354 | + | |
| 10355 | + | |
| 10356 | + | |
| 10357 | + | |
| 10358 | + | |
| 10359 | + | |
| 10360 | + | |
10348 | 10361 | | |
10349 | 10362 | | |
10350 | | - | |
| 10363 | + | |
10351 | 10364 | | |
10352 | 10365 | | |
10353 | 10366 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
0 commit comments