ruby / ruby/typeprof

[warning] already initialized constant Foo::A

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

Nobody has claimed this yet.

Dominant language
Ruby
Stars
833
Forks
99
Avg merge
9h 30m
Merged PRs (30d)
12

Description

The warning [warning] already initialized constant Foo::A is displayed.
When a class with constants exists in an RBS file that has already been created.

Ruby TypeProf Playground
https://mame.github.io/typeprof-playground/#rb=class+Foo%0A++A+%3D+1%0Aend%0A&rbs=class+Foo%0A++A%3A+Integer%0Aend

Ruby

class Foo
  A = 1
end

RBS

class Foo
  A: Integer
end

Output

# TypeProf 0.15.0

# Errors
test.rb:2: [warning] already initialized constant Foo::A

# Classes
class Foo
  A: Integer
end


## Version info:
##   * Ruby: 3.0.0
##   * RBS: 1.3.1
##   * TypeProf: 0.15.0

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

Start by reproducing the warning in the linked Ruby TypeProf Playground using the provided Ruby and RBS snippets. Compare the TypeProf 0.15.0 output with the expected behavior for a constant declared in both sources, then identify the relevant TypeProf entry point. Done means the matching example no longer emits the spurious already-initialized-constant warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.