assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Upcast and downcast are switched

Open danaugrs opened this issue 1 year ago • 1 comments

Hi! Thanks for building AssemblyScript! I noticed that "upcast" and "downcast" are switched:

https://github.com/AssemblyScript/assemblyscript/blob/53af0e02113f0c4cd84947465a8c5064d3a82786/src/compiler.ts#L3472-L3501

"Upcast" should be the straightforward, static case whereas "downcast" should be dynamic and more complex. No logic changes are needed, just the words need to be switched, especially in the error message below:

https://github.com/AssemblyScript/assemblyscript/blob/53af0e02113f0c4cd84947465a8c5064d3a82786/src/compiler.ts#L10564

For context, that error message was pointed out to be wrong in https://github.com/LimeChain/demo-subgraph/pull/39.

I created a PR to fix this issue: https://github.com/AssemblyScript/assemblyscript/pull/2423.

danaugrs avatar Aug 08 '22 12:08 danaugrs

Looks like managed-cast test still fail

MaxGraey avatar Aug 09 '22 10:08 MaxGraey