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

Ctype nitpicks #10211

Merged
merged 5 commits into from
Feb 12, 2021
Merged

Ctype nitpicks #10211

merged 5 commits into from
Feb 12, 2021

Conversation

trefis
Copy link
Contributor

@trefis trefis commented Feb 10, 2021

The first commit (around generalize_structure) is just some trivial clean up that could/should have happened years ago when the surrounding code and interface changed.

The second commit removes a comment that was introduced in #9994 which is incorrect, and for which I already left a note in the PR. That comment was also, in my opinion, not really useful: it doesn't bring extra information, everything it says is obvious from the code, and it doesn't explain the motivations behind the code (not that it would be necessary in this particular case).

The next two commits are also follow ups to #9994, but I thought I'd just propose the changes instead of leaving more comments on that PR. The basic idea is that before that PR the code in check_scope_escape was using the exact same marking-through-levels code as the rest of Ctype, but the PR broke that regularity for no good reason. I think what happened is that the pattern was abstracted in that PR, and since that particular use of it didn't quite fit the template, then it got its own ad-hoc code.
So I extended a bit the template, and I think the result is neat.

Copy link
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the patch out of curiosity, it looks correct. I'm not sure what was the issue with the comment removed in the second commit, but I'm happy to trust you on that. See inline comment.

(I believe that @garrigue and @t6s may want to formulate an opinion on this change, so I won't merge right away.)

typing/btype.mli Show resolved Hide resolved
@trefis
Copy link
Contributor Author

trefis commented Feb 11, 2021

I'm not sure what was the issue with the comment removed in the second commit, but I'm happy to trust you on that.

I believe (but again, I might have misread (several times)) that the comment states the exact opposite of what the code does/what the line below enforces.

@gasche
Copy link
Member

gasche commented Feb 11, 2021

I hadn't looked at the code following the comment in detail, my remark meant "I haven't reviewed this part". Now I have and I agree with you.

typing/ctype.ml Outdated Show resolved Hide resolved
@gasche
Copy link
Member

gasche commented Feb 11, 2021

(I changed my mind about "not merging right away", I think it's good to go.)

@garrigue
Copy link
Contributor

garrigue commented Feb 12, 2021

This looks fine to me too.
Indeed, the use of var_level in generalize_structure is now dead code. Some archeology would be needed to know since when this is so.

By the way, the reason we still have two ways to undo the marking is that one can only use backtracking when newly created types do not survive the traversal. Otherwise, any action on this new type that was logged would be undone too (and tracking what is logged and what isn't is error prone).

@gasche gasche merged commit a664d28 into ocaml:trunk Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants