| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | | |
|
| |_|/
|/| |
| | |
| | | |
No need to shadow Topcommon.evaluation_result
|
| | |
| | |
| | | |
Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
|
|\ \ \
| |_|/
|/| | |
toplevel: show "#help;; for help" in startup message
|
| |/ |
|
|/ |
|
|
|
|
|
|
| |
* always row_repr
* remove the dummy field `row_bound`
Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Clarify the meaning of where the directory gets added (cf. Dll.add_path
which adds directories at the start of the search path)
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Co-authored-by: Takafumi Saikawa <tscompor@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
| |
|
| |
|
| |
|
|\
| |
| | |
Maintain more structural information in type-checking errors
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/
|/| |
Fix for #9295.Do not print options in usage msg
|
| | |
|
| |
| |
| |
| |
| | |
This reverts commit 4dca3c3c6b985bba7262f2c67c4f211283b96cd5, reversing
changes made to adcb23f298374e681ac791c2651a0d2ddc8dd083.
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| | |
Split language extensions source up with \input
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- 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.
|
|/ |
|
|
|
|
| |
Introduce modules Topeval and Topcommon to share common code between the bytecode and native toplevel.
|
| |
|
|
|
|
|
|
| |
This follows from #10061 by renaming the library to further unify the two
toplevels.
Some remaining references to `Opttop*` have also been cleaned up.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
| |
This does not fix the same problem for recursive modules.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
```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.
|
| |
|