rescript-lang / rescript-lang/rescript-vscode

@deriving({abstract: light}) record labels marked as "never used to read a value"

Open
#533 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
ReScript
Stars
354
Forks
63
Avg merge
11h 29m
Merged PRs (30d)
1

Description

I'm using:

  • ReScript: 9.1.4
  • VSCode plugin: 1.4.2

when having this code:

@deriving({abstract: light})
type someType = {field: string}

let f = a => a->field

What happens:

I get a warning on the 2nd line, under "field: string", saying that "someType.field is a record label never used to read a value"

What should happen:

There should be no warning, why? Because I'm actually reading from that field.

Proof: If I change the name of field in the type declaration or use other name after the a-> the code does not compile, which is correct and also probes that that declaration is being used.

Contributor guide

Open the contributing guide

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 warning in the VSCode plugin with the ReScript snippet from the issue, then trace how the plugin reports unused record labels. Done means the warning is absent when field is read through a->field, while changing the label name or accessed field still produces the expected compile failure.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.