Skip to content
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

-dtypedtree is not defined for class fields #6379

Closed
vicuna opened this issue Apr 23, 2014 · 2 comments
Closed

-dtypedtree is not defined for class fields #6379

vicuna opened this issue Apr 23, 2014 · 2 comments
Labels
Milestone

Comments

@vicuna
Copy link

vicuna commented Apr 23, 2014

Original bug ID: 6379
Reporter: @lpw25
Status: closed (set by @xavierleroy on 2015-12-11T18:28:03Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.01.0
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Monitored by: @gasche

Bug description

printtyped.ml has a stubbed out printer for class fields. So you get an assertion failure if you use -dtypedtree on a file with classes in it:

$ cat test.ml
class foo = object
  method m = 3
end

$ ocamlc -dtypedtree test.ml
[
  structure_item (test.ml[1,0+0]..test.ml[3,34+3])
    Pstr_class
    [
      class_declaration (test.ml[1,0+6]..test.ml[3,34+3])
        pci_virt = Concrete
        pci_params =
          <params> (test.ml[1,0+5]..test.ml[1,0+5]) ghost
            []
        pci_name = "foo"
        pci_expr =
          class_expr (test.ml[1,0+12]..test.ml[3,34+3])
            Pcl_structure
            class_structure
              pattern (_none_[1,0+-1].._none_[1,0+-1]) ghost
                Ppat_alias "selfpat-1/1013"
                pattern (_none_[1,0+-1].._none_[1,0+-1]) ghost
                  Ppat_alias "selfpat-*/1012"
                  pattern (test.ml[1,0+18]..test.ml[1,0+18]) ghost
                    Ppat_any
              [
Fatal error: exception Assert_failure("typing/printtyped.ml", 496, 26)

As a side note, -dtypedtree should probably print out Tfoo rather than Pfoo.

File attachments

@vicuna
Copy link
Author

vicuna commented Jun 9, 2014

Comment author: @lpw25

The attached patch fixes the -dtypedtree printing for classes.

@vicuna
Copy link
Author

vicuna commented Jun 10, 2014

Comment author: @alainfrisch

Thanks! Committed to 4.02, revision 14980.

@vicuna vicuna closed this as completed Dec 11, 2015
@vicuna vicuna added this to the 4.02.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
avsm pushed a commit to avsm/ocaml that referenced this issue Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant