racket / racket/rhombus

Improve static error for incorrect arities of subclass constructors

Open
#459 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
601
Forks
74
Avg merge
2d 10h
Merged PRs (30d)
5

Description

Classes with private immutable fields are currently required to have custom constructors. For example,

#lang rhombus
class Secret(private _secret)

this triggers “class needs a custom constructor to initialize private immutable fields”, while

#lang rhombus
class Secret(private _secret):
  constructor (secr):
    super(secr)

this works. However, this requirement doesn’t seem to properly propagate. For example,

#lang rhombus
class Secret(private _secret):
  nonfinal
  constructor (secr):
    super(secr)

class TopSecret():
  extends Secret

this does not trigger “class needs a custom constructor to initialize private immutable fields”, but it simply cannot work.

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 two Rhombus class examples from the issue and compare the diagnostics for direct and indirect subclass construction. Trace where constructor arity and private immutable-field requirements are checked; done means the indirect subclass reports that a custom constructor is required, with regression coverage for the shown examples.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.