summaryrefslogtreecommitdiff
path: root/toplevel/topdirs.ml
Commit message (Collapse)AuthorAgeFilesLines
* rename wrap_def -> with_local_level, etc.Takafumi Saikawa2022-12-271-2/+2
|
* fixTakafumi Saikawa2022-12-271-20/+20
|
* Introduce wrapper functions for level management ([Ctype.wrap_def], etc)Takafumi Saikawa2022-12-271-30/+30
| | | | | | | | and for type variable scoping ([Typetexp.wrap_type_variable_scope]). The older API ([Ctype.(begin_def,end_def)], [Typetexp.(narrow,widen)], etc.) is now removed. The scope of some level management is refined (in particular for [type_application]).
* Merge pull request #11534 from gasche/follow-synonyms-in-show-module-typeFlorian Angeletti2022-12-021-10/+32
| | | | | | Follow synonyms in #show_module _type (cherry picked from commit 85a081792117f2f4a312aee3484e84fed8dd5b8a)
* topdirs.ml: (install,remove)_printer, test error casesGabriel Scherer2022-11-261-1/+1
|
* topdirs.ml: avoid exceptions completely in #(remove,install)_printerGabriel Scherer2022-11-261-38/+52
| | | | Suggested-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
* topdirs.ml: rewrite the printer-matching logic to avoid exceptionsGabriel Scherer2022-11-261-59/+66
| | | | Suggested-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
* topdirs.ml: Generic printers only need an arityGabriel Scherer2022-11-261-9/+10
|
* [minor] topdirs.ml: bound the scope of find_printer exception handlingGabriel Scherer2022-11-261-6/+6
|
* topdirs.ml: cleaner representation of different kinds of printersGabriel Scherer2022-11-261-31/+48
|
* topdirs.ml; generic printers are never old-styleGabriel Scherer2022-11-261-9/+6
|
* Define printer types manually rather than parsing them from stringsSébastien Hinderer2022-11-241-17/+12
|
* Embed printer types in toplevels and debuggerSébastien Hinderer2022-11-241-30/+14
| | | | | | | | | | | | | | | | | | | The debugger and toplevels let users install printers for their data types. To make sure the provided printers have the right type, both the debugger and the toplevel need to know the internal OCaml representation of the expected types. So far, both the debugger and the toplevels used to extract the expected representatioons from topdirs.cmi which they were reading at runtime. This creates problems (e.g. when the compiler has not yet been installed) and yields not so easy to read code. In this commit, the type of the printers are defined in strings as they would be written in OCaml in topdirs.ml. These strings are parsed at runtime and the corresponding typing declarations are added to the environment.
* Remove hash type encodingHyunggyu Jang2022-11-091-6/+2
|
* Add a toplevel directive to switch off debugging (#9290)Jacques Garrigue2022-07-191-0/+7
|
* Merge pull request #10839 from Et7f3/fix_show_regressionFlorian Angeletti2022-01-271-4/+18
| | | | | | fix #show regression in 4.14 (cherry picked from commit ae1a31b01922642389758e313777feaab9de93a0)
* make field_kind and commutable abstract typesTakafumi Saikawa2021-10-181-1/+1
|
* Fix #directory in the toplevelDavid Allsopp2021-06-071-1/+1
| | | | | | | | The #directory directive now uses Load_path.prepend_dir which adds the directory given to the _start_ of the load path (i.e. overriding everything already loaded). This is slightly more intuitive for the toplevel, consistent with the previous (undefined) behaviour, and also consistent with treatment of the directory for the DLL search path.
* Rename Load_path.add to Load_path.append_dirDavid Allsopp2021-06-071-1/+1
| | | | | Clarify the meaning of where the directory gets added (cf. Dll.add_path which adds directories at the start of the search path)
* #3959, #7202: in script mode, handle directive errors (#10476)Florian Angeletti2021-07-081-20/+33
|
* Move function from Types to BtypeNicolas Chataing2021-07-051-1/+1
|
* Move logic to get the type path from a constructor return type in TypesNicolas Chataing2021-07-021-5/+1
|
* Normalize type_expr nodes on access (#10337)Jacques Garrigue2021-06-241-5/+6
| | | Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
* Respond to review for the new structured error messages (#10407)Antal Spector-Zabusky2021-06-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | In addition to the smaller fixes, there were two major changes: 1. `Errortrace` has its type completely refactored, removing `desc` and exposing both `'variant trace` and `'variant error`. The former is for traces that are being built up, and contains `type_expr`s; the lattern is for complete traces, and contains `expanded_type`s (a record containing two `type_expr`s). This dramatically affected a number of call sites, but is much cleaner. 2. We now detect weakly polymorphic types much better during printing. This involved fixing a bug in moregeneral, which was not restoring enough information in the error case; it also involved exposing the flag that differentiated between printing a type (no weakly polymorphic type detection) and a scheme (yes weakly polymorphic type detection) in more places, and giving it its own custom variant type, `Printtyp.type_or_scheme`. Among the minor changes, the updates to `Includecore` to more carefully detect privacy violation errors and differentiate between the various kinds thereof (recorded in the `privacy_mismatch` type) is the most visible in the code.
* Use the new structured errors (#10170) for better error messagesAntal Spector-Zabusky2021-06-211-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now produce more detailed error messages during various kinds of module inclusion, taking advantage of the new structured error trace generation from #10170. Previously, these errors were "shallow", ending as soon as there was an incompatibility; this patch makes them "deep", reporting the *reasons* for those problems. For example, consider the following module: module M : sig val x : bool * int end = struct let x = false , "not an int" end This now produces the following error: Error: Signature mismatch: Modules do not match: sig val x : bool * string end is not included in sig val x : bool * int end Values do not match: val x : bool * string is not included in val x : bool * int The type bool * string is not compatible with the type bool * int Type string is not compatible with type int The last two lines are new in this patch. Previously, the error message stopped two lines earlier, omitting the key detail that the reason there is an error is specifically that `string` is not equal to `int`.
* added -e eval option for runtop and natruntopzett982021-06-051-2/+4
|
* toplevel: detect recursive definitions in #showFlorian Angeletti2021-05-191-7/+56
|
* Maintain more structural information in type-checking errorsAntal Spector-Zabusky2021-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | This commit refactors the types that make up type-checking errors to maintain more structural information. Most significantly, we split out the errors we get from unification, moregen, and type equality in `Ctype` into three distinct exceptions, and retain the sorts of information we keep during unification in the other two cases as well (no more `Unify []`). We also maintain more information in `Includecore` about mismatches of primitives, manifests, and private objects and variants This commit doesn't make a lot of changes to the user-visible error messages yet, only what's necessary to support the type changes, but it enables a forthcoming patch where we use this improvement to produce more informative error messages. This commit includes existing work by Mekhrubon Tuarev, who did all the early development. I (Antal Spector-Zabusky) came and built the layer of types on top.
* compiler interface: deprecate single letter warningoctachron2021-03-151-1/+1
| | | | | | | | | | For instance, -w "Ae" now raises an ocaml_deprecated_cli alert. Setting warning with prefixed letters (-w "+a-e") is clearer and coexists better with named warnings (-w +fragile-match). In particular, this new alert should warn on spelling mistakes like -w +fragile-math
* More manual/src changesJohn Whitington2021-01-291-1/+1
|
* Factorise bytecode and native toplevels (#10124)Louis Gesbert2021-01-261-0/+662
| | | | Introduce modules Topeval and Topcommon to share common code between the bytecode and native toplevel.
* Unify topXXX.mli / opttopXXX.mli (#10061)Louis Gesbert2020-12-081-847/+0
| | | | | | | | | | | | This unifies both implementations of the toplevel under a common interface. Similar Makefile hacks to those in place for dynlink are used: byte and native implementations are in separate directories, while the shared interface are in the parent and copied as needed by the build rules. This is a preliminary step to remove duplication as much as possible in the two implementations, but should already be pretty useful for libraries that use the `Toploop` interface.
* Fix handling of Exit_compiler exception in toplevel (#9798)Nicolás Ojeda Bär2020-10-051-1/+1
|
* Revert to printing types as 'nonrec' to avoid a bugJeremy Yallop2020-08-051-1/+1
| | | | See: https://github.com/ocaml/ocaml/issues/9828
* Add a new toplevel directive #use_output "<command>"Jérémie Dimino2020-03-161-1/+8
| | | | Signed-off-by: Jeremie Dimino <jeremie@dimino.org> Co-authored-by: David Allsopp <david.allsopp@metastack.com>
* Add a unique id to every signature itemThomas Refis2020-03-051-4/+7
|
* [refactoring] use named fields for Consistbl.Inconsistency exceptionGabriel Scherer2019-11-071-1/+5
|
* Fix toplevel show directive to work with constructorsSimon Parry2019-11-051-2/+53
| | | | | | | | | The show directive now has some basic facility to show useful information for constructors of "normal" values, exceptions and other non-exception extension constructors. Also updated show_type to print out recursion status with a default of Trec_first.
* Refactor environment lookup functionsLeo White2019-08-151-76/+82
|
* Functorize Consistbl (with some background info on Compilation_unit.t) (#2286)Mark Shinwell2019-03-071-1/+1
|
* env refactoring: avoid external uses of {add_import,crc_units}Gabriel Scherer2019-02-151-9/+1
| | | | | | | | | | | | | | | There is a small change of behavior in this patch due to a different handling of weak dependencies (those with crco=None); in Env.check_consistency, only non-weak dependencies would get [Env.add_import] called, while the `toplevel/` implementations would also call [Env.add_import] on weak dependencies. After this patch, we systematically call [add_import] only on non-weak dependencies, even in `toplevel/`. ([Gabriel:] As far as I can see, the use of [add_import] in the toplevel never leads to a use of [Env.imports()] for producing a dependency list, as the toplevel does not produce cmi/cmo files; are they just no-ops?)
* Refactor load path management and initial environmentJeremie Dimino2019-01-301-10/+20
| | | | | | | | | - Add a Load_path module which caches files lookup - Instead of falling back to the external environment, allow to declare in the environment that a module comes from the external world. This allows persistent structures to shadows non-persistent ones
* Extend `open` to arbritrary module expressions in structures and toRunhang Li2018-11-261-9/+9
| | | | applicative module paths in signatures
* Remove positions from pathsLeo White2018-11-211-7/+8
|
* ident: add an explicit scope fieldThomas Refis2018-09-211-1/+0
| | | | | | | | - Ident.create now takes a scope as argument - added Ident.create_var to use when the scope doesn't matter - the current_time and the current_level are unrelated as of this commit. But one has to remember to bump the level when creating new scopes.
* Add locations to attributesHugo Heuzard2018-08-061-2/+6
| | | | | | Changes fix typo
* Implement reviewer suggestionsNicolás Ojeda Bär2018-07-251-3/+2
|
* Use reraise_raw_backtrace in Misc.try_finallyFrançois Bobot2018-07-251-7/+4
| | | | | And add labels ~always for previous cleanup function and ~exceptionally for new cleanup function in exceptional case
* ctype: remove instance_def which is redundantThomas Refis2018-07-251-2/+2
|
* Add an optional digest parameter to Meta.reify_bytecode.Stephen Dolan2018-04-131-1/+1
|