Printed @as names of fields and constructors turn non-ASCII letters into other characters
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #9143 @cknitt による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 領域
- compilers
調査の方向性
Start with Printtyp.tree_of_constructor and Res_outcome_printer, the two printer locations named in the issue, and compare their escaping with String_literal.encode_js_string, which is used for @tag names. Check how non-ASCII @as names appear in printed interfaces, errors, and hover; done means they preserve the original runtime names when read back. Linked pull request #9143 is already open.
索引モデルが issue の本文から書いたものです。
説明
When a type declaration is printed (error messages, hover, createInterface), the @as names of record fields and variant constructors are escaped the OCaml way (%S in Printtyp.tree_of_constructor, String.escaped in Res_outcome_printer). Non-ASCII bytes become decimal escapes like \195\169, which ReScript reads back as different characters.
module Make = (X: {type t}) => {
type record = {@as("prénom") name: X.t}
type variant = | @as("é") E | @as("a\"b") Q
}
module Applied = Make({
type t = string
})
createInterface prints the types of Applied through this printer:
module Applied: {
type record = {@as("pr\195\169nom") name: string}
type variant = @as("\195\169") E | @as("a\"b") Q
}
Read back, @as("pr\195\169nom") names the field prénom:
type record = {@as("pr\195\169nom") name: string}
let r = {name: "x"}
compiles to
let r = {
"prénom": "x"
};
so a generated interface gives the fields and constructors other runtime names than the implementation. Error messages and hover show the escapes too.
The @tag name of a declaration is printed with String_literal.encode_js_string since #9136, which keeps non-ASCII letters and escapes only what a string literal needs.
- 主要言語
- OCaml
- スター
- 7.5k
- フォーク
- 484
- 平均マージ
- 20時間 50分
- マージ済み PR(30日)
- 266
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rescript-lang/rescript のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
rescript-lang/rescript#9139 ·
メンテナーはふだん 1 日以内に返信
-
v0 AST round trip shortens the location of templates without interpolations対応中かも @cknitt が 1 日前に担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 52/100
rescript-lang/rescript#9164 ·
メンテナーはふだん 1 日以内に返信
-
Record spread that copies a mutable field is generalized (unsound)対応中かも @cknitt が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
rescript-lang/rescript#9156 ·
メンテナーはふだん 1 日以内に返信
-
A block in an argument runs before the arguments to its left, which can produce wrong values対応中かも @cknitt が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
rescript-lang/rescript#9154 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rescript-lang/rescript#9151 ·
メンテナーはふだん 1 日以内に返信
rescript-lang/rescript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
calcit-lang/calcit#2538 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
rocq-prover/rocq#22695 ·
メンテナーはふだん 1 日以内に返信
-
bug priority: P2
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信