Skip to content

display all non-shared returns as Any#5980

Merged
crusso merged 16 commits intoclaudio/data-viewfrom
claudio/data-view-approximate-any
Apr 9, 2026
Merged

display all non-shared returns as Any#5980
crusso merged 16 commits intoclaudio/data-viewfrom
claudio/data-view-approximate-any

Conversation

@crusso
Copy link
Copy Markdown
Contributor

@crusso crusso commented Apr 7, 2026

Builds on #5796 (simplifying the stable to shared type approximation of #5913)

@christoph-dfinity here's the version that always approximates to Any.

I think this might actually be more alarming and a lot less informative than just dropping a few fields and promoting to Any in offending positions but at least it's simple.

It does give an indication that each stable variable contains something, at least.

(Marked do not merge because I want to switch the base to #5796)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

Comparing from 678e537 to 10fedae:
The produced WebAssembly code seems to be completely unchanged.
In terms of gas, no changes are observed in 5 tests.
In terms of size, no changes are observed in 5 tests.

@crusso crusso marked this pull request as ready for review April 8, 2026 08:23
@crusso crusso requested a review from a team as a code owner April 8, 2026 08:23
@christoph-dfinity
Copy link
Copy Markdown
Contributor

I think this might actually be more alarming and a lot less informative than just dropping a few fields and promoting to Any in offending positions but at least it's simple.

I think this at least gives the viewer frontend an easy to detect indication to display a message of "There's data here, but it can't be displayed/serialized"

It does give an indication that each stable variable contains something, at least.

Yeah, and we can improve the fidelity when requested. Maybe by then the easiest way would be to teach the AI to write custom view functions and chuck them into a mixin somewhere.

@Kamirus
Copy link
Copy Markdown
Contributor

Kamirus commented Apr 8, 2026

Wouldn't be helpful to see a real-world example using mo:core and some nested map and how the output would look like?

@crusso
Copy link
Copy Markdown
Contributor Author

crusso commented Apr 8, 2026

Wouldn't be helpful to see a real-world example using mo:core and some nested map and how the output would look like?

For this PR - you would just Any for the entire value.
In the other PR, you would see more, but possibly empty records.
Orignally, I wanted to approximate mutable field var f : T as f : Any, but our subtyping doesn't allow this so the field must be dropped - which I think it was @Christoph objects to. I mean I could approximate record {} as Any in that case...

@crusso
Copy link
Copy Markdown
Contributor Author

crusso commented Apr 8, 2026

Wouldn't be helpful to see a real-world example using mo:core and some nested map and how the output would look like?

I added test data-view-nested (see the diff)

@crusso crusso changed the base branch from claudio/data-view-approximate-shared to claudio/data-view April 9, 2026 12:47
@crusso crusso merged commit a718245 into claudio/data-view Apr 9, 2026
14 checks passed
@crusso crusso deleted the claudio/data-view-approximate-any branch April 9, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants