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
Typecore.force_delayed_checks does not run with -i option. #7620
Comments
Comment author: @garrigue This is clearly a bug. Going to fix it. |
Comment author: @garrigue Actually, this is more complicated than I thought: |
Comment author: furuse BTW, why is it handled as a type error? Is there an example to break the type safety by changing it to a warning? FYI, the example was found in a use of ppx_implicits, where, roughly speaking, pre-process a typed code, for example, from (function to (function It relies heavily on the principal type property, but it is broken here... |
Original bug ID: 7620
Reporter: furuse
Assigned to: @garrigue
Status: resolved (set by @garrigue on 2017-09-12T23:38:15Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.05.0
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: compiler driver
Bug description
The following program passes ocamlc -i, but not ocamlc:
let t =
(function
A |
B -> () : 'a) (A : [
A]);(failwith "dummy" : 'a) (* to know how 'a is unified *)
With ocamlc -i,
val t : [ `A ] -> unit
but with ocamlc
File "x.ml", line 2, characters 17-19:
Error: This pattern matches values of type [?
B ] but a pattern was expected which matches values of type [
A ]The second variant type does not allow tag(s) `B
This is because Typecore.force_delayed_checks never runs when -i option is given.
There is another issue of Typecore.force_delayed_checks: it runs only after printing the module signature in Compile.interface and Optcompile.interface.
I think they are bugs, but are they done intentionally? Even if they are intentional, Typecore.force_delayed_checks must run after printing the signatures for ocamlc -i.
The text was updated successfully, but these errors were encountered: