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

Fix simple-ltid.cu #661

Merged
merged 7 commits into from
Jul 19, 2021
Merged

Fix simple-ltid.cu #661

merged 7 commits into from
Jul 19, 2021

Conversation

bobismijnnaam
Copy link
Contributor

@bobismijnnaam bobismijnnaam commented Jul 16, 2021

To fix simple-ltid.cu, typechecking had to be made stricter.

Typechecking is made less lenient, by not forcing arguments of Perm to frac. Specifically, before, given Perm(x.f, a), a would always be forced to be typechecked as frac, even if it is an int. This PR changes it such that a is only forced to be a frac if it is a literal (say, 1 or 0). Otherwise, the type is left as is.

By not forcing all possible arguments of perm to frac, some rewrite rules had to be changed to match a frac explicitly, instead of an integer.

Additionally, a rewrite rule is added that rewrites any expression Perm(f, a), where a is of type int, to Perm(f, a \ 1), such that passing an int to a perm works out as expected, instead of causing an error. This was also needed to get simple-litd.cu to work.

A rewrite rule is added which ensures that any permission that gets
written to Perm(field, integerExpression) gets rewritten to Perm(field,
fracExpression). Previously the rewrite system could produce terms that
were not well-typed (i.e. produced non-well-typed terms).

simple-ltid.cu is also removed from suite problem-fail.
The rule perm_fix_frac is moved to the end as it seems to interefere with
applying the rule for Perm(xs[*], e1). Doing it later should still work,
and not interfere with the rule for xs[*].
Previously the typechecker would force the secon argument of a Perm to be frac. This would cause the rewriter to rewrite an int variable as a frac. We narrow this to only forcing literals to be frac, and leave all other types as they are. This ensures expressions like "read" are not matched against rewrite matching variables of type int.
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 16, 2021 08:09 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 16, 2021 08:27 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 16, 2021 13:48 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 16, 2021 13:48 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 16, 2021 14:05 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 16, 2021 14:05 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 19, 2021 08:54 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 19, 2021 08:54 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 19, 2021 09:13 Inactive
@bobismijnnaam bobismijnnaam temporarily deployed to Default July 19, 2021 09:16 Inactive
@sonarcloud
Copy link

sonarcloud bot commented Jul 19, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

76.4% 76.4% Coverage
0.0% 0.0% Duplication

@bobismijnnaam
Copy link
Contributor Author

After some discussion with @Vescatur we decided to merge the PR.

@bobismijnnaam bobismijnnaam merged commit 213b691 into dev Jul 19, 2021
@bobismijnnaam bobismijnnaam deleted the fix-simple-ltid branch July 19, 2021 11:49
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