reasonml / reasonml/reason

lowercase variant constructor: Syntax error

Open
#1,975 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Error messages
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

When you start a variant constructor with a lowercase letter you get a syntax error. It would be nice to show a clear warning instead. I.e.: Error: variant constructor must always start with a capital letter.

type fruit =
  | Apple /* this works */
  | pear; /* Error: 3557: <UNKNOWN SYNTAX ERROR> */

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided fruit variant example, then locate the parser or diagnostic entry point for lowercase variant constructors. The work is done when the example produces a clear error stating that variant constructors must start with a capital letter, rather than an unknown syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.