Conversation
|
|
|
Checking stubs for changes and corresponding version bump in origin/arc56-field-descriptions Last puyapy release: v5.7.1 💡 Stub version change: 3.4.0 -> 3.5.0 |
|
| @typing.final | ||
| @attrs.frozen(kw_only=True) | ||
| class WTypeField: | ||
| name: str = attrs.field() | ||
| type: WType = attrs.field() | ||
| docs: str | None = attrs.field(default=None, eq=False) | ||
|
|
||
|
|
There was a problem hiding this comment.
We will have to regenerate the bindings on the puya-ts side. Is there anything else to regenerate?
There was a problem hiding this comment.
test_ts_code_gen.py should update tests\output\nodes.ts.txt which can then be used in puya-ts
There was a problem hiding this comment.
Actually that only updates nodes, WTypes change fairly infrequently so at the moment I think we just update those manually in puya-ts
c75a826 to
f51aaa3
Compare
|
Broadly looks good, |
3c1dfb3 to
318cebe
Compare
318cebe to
dfe9a14
Compare
| if repeated_field_names: | ||
| raise CodeError( | ||
| "invalid ARC-4 Struct declaration," | ||
| f"the following fields are not unique: {', '.join(repeated_field_names)}" |
There was a problem hiding this comment.
So because this is using a set, if there was a test for this error, the output would not be stable (side note: should there be a test?).
| location=self.source_location, | ||
| ) | ||
|
|
||
| field_names = set() |
There was a problem hiding this comment.
Counter is a subclass of dict so will be stable
| field_names = set() | |
| field_counts = Counter(field.name for field in value) | |
| repeated_field_names = [ | |
| field_name for field_name, count in field_counts.items() if count > 1 | |
| ] |
Will also need from collections import Counter
daniel-makerx
left a comment
There was a problem hiding this comment.
Once those comments are resolved this looks good to go!
This PR modifies the structure of both struct PyTypes and struct WTypes so their fields can carry documentation.
When a structured value is emitted we properly plumb these field docs up to their proper place in the ARC56 spec.
The AWST tests had their JSONs regenerated by parsing and re-serializing them thanks to a custom adapter made by @daniel-makerx modified a bit by me (because we changed the format in the meantime).