You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5800 Reporter: turpin Assigned to:@garrigue Status: closed (set by @xavierleroy on 2015-12-11T18:08:17Z) Resolution: fixed Priority: low Severity: trivial Version: 4.00.1 Fixed in version: 4.00.2+dev Category: typing
Bug description
In Typecore.type_argument, Applications to "None" are generated to account for absent optional arguments, but the actual labels are not kept in this application. I believe that this just a mistake, which is fixed by the attached patch (only tested by bootstrapping successfully), but I admit that do not fully understand the code of the typechecker.
I assume that this has no effect on the backend, since labels are discarded anyway, but it matters for typedtree transformations.
I think that the arguments are applied in the reverse order: if the function argument has type ?l1:t1 -> ?l2:t2 -> ?l3:t3 -> t -> u, then your patch produces the application (foo ~l3:None ~l2:None ~l1:None) (because "args" are acumulated by a tail-rec function in reverse position). This is correct as label order is not significant, but I would still have a preference for having the label order, in this generated code, mirror the order in the type, for easier readability of the resulting code.
Finally, it's the second time I've had to read this piece of code and it still made my head hurt. In the hope of helping future reviews of the code, I have written a more verbose comment about what it's doing (patch attached). Jacques, would you agree to include it in the code? (Do you have a policy for comments in general? Adding a tad more comment is something I sometimes wish to do when reading the type-checker code.)
I didn't pay attention to the order of arguments, I didn't change the order in which they were produced but since the labels were missing we had "args = rev args", which is no longer true. Is the tail-recursion really needed here ? Who needs so many optional arguments ?
Original bug ID: 5800
Reporter: turpin
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:08:17Z)
Resolution: fixed
Priority: low
Severity: trivial
Version: 4.00.1
Fixed in version: 4.00.2+dev
Category: typing
Bug description
In Typecore.type_argument, Applications to "None" are generated to account for absent optional arguments, but the actual labels are not kept in this application. I believe that this just a mistake, which is fixed by the attached patch (only tested by bootstrapping successfully), but I admit that do not fully understand the code of the typechecker.
I assume that this has no effect on the backend, since labels are discarded anyway, but it matters for typedtree transformations.
Steps to reproduce
unparse the typedtree and recompile...
File attachments
The text was updated successfully, but these errors were encountered: