Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007905OCamltypingpublic2019-01-29 10:232019-01-31 21:17
Reporternojebar 
Assigned Tooctachron 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.08.0+dev/beta1 
Target VersionFixed in Version 
Summary0007905: Destructive substitution regression
DescriptionThe following is accepted in 4.07, but rejected in 4.08.

module M : sig
  type t = A of t
end
type t := A.t = A of t

File "foo.mli", line 5, characters 34-35:
5 |              type t := M.t = A of t
                                      ^
Error: Unbound type constructor t
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0019568)
octachron (developer)
2019-01-29 11:05

As far as I can see, this is a local substitution, a new feature of 4.08? Your code example results in a syntax error with 4.07. Nevertheless, the error message might fall in an unfortunate local minimum: rewriting the local substitution to

type t := A.t = A of A.t

yields:

5 | type t := A.t = A of A.t
        ^^^^^^^^^^^^^^^^^^^^^^^^
Error: Only type synonyms are allowed on the right of :=
(0019569)
nojebar (developer)
2019-01-29 11:08

Indeed, you are right, I got confused -- sorry for the noise!
(0019570)
gasche (administrator)
2019-01-29 11:15

octachron, is the behavior you spotted a bug? The message you have (for the intuitively "correct" definition) looks like a parsing-error message delayed to type-checking time (I'm fine with this, but we may move it back to the parser one day if it has proper error messages), but the error of nojebar suggests that type-checking happens before the construction is rejected. Does it mean that the not-allowed rejection happens too late in the pipeline?
(0019571)
octachron (developer)
2019-01-29 11:22

It does look like the rejection happens too late.
(0019572)
trefis (manager)
2019-01-29 11:29

https://github.com/ocaml/ocaml/blob/trunk/typing/typemod.ml#L1171 [^]

Feel free to move the code checking the shape of the declarations before the actual type-checking part.
But I agree that the error should come from the parser, when we finally get errors from there.
(0019575)
octachron (developer)
2019-01-31 21:17

The error message should be improved with https://github.com/ocaml/ocaml/pull/2230 [^] . So thanks for the report nojebar!

- Issue History
Date Modified Username Field Change
2019-01-29 10:23 nojebar New Issue
2019-01-29 10:23 nojebar Summary Des => Destructive substitution regression
2019-01-29 10:24 nojebar Description Updated View Revisions
2019-01-29 11:05 octachron Note Added: 0019568
2019-01-29 11:08 nojebar Note Added: 0019569
2019-01-29 11:08 nojebar Status new => closed
2019-01-29 11:08 nojebar Assigned To => nojebar
2019-01-29 11:08 nojebar Resolution open => no change required
2019-01-29 11:15 gasche Note Added: 0019570
2019-01-29 11:22 octachron Assigned To nojebar =>
2019-01-29 11:22 octachron Note Added: 0019571
2019-01-29 11:22 octachron Status closed => feedback
2019-01-29 11:22 octachron Resolution no change required => reopened
2019-01-29 11:29 trefis Note Added: 0019572
2019-01-31 21:17 octachron Note Added: 0019575
2019-01-31 21:17 octachron Status feedback => resolved
2019-01-31 21:17 octachron Resolution reopened => fixed
2019-01-31 21:17 octachron Assigned To => octachron


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker