Some(U) of an @as(undefined) case compiles to undefined when U is a constant
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #9008 @cknitt による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- compilers
調査の方向性
Start by reading rule 12 in compiler/ml/UntaggedVariants.md and tracing the constant handling in compiler/ml/lambda.ml, especially const_some_none_depth. Reproduce the example and compare Some(U) with None for the constant and function cases. Done means both comparisons show Some(U) differs from None, with compiler tests covering the regression.
索引モデルが issue の本文から書いたものです。
説明
Some(U), where U is an @as(undefined) case of an untagged variant, compiles to undefined when U is a constant argument, so it equals None.
@unboxed type u = | @as(undefined) U | V(string)
let x: option<u> = Some(U) // compiles to: let x = undefined;
@inline(never) let mk = (v: u): option<u> => Some(v)
Console.log2(x == None, mk(U) == None)
Output: true false. Through a function, Some(U) is boxed and differs from None; as a constant, it is undefined.
Expected: Some(U) differs from None in both cases. This is the example of #6222, which made option unboxing compatible with untagged variants.
A likely place is compiler/ml/lambda.ml, const_some_none_depth, which treats every Const_constructor as not none, including one whose literal is undefined. This cause is not confirmed. The rule is compiler/ml/UntaggedVariants.md rule 12, in #8952.
- 主要言語
- OCaml
- スター
- 7.5k
- フォーク
- 483
- 平均マージ
- 19時間 35分
- マージ済み PR(30日)
- 208
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rescript-lang/rescript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
rescript-lang/rescript#9037 ·
メンテナーはふだん 1 日以内に返信
-
Per-constructor @unboxed is not compared across interfaces or coercions対応中かも @cknitt が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
rescript-lang/rescript#9038 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rescript-lang/rescript#9006 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
rescript-lang/rescript#8997 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
rescript-lang/rescript#8994 ·
メンテナーはふだん 1 日以内に返信
rescript-lang/rescript の issue をすべて見る
似ている issue
-
enhancement scope:diagnostics scope:syntax
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
-
code: refactoring good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
idris-lang/Idris2#3887 ·
メンテナーはふだん 1 日以内に返信
-
backend:X86 generated by fuzzer llvm:globalisel miscompilation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
llvm/llvm-project#235468 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:codegen backend:cuda backend:hip bug direction:input
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
CrossGL/crosstl#3061 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100