Commit 16f22f7
committed
encoding/xml: fix 'unsupported type' error on interface{} attributes
When given interface value that is actually a type implementing
`encoding.TextMarshaler` or `xml.MarshalerAttr`, `marshalAttr` would return an
`unsupported type` error. The cause of this is that pointer and interface values
are dereferences after checking if the supported interfaces are implemented.
Solve this by moving the dereference of the pointer and interface values to the
start of the function, and update the test cases to test for this situation.1 parent 740a490 commit 16f22f7
2 files changed
+18
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
558 | 567 | | |
559 | 568 | | |
560 | 569 | | |
| |||
601 | 610 | | |
602 | 611 | | |
603 | 612 | | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
346 | 350 | | |
347 | 351 | | |
348 | 352 | | |
| |||
1252 | 1256 | | |
1253 | 1257 | | |
1254 | 1258 | | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
1255 | 1264 | | |
1256 | 1265 | | |
1257 | 1266 | | |
| |||
0 commit comments