-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Change representation of class signatures #8516
Commits on Jul 13, 2021
-
Configuration menu - View commit details
-
Copy full SHA for a734bc6 - Browse repository at this point
Copy the full SHA a734bc6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 73c8add - Browse repository at this point
Copy the full SHA 73c8addView commit details -
Relax object duplication restrictions
Currently object duplications (i.e. `{< ... >}`) can only refer to instance variables that are specified before the method in which they occur. This restriction made sense before OCaml 3.10 when instance variables could shadow one another. However, instance variables now override one another instead and so the restriction is not needed.
Configuration menu - View commit details
-
Copy full SHA for 0ca24f9 - Browse repository at this point
Copy the full SHA 0ca24f9View commit details -
Move the extension of the method environment to the second pass of `class_field` in "typeclass.ml".
Configuration menu - View commit details
-
Copy full SHA for b28ce4a - Browse repository at this point
Copy the full SHA b28ce4aView commit details -
Configuration menu - View commit details
-
Copy full SHA for caf5108 - Browse repository at this point
Copy the full SHA caf5108View commit details -
Change representation of class types
Previously, class types represented their methods via the csig_self field. This was a type_expr that was restricted to be syntactically a Tobject node. With this patch the methods are represented directly with a methods table. csig_self is no longer restricted to be a Tobject node and is no longer required to contain the private methods. We also add a csig_self_row field to hold the row variable of the class type -- which means we can avoid going through csig_self to find it.
Configuration menu - View commit details
-
Copy full SHA for 6e5b863 - Browse repository at this point
Copy the full SHA 6e5b863View commit details -
Configuration menu - View commit details
-
Copy full SHA for 37c5cb1 - Browse repository at this point
Copy the full SHA 37c5cb1View commit details -
Add dummy methods in all cases
Fix some regressions introduced 4.07 by ensuring that class types and class expressions for classes under construction always include a dummy method.
Configuration menu - View commit details
-
Copy full SHA for 013717d - Browse repository at this point
Copy the full SHA 013717dView commit details -
Give more precise errors for virtual methods
Previously, the check that a non-virtual class did not have virtual methods was delayed until the last stage of type-checking the class. Now we do those checks more eagerly allowing for clearer errors, especially in common cases.
Configuration menu - View commit details
-
Copy full SHA for 1aa65fa - Browse repository at this point
Copy the full SHA 1aa65faView commit details -
Represent ancestor variables more directly
Previously, some of the translation of method calls on ancestor variables (bindings from `inherit` statements) was done in typecore.ml by creating fake typedtree expressions. This has been moved into translcore.ml which is simpler. We also pass the types of inherited methods directly as part of the ancestor variable's kind, which eleminates the need for the dummy `selfpat-n` variables.
Configuration menu - View commit details
-
Copy full SHA for b43ecd1 - Browse repository at this point
Copy the full SHA b43ecd1View commit details -
Track dummy methods via their scope
Prevent self types from escaping using the scope of the dummy method field rather than its level. This is a more accurate representation of the restriction and allows the level of the self type to vary, which fixes a bug in principal mode.
Configuration menu - View commit details
-
Copy full SHA for e6aa05b - Browse repository at this point
Copy the full SHA e6aa05bView commit details -
Remove private_self and public_self
Now that private methods are stored in the method table there is no need to distinguish `private_self`, `public_self` and `self_type` in `Typeclass.class_structure`. This required extending `Ctype.filter_method` to handle the case of filtering a private method from a closed object type -- which brings the function into line with the equivalent call to `Ctype.unify`.
Configuration menu - View commit details
-
Copy full SHA for 8f9b766 - Browse repository at this point
Copy the full SHA 8f9b766View commit details
Commits on Jul 14, 2021
-
Treat class_signature more like type_expr
Treat class_signature more like type_expr by making all its components mutable and using three unification-like operations for manipulating them: add_method, add_instance_variable and inherit_class_signature. These operations behave similarly to filter_self_method, which they replace. We move much of the logic for handling class_signature into Btype and Ctype and use it for the typing of class signatures and class structures. Instead of using method and variable tables with both identifiers and type components as accumulators during class structure typing, we use tables with just identifiers along with a single class_signature. This makes the logic clearer and makes it easier to share things with the typing of class signatures.
Configuration menu - View commit details
-
Copy full SHA for 845ac93 - Browse repository at this point
Copy the full SHA 845ac93View commit details -
Fix warning attributes in class signatures
[@@@warning ...] was not previously preserved in class signatures
Configuration menu - View commit details
-
Copy full SHA for 19203f8 - Browse repository at this point
Copy the full SHA 19203f8View commit details -
Sets the object name of the self type to the #-abbreviation, which improves error messages and allows us to remove the `unify_parents` functions from Typeclass.
Configuration menu - View commit details
-
Copy full SHA for b7ef616 - Browse repository at this point
Copy the full SHA b7ef616View commit details
Commits on Jul 15, 2021
-
Keep class signature row up-to-date
Keep the csig_self_row field up-to-date as we add new methods. This seems more correct and should be slightly more efficient in the common case.
Configuration menu - View commit details
-
Copy full SHA for f7e6b79 - Browse repository at this point
Copy the full SHA f7e6b79View commit details -
The Types.Concr module is just a string set, and it is used in a number of places. It was originally used for the set of concrete methods in a class signature, but it's not used for that anymore and almost none of the places it is still used are related to that. This commit replaces is with MethSet and VarSet modules for sets of method or instance variable labels, and with Misc.Stdlib.String.Set for other uses.
Configuration menu - View commit details
-
Copy full SHA for dc351b3 - Browse repository at this point
Copy the full SHA dc351b3View commit details -
Remove the mention of OCaml 3.10 in the message of warning 13 (instance variable override). It's been over a decade since that release -- I think we can stop telling people that it changed the behaviour of instance variables.
Configuration menu - View commit details
-
Copy full SHA for dbd5002 - Browse repository at this point
Copy the full SHA dbd5002View commit details -
Move method spine generalisation logic into Ctype
Move the method spine generalisation code into ctype.ml. Since that is the only code that needs to use generalize_spine we also hide generalize_spine from the interface of Ctype and rewrite the other use to use generalize_structure. (I would prefer to get rid of generalize_spine and use generalize_structure for methods as well, since generalize_spine seems a bit suspect in terms of principality, but that change would be very invovlved).
Configuration menu - View commit details
-
Copy full SHA for 964a13c - Browse repository at this point
Copy the full SHA 964a13cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 990ea08 - Browse repository at this point
Copy the full SHA 990ea08View commit details -
Add helpers for warning_scope in typeclass.ml
Add a couple of small helper functions to reduce code duplication around calls to warning_scope.
Configuration menu - View commit details
-
Copy full SHA for e8dd017 - Browse repository at this point
Copy the full SHA e8dd017View commit details -
Configuration menu - View commit details
-
Copy full SHA for 73b648e - Browse repository at this point
Copy the full SHA 73b648eView commit details