Skip to content

Fix upcast -> downcast #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

danaugrs
Copy link

@danaugrs danaugrs commented Jul 27, 2022

Should be "downcast" instead of "upcast".
Thanks for building Matchstick!

@georg-getz
Copy link
Contributor

Hey, thanks for the PR. Although you are generally correct about upcasting being casting to a parent and downcasting being casting to a child, the reason we have left it as upcasting in the docs is because the common error people run into in their subgraphs is when they try to cast in the following way: let newGravatarEvent = newMockEvent() as NewGravatar which although technically downcasting throws the following error in AssemblyScript: Mapping aborted with message: unexpected upcast. And we want people to associate that part of the docs with this error.

@danaugrs
Copy link
Author

danaugrs commented Aug 8, 2022

Thanks for the explanation! Yeah, apparently AssemblyScript is making the original mistake.
I created an issue there (AssemblyScript/assemblyscript#2422) and made a PR to fix it (AssemblyScript/assemblyscript#2423).

@danaugrs
Copy link
Author

The AssemblyScript compiler has been fixed, including the error message: AssemblyScript/assemblyscript#2423.

@georg-getz
Copy link
Contributor

The AssemblyScript compiler has been fixed, including the error message: AssemblyScript/assemblyscript#2423.

Great, the only thing remaining is that the new version with this fix crashes the wasm file compilation. I'll try to check it out next week.

@MaxGraey
Copy link

MaxGraey commented Aug 24, 2022

Great, the only thing remaining is that the new version with this fix crashes the wasm file compilation

Do you have exported mutable globals in such wasm modules? Binaryen introduced new pass which has one minor issue with such globals. It will be fixed in new version of Binaryem:
AssemblyScript/assemblyscript#2461

Also, make sure you're using >= 0.21.1 instead 0.21.0

@georg-getz
Copy link
Contributor

I'm closing this PR 😐 The reason is because this change will only be helpful for people using AssemblyScript 0.20.x+ and as of now that doesn't seem like the direction the Graph is heading in. My guess is that unless something extremely useful or necessary for the Graph is added in future versions of AS, they will probably just stick to version 0.19.10.

The reason the version is such a big problem is that parts of graph-ts do not compile with the newer versions of AS which will force all subgraph developers to have their AS version be inherited from graph-ts.

Needless to say if they decide to update their AS version this change will be enacted.

Thanks for the PR again.

@georg-getz georg-getz closed this Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants