Skip to content

ocamlprof handles refutation case incorrectly #14196

Description

@Alizter

It seems ocamlcp creates some nonsense code when encountering a refutation case. I'm experimenting with adding support for ocamlprof in dune, so ignore the dune commands they don't exist yet.

  $ cat > foo.ml <<EOF
  > type t = |
  > 
  > let unreachable_code = function
  >  | (_ : t) -> .
  > ;;
  > EOF

  $ dune exec --profile ocamlprof --always-show-command-line -- ./foo.exe
  (cd _build/default && /nix/store/sc6v3ijmixhacylaxwn00nbvsyw4qxi3-ocaml+flambda-5.3.0/bin/ocamloptp -w -40 -g -I .foo.eobjs/byte -I .foo.eobjs/native -I .bar.objs/byte -I .bar.objs/native -cmi-file .foo.eobjs/byte/dune__exe__Foo.cmi -no-alias-deps -o .foo.eobjs/native/dune__exe__Foo.cmx -c -impl foo.ml)
  File "foo.ml", line 4, characters 66-67:
  4 |  | (_ : t) -> (OCAML__prof_Profiling.incr __ocaml_prof_foo_cnt 0; .)
                                                                        ^
  Error: Syntax error: ) expected
  File "foo.ml", line 4, characters 14-15:
  4 |  | (_ : t) -> (OCAML__prof_Profiling.incr __ocaml_prof_foo_cnt 0; .)
                    ^
    This ( might be unmatched
  [1]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions