ruby / ruby/rbs

Allow adding `|` as prefix for union

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

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.2k
Forks
256
Avg merge
6d 17h
Merged PRs (30d)
37

Description

on TypeScript, this will not be error:

type voicevox_result_code =
  | "voicevox_result_succeed"
  | "voicevox_result_not_loaded_openjtalk_dict"
  | "voicevox_result_failed_load_model"
  | "voicevox_result_failed_get_supported_devices"
  | "voicevox_result_cant_gpu_support"
  | "voicevox_result_failed_load_metas"
  | "voicevox_result_uninitialized_status"
  | "voicevox_result_invalid_speaker_id"
  | "voicevox_result_invalid_model_index"
  | "voicevox_result_inference_failed"
  | "voicevox_result_failed_extract_full_context_label"
  | "voicevox_result_invalid_utf8_input"
  | "voicevox_result_failed_parse_kana"

but on rbs, it raises error:

type voicevox_result_code =
  | :voicevox_result_succeed
  | :voicevox_result_not_loaded_openjtalk_dict
  | :voicevox_result_failed_load_model
  | :voicevox_result_failed_get_supported_devices
  | :voicevox_result_cant_gpu_support
  | :voicevox_result_failed_load_metas
  | :voicevox_result_uninitialized_status
  | :voicevox_result_invalid_speaker_id
  | :voicevox_result_invalid_model_index
  | :voicevox_result_inference_failed
  | :voicevox_result_failed_extract_full_context_label
  | :voicevox_result_invalid_utf8_input
  | :voicevox_result_failed_parse_kana

It would be good if this is allowed.

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

No files or tests are named in the issue. Start by locating the RBS parser and existing union-type syntax coverage, then compare the accepted forms with the TypeScript-style examples shown here. Done means the |-prefixed symbol union is accepted without an error and regression coverage verifies it.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, typescript
Domain
devtools
Issue type
Feature
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.