Skip to content

Bug: crash on optional argument rebound to non-variable #1260

@emillon

Description

@emillon

Hi,

The following program causes ocamlformat to crash:

let f ?a:(A) = ()

(it tries to format it as let ?a:A = ())

I had to check the exact parsing rules. What they say is that only ppat_var and ppat_any are recognized without parens.

I have to admit it's difficult to find a reasonable use case for this combination of features, but that's valid. A similar situation hapens with ?a:(()) and ?a:(0).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions