-
Notifications
You must be signed in to change notification settings - Fork 95
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
Fix a few error reports #784
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs formatting ! (dune build @fmt
does format the dune files too)
src/xref2/lookup_failures.ml
Outdated
@@ -75,7 +75,7 @@ let report_internal fmt = report ~non_fatal:true fmt | |||
|
|||
let report_root ~name = add (`Root name) | |||
|
|||
let report_warning fmt = report ~non_fatal:false fmt | |||
let report_warning fmt = report ~non_fatal:true fmt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is whether the warning is not-affected by the "warn error" mode, it should stay false
. The correct fix for the prefixes is #785
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh? so warn-error doesn't make all warnings errors? That doesn't make sense, does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some warning are never turned into errors indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"internal" warnings (most errors from linking) are never turned into fatal errors, as well as failures to lookup root modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely in that case it's an 'info' message rather than a warning, at the very least so people know the meaning of --warn-error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's because these errors are caused by complicated things and the user can't really fix (bugs in odoc, things expected in the environment that Dune never give).
These things can be fixed but not for 2.0.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made #786 to sort this out, and added it to the 2.1 release project.
src/xref2/errors.ml
Outdated
@@ -103,7 +103,8 @@ module Tools_error = struct | |||
| simple_module_type_expr_of_module_error | |||
| simple_module_lookup_error | |||
| signature_of_module_error | |||
| parent_lookup_error ] | |||
| parent_lookup_error | |||
| reference_lookup_error ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is not necessary.
Reference errors are wrapped in "parent errors" because references are kind of an other language, errors don't mix.
Revert:
diff --git a/src/xref2/errors.ml b/src/xref2/errors.ml
index afba115b7..55469d03b 100644
--- a/src/xref2/errors.ml
+++ b/src/xref2/errors.ml
@@ -103,8 +103,7 @@ module Tools_error = struct
| simple_module_type_expr_of_module_error
| simple_module_lookup_error
| signature_of_module_error
- | parent_lookup_error
- | reference_lookup_error ]
+ | parent_lookup_error ]
let pp_reference_kind fmt k =
let k =
@@ -166,7 +165,9 @@ module Tools_error = struct
| `Parent_module e -> Format.fprintf fmt "Parent_module: %a" pp (e :> any)
| `Fragment_root -> Format.fprintf fmt "Fragment root"
| `Parent_type e -> Format.fprintf fmt "Parent_type: %a" pp (e :> any)
- | `Reference e -> pp fmt (e :> any)
+ | `Reference e -> pp_reference_lookup_error fmt e
+
+ and pp_reference_lookup_error fmt = function
| `Wrong_kind (expected, got) ->
let pp_sep fmt () = Format.fprintf fmt " or " in
Format.fprintf fmt "is of kind %a but expected %a" pp_reference_kind got
@@ -178,6 +179,7 @@ module Tools_error = struct
| #reference_kind as kind ->
Format.fprintf fmt "Couldn't find %a %S" pp_reference_kind kind name
)
+ | `Parent e -> pp fmt (e :> any)
end
(* Ugh. we need to determine whether this was down to an unexpanded module type error. This is horrendous. *)
@@ -210,9 +212,6 @@ let is_unexpanded_module_type_of =
| `OpaqueClass -> false
| `Reference (`Parent p) -> inner (p :> any)
| `Reference _ -> false
- | `Wrong_kind _ -> false
- | `Lookup_by_name _ -> false
- | `Find_by_name _ -> false
in
inner
@@ -246,7 +245,6 @@ let rec kind_of_error : Tools_error.any -> kind option = function
| `Parent (`Parent_expr e) -> kind_of_error (e :> Tools_error.any)
| `Parent (`Parent_module e) -> kind_of_error (e :> Tools_error.any)
| `Parent (`Parent _ as e) -> kind_of_error (e :> Tools_error.any)
- | `Reference e -> kind_of_error (e :> Tools_error.any)
| `OpaqueModule ->
(* Don't turn OpaqueModule warnings into errors *)
Some `OpaqueModule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why on earth are reference errors 'parent' errors? That doesn't make sense either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how the errors are constructed and destructed currently. I have a work-in-progress patch that entirely remove the "parent" thing but it's far from ready (https://github.com/Julow/odoc/tree/imp-tools-errors)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh. OK, let's leave it as-is for now and sort it out in 2.1
0a2bb1e
to
7f5845a
Compare
There's an issue somewhere meaning that sometimes shadowed items end up aren't marked as such - for example `compare` in `ocaml.git/middle_end/backend_var.mli`. Rather than turn that into a hard error just re-enable the duplication for now.
Now using OCaml 4.12.1 (with lots of new reference resolution failures to report!)
But leave it there because it indicates a problem!
7f5845a
to
9103f13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :)
And other miscellaneous fixes.