-
Notifications
You must be signed in to change notification settings - Fork 449
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
Messages and contstructor cannot be conditionally compiled #1231
Comments
Trying to open the reproducer link. It is broken. Can you double check whether the issue is still relevant @athei ? |
I have looked into this. Here are my findings:
So my guess: because we try to generate and use |
Reopening issue as my solution was not working and #1479 got reverted. After digging around I have not found an ultimate solution to this problem as the codegen in Problem statementThere are certain problems associated with conditionally compilation of contracts elements (messages, constructors, events):
The above list of examples is not exhaustive and there are others places where similar pre-compilation evaluation occur. That means that we can not just extract Possible solutionsIt is actually hard to call them solutions. More like workaround.
This solution is not ideal because there still be traces of omitted function.
Pretty cumbersome solution which doesn't account for other conditional compilation flags and require syntactical analysis which make it brittle.
|
After the digging around, I came into the conclusion that we need to change the way we generate intermediate representation for messages and constructors. As an example I will refer to Currently, everything single message "artefact" in My proposal is to remove constant array |
Why does the message even land in the IR in the first place? Can't we just ignore it during parsing? PS: I've updated the minimal reproducer in the issue description to a working link. |
No, we can't, My PR provides a solution to this. It will completely omit any presence of the message in IR. |
Minimal reproducer: https://ink-playground.substrate.io/?id=d666be89f36785e487036bf43d7b175b
It is the same for constructors. I would expect for the message to be just not included in the contract. Instead I get this error:
The text was updated successfully, but these errors were encountered: