-
Notifications
You must be signed in to change notification settings - Fork 8
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
Typechecking of ENFORCE statement is incorrect #1281
Comments
@hanjoosten can you give an example in Ampersand source code? |
@hanjoosten can you make this reproducible for @sjcjoosten? |
Sure, The following example shows this behavior, because the types of the sources should match and the types of the targets should match as well:
This script passes the type checker, which it shouldn't. It then leads to the following runtime error in the compiler:
(details added by @stefjoosten) |
@sjcjoosten I have tried to fix this issue myself. I started the branch https://github.com/AmpersandTarski/Ampersand/tree/feature/typecheck-ENFORCE for this. I tried to get my head around this, and spend the whole aftenoon trying to find out how to do this. Very frustrating. I thought it would be easy, like the typecheck of the PEqu. But I underestimated. Could you please have a look at this? |
Here is another example, which I ran into in practice:
This script passes the type checker, as expected, and leads to the following runtime error in the compiler:
|
WorkaroundThere is an obvious workaround: Make sure the ENFORCE rule is type-safe without relying on ISA's. So the script I just gave can be compiled without problems if reformulated thus:
|
Alas, this issue has not been resolved completely. The example I gave does not compile. It still produces:
Apparently you didn't test it, so I have now introduced this example into the regression test. |
@sjcjoosten, I found the root cause of this problem. It is where we extract the rules from the enforce statement. It can be found in this commit: 6c011ae . |
I have been experimenting with the ENFORCE statement. However, in doing so, I got a fatal (while building a docker image):
The script I was editing has a clear type error, but the daemon didn't complain about it. Hence, I expect the root cause is that there is no proper type checking of the ENFORCE statement.
The text was updated successfully, but these errors were encountered: