summaryrefslogtreecommitdiff
path: root/toplevel
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Eliminate Topeval.phrase_name entirelyDavid Allsopp2021-10-271-7/+6
| | | |
* | | | Allow the native toplevel assembler to be replacedDavid Allsopp2021-10-142-3/+30
| | | |
* | | | Introduce native-toplevel specific hooks moduleDavid Allsopp2021-10-143-82/+121
| | | | | | | | | | | | | | | | | | | | | | | | This commit simply moves code from Topeval (whose interface is shared with the bytecode interpreter) to a new module Tophooks which is specific to the native toplevel.
* | | | Make Topeval.phrase_name less exposedDavid Allsopp2021-10-141-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The phrase_name ref is updated with a new unique name at the start of Topeval.execute_phrase. All the remaining functions called then use this new value, but beforehand retrieved it from the ref. Making it an argument to Topeval.load_lambda and passing it on to Topeval.load makes the data flow slightly more explicit and also eliminates the need for an accessor function for phrase_name ref later.
* | | | Factor out load/lookup functions in native TopevalDavid Allsopp2021-10-141-14/+20
| | | |
* | | | Remove duplicated type definition in TopevalDavid Allsopp2021-10-141-1/+0
| |_|/ |/| | | | | | | | No need to shadow Topcommon.evaluation_result
* | | abstract row_field (#10627)Jacques Garrigue2021-10-221-1/+1
| | | | | | | | | Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
* | | Merge pull request #10527 from wiktorkuchta/toploopFlorian Angeletti2021-10-211-1/+1
|\ \ \ | |_|/ |/| | toplevel: show "#help;; for help" in startup message
| * | Mention the help directive on toplevel startupWiktor Kuchta2021-10-201-1/+1
| |/
* | make field_kind and commutable abstract typesTakafumi Saikawa2021-10-181-1/+1
|/
* Force normalization on access to `row_desc` (#10474)Jacques Garrigue2021-09-101-4/+3
| | | | | | * always row_repr * remove the dummy field `row_bound` Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
* 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)
* Restore Toploop.use_file (#10557)Nicolás Ojeda Bär2021-08-052-0/+3
|
* Show expected and received type on directive errorWiktor Kuchta2021-07-191-2/+16
|
* toplevel: Move running directives to TopcommonWiktor Kuchta2021-07-174-60/+39
|
* #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-244-16/+18
| | | 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-055-42/+79
|
* Move type_unboxed.unboxed into type_kindStephen Dolan2021-05-251-2/+2
|
* toplevel: detect recursive definitions in #showFlorian Angeletti2021-05-191-7/+56
|
* Merge pull request #10170 from antalsz/pr-better-error-typesGabriel Scherer2021-05-072-2/+2
|\ | | | | Maintain more structural information in type-checking errors
| * Maintain more structural information in type-checking errorsAntal Spector-Zabusky2021-05-062-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #10289 from Zett98/do_not_print_options_in_usage_messageGabriel Scherer2021-05-072-24/+8
|\ \ | |/ |/| Fix for #9295.Do not print options in usage msg
| * dont print options in usage msgzett982021-05-062-24/+8
| |
* | Revert "Merge pull request #9336 from Octachron/mundane_list_printing_fix"octachron2021-05-051-4/+2
| | | | | | | | | | This reverts commit 4dca3c3c6b985bba7262f2c67c4f211283b96cd5, reversing changes made to adcb23f298374e681ac791c2651a0d2ddc8dd083.
* | toplevel: identify list by their typesFlorian Angeletti2021-04-161-2/+4
| |
* | Add warning for unused labelsLeo White2021-03-221-1/+1
| |
* | 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
* Factorise toplevel phrase evaluation between byte and native (#10187)Louis Gesbert2021-02-115-111/+84
| | | | | | | | It's actually even simpler this way! Note that one small change in the interface was required: the function Toploop.eval_address could raise a `Symtable.Error` for undefined globals. Since that wouldn't make sense for the native toplevel, we define a specific exception for this purpose. Hopefully no one was relying on this at so low-level.
* dune: fix build of toplevelThomas Refis2021-02-101-2/+2
|
* Merge pull request #10165 from johnwhitington/split-exten-dot-etexFlorian Angeletti2021-02-011-1/+1
|\ | | | | Split language extensions source up with \input
| * More manual/src changesJohn Whitington2021-01-291-1/+1
| |
* | Small polishing following PR #10124 (#10175)Louis Gesbert2021-02-016-11/+19
| | | | | | | | | | | | | | | | | | - Toplevel factorisation: simplify MakePrinter functor - Re-add a discrimination string to the native toplevel header It seemed cleaner and safer to add the string to the specific module used rather than trivially rely on `Sys.backend_type`. The string is left empty for the bytecode toplevel, to avoid a visible change from the current version.
* | Make Tsubst directly retain two arguments, instead of nesting a Ttuple (#10174)Takafumi Saikawa2021-02-011-3/+1
|/
* Factorise bytecode and native toplevels (#10124)Louis Gesbert2021-01-2615-1495/+1336
| | | | Introduce modules Topeval and Topcommon to share common code between the bytecode and native toplevel.
* dune files cleanupThomas Refis2021-01-191-0/+2
|
* Rename ocamlopttoplevel.cmxa to ocamltoplevel.cmxa (#10078)Louis Gesbert2020-12-152-3/+3
| | | | | | This follows from #10061 by renaming the library to further unify the two toplevels. Some remaining references to `Opttop*` have also been cleaned up.
* Unify topXXX.mli / opttopXXX.mli (#10061)Louis Gesbert2020-12-0812-218/+81
| | | | | | | | | | | | 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 #9866 by making the regularity check stricter (#9870)Jacques Garrigue2020-11-301-1/+1
| | | This does not fix the same problem for recursive modules.
* Remove SpacetimeNicolás Ojeda Bär2020-10-081-1/+0
|
* Fix handling of Exit_compiler exception in toplevel (#9798)Nicolás Ojeda Bär2020-10-0510-25/+37
|
* Unopen Compenv in the code base (this is a nop). (#9933)Daniel Bünzli2020-09-231-3/+1
|
* toplevel: a discrepancy in extension constructors printingprogman12020-09-081-17/+20
| | | | | | | fixes #9148 genprintval.tree_of_extension was missing instantiation of constructor argument types. the Ctype.apply code is factorized out from a number of other places.
* Add `'a Either.t = Left of 'a | Right of 'b`Gabriel Scherer2020-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```ocaml val left : 'a -> ('a, 'b) t val right : 'b -> ('a, 'b) t val is_left : ('a, 'b) t -> bool val is_right : ('a, 'b) t -> bool val find_left : ('a, 'b) t -> 'a option val find_right : ('a, 'b) t -> 'b option val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c val equal : left:('a -> 'a -> bool) -> right:('b -> 'b -> bool) -> ('a, 'b) t -> ('a, 'b) t -> bool val compare : left:('a -> 'a -> int) -> right:('b -> 'b -> int) -> ('a, 'b) t -> ('a, 'b) t -> int ``` Unlike [result], no [either] type is made available in Stdlib, one needs to access [Either.t] explicitly: - This type is less common in typical OCaml codebases, which prefer domain-specific variant types whose constructors carry more meaning. - Adding this to Stdlib would raise warnings in existing codebases that already use a constructor named Left or Right: + when opening a module that exports such a name, warning 45 is raised + adding a second constructor of the same name in scope kicks in the disambiguation mechanisms, and warning 41 may now be raised by existing code. If the use becomes more common in the future we can always revisit this choice.
* Fix double free of toplevel bytecode (#9855)Stephen Dolan2020-08-251-8/+8
|