-
Notifications
You must be signed in to change notification settings - Fork 637
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
Take into account position of main argument of a projection when inserting implicit arguments for syntax t.(f) #14606
Take into account position of main argument of a projection when inserting implicit arguments for syntax t.(f) #14606
Conversation
db7b031
to
b711386
Compare
Hey, I have detected that there were CI failures at commit b711386 without any failure in the test-suite. |
2 similar comments
Hey, I have detected that there were CI failures at commit b711386 without any failure in the test-suite. |
Hey, I have detected that there were CI failures at commit b711386 without any failure in the test-suite. |
b711386
to
5b9df34
Compare
Hey, I have detected that there were CI failures at commit 5b9df34 without any failure in the test-suite. |
5b9df34
to
1397502
Compare
91ff86c
to
20a865e
Compare
20a865e
to
ed30ef4
Compare
interp/constrintern.ml
Outdated
if expl then | ||
[], [] | ||
else | ||
let ngivenparams = List.length (List.filter (fun (_,x) -> x == None) args1) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use List.count
and Option.is_empty
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
let args2 = intern_impargs p env imps2 subscopes2 args2 in | ||
smart_gapp p loc (args0@args1@c::args2) | ||
| None -> | ||
(* Tolerate a use of t.(f) notation for an ordinary application until a decision is taken about it *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is making the t.(p)
notation straying further than the application it used to stand for. Maybe we should take the decision soon. Note that the comment above about "officiality" is wrong, IIUC the code still takes the projection path when the head is an arbitrary reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is making the t.(p) notation straying further than the application it used to stand for.
Yes and no. In this PR, it is still an application but with a treatment of implicit arguments which takes into account that the main argument splits the implicit arguments into two parts.
So, unless I'm missing something. nothing is changed wrt references which have no implicit arguments.
Note that the comment above about "officiality" is wrong
Would replacing "An official projection" by "A reference registered as projection" be ok?
IIUC the code still takes the projection path when the head is an arbitrary reference.
If by projection path you mean intern_proj
, yes, since intern_proj
is called whenever the t.(f)
syntax is used. Is that ok or do you expect something else? For instance, would you prefer that another terminology than "proj" is used to talk about the t.(f)
notation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ppedrot: I used "A reference registered as projection", hoping it is compatible with your view. Should the names of functions (like intern_proj
, etc.) be reconsidered further to avoid any ambiguity? Did I address your questions?
In any case, dependency is merged, will you assign?
[bedrock2's failure is waiting about mit-plv/bedrock2#190]
interp/impargs.ml
Outdated
|
||
let select_impargs_size_for_proj ~nexpectedparams ~ngivenparams ~nextraargs impls = | ||
let split_implicit_params imps = | ||
if imps = [] then (nexpectedparams, [], []) else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use List.is_empty
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Granting your wish.
ed30ef4
to
b0d1791
Compare
b0d1791
to
ca6221e
Compare
ca6221e
to
4799139
Compare
4799139
to
84bf06c
Compare
Is it possible that this is the cause of #14703? |
It looks like this PR also changed notation parsing: |
I could not reproduce. Could you give an example if possible? |
For instance, the following works:
@RalfJung : How different is your real example? |
This is the change that was required. I can try to minimize this. |
Hm, my attempt to isolate this also failed: From Coq Require Import List.
Export ListNotations.
Record type :=
{ ty_size : nat;
ty_own : list nat -> Prop;
ty_size_eq vl : ty_own vl -> length vl = ty_size;
}.
Declare Scope lrust_type_scope.
Delimit Scope lrust_type_scope with T.
Bind Scope lrust_type_scope with type.
Axiom sum : list type -> type.
Notation "Σ[ ty1 ; .. ; tyn ]" :=
(sum (cons ty1%T (..(cons tyn%T nil)..))) : lrust_type_scope.
Axiom t : type.
Check (ty_size Σ[t; t]).
Check ((Σ[t; t]).(ty_size)). Something must still be different than in the full lambda-rust, but I have no idea what. |
Actually, this has nothing to do with scopes and notations. It is another instance of the class argument of |
I don't see that. Using |
For example, further up the same file we do |
You're right, there is a bug (I did not test on the right branch apparently). I'm going to submit a fix soon. |
Awesome, thanks. :) |
…(f) notation Reviewed-by: ppedrot
There's a changelog, but shouldn't there be something in the doc too? |
…best implicit arguments signature for projections Reviewed-by: SkySkimmer Ack-by: artagnon Co-authored-by: SkySkimmer <SkySkimmer@users.noreply.github.com>
…n computing best implicit arguments signature for projections
Kind: fix and enhancement
Depends on mattam82/Coq-Equations#413 (or at worst on tolerant
Loc.merge
in #14618).Fixes #4167 and improve error message when a field has a wrong number of explicit parameters
This is done by introducing special functions for interning/externing which cut the implicit arguments signature of a projection into a parameter part and an extra functional part (if ever the projection happens to return a function with its own implicit arguments).