Skip to content
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

Extend integer comparison to support floats / Add additional magic methods to the allowed whitelist #182

Merged
merged 6 commits into from
Apr 25, 2024

Conversation

PascalDevenoge
Copy link
Contributor

@PascalDevenoge PascalDevenoge commented Mar 25, 2024

This change is Reviewable

@PascalDevenoge
Copy link
Contributor Author

@marcoeilers There must be some typo somewhere, but I've stared at it for a while and I can't find it.

@marcoeilers
Copy link
Owner

You can add

print(resolver.messages())

after resolved = resolver.run() in main.py to get type error messages.
Then I get this:

List(FastMessage(found incompatible type `Int`, expected `Ref`,float.sil@17.35--17.54,true), FastMessage(found incompatible type `Int`, expected `Ref`,float.sil@24.35--24.54,true), FastMessage(found incompatible type `Int`, expected `Ref`,float.sil@31.35--31.54,true), FastMessage(found incompatible type `Int`, expected `Ref`,float.sil@38.35--38.54,true))

Uninterpreted versions of float comparison functions refer to the
respective integer comparisons if the operands are actually integers.
The integer comparison functions expect their parameters to still be
boxed types, so the float functions should not unbox the arguments.
@PascalDevenoge
Copy link
Contributor Author

@marcoeilers Are circular dependencies in the preamble.index file an issue by any chance?

@marcoeilers
Copy link
Owner

No, I don't think so.

@PascalDevenoge
Copy link
Contributor Author

PascalDevenoge commented Mar 26, 2024

I think I found the mistake I've made. Some test programs fail to translate after I've adjusted the int type functions, but as far I can see, this only happens to SIF test cases. So I guess I have to make the same changes to the other preamble.index file loaded when enabling SIF mode, is that right?

Since integer comparison functions reference the equivalent float versions
of those functions, the definitions of the float type functions need to
be included in the translation output in SIF mode too. The relevant file
paths are added to the include list in the SIF mode version of all.sil
@PascalDevenoge PascalDevenoge marked this pull request as ready for review April 2, 2024 12:03
@PascalDevenoge
Copy link
Contributor Author

@marcoeilers Alright, should be ready now.

@marcoeilers marcoeilers merged commit 51c3d2b into marcoeilers:master Apr 25, 2024
1 check passed
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.

2 participants