[bug] @as can create type problems

オープン
#7,957 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
ocaml
領域
compilers

調査の方向性

まず、issue 内の inline exception-record reproduction を実行し、@as("Error") が捕捉された値にどのような影響を与えるかを確認します。次に、inline exception records に対するコンパイラーの @as の処理を追跡します。issue では、望ましい結果が警告、禁止、または異なるランタイム動作のいずれであるかを定義していないため、実装前に期待される結果を明確にする必要があります。

索引モデルが issue の本文から書いたものです。

説明

this is a really stupid example that would likely never happen in real-life (but hey, you give a million monkeys infinite amount of time with keyboards...). if it DOES happen, it'll cost some developer x amount of hours to debug. it's kinda far out there, but not as far as @as("RE_EXN_ID)"...

right now i'm just having fun trying to break things to find bugs and i stumbled upon this.

exception Foo({@as("Error") e: string})
let s: string = try throw(Foo({e: "foo"})) catch {
| Foo({e}) => e
}
Console.log(s == "foo")
Console.log(s)

as you can imagine, this logs false and then an error object. i'm not sure what the takeaway is here.. possibly:

a) call me an idiot and close this
b) come up with some way to prohibit use of or warn on using @as("Error") for inlined exception records (yeah, kinda niche...)

主要言語
OCaml
スター
7.5k
フォーク
485
平均マージ
1日 2時間
マージ済み PR(30日)
55

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rescript-lang/rescript のほかの issue

rescript-lang/rescript の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。