Question about changed behavior of string interpolations in NativeAOT in the .NET 11 rc1 SDK
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 18/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- fsharp
- 領域
- compilers
調査の方向性
The regression is in how the F# compiler lowers interpolated strings with format specifiers, so start from the interpolated-string lowering code and compare the .NET 10 and .NET 11 rc1 output for %02d in the fsharp repo. Reproduce with the NativeAOT snippet from the issue, then check the IL or decompiled output for the PrintFormatToString call shape. Done means the interpolated string runs under NativeAOT again, or a maintainer decides the change is intended and documents it. This is a compiler regression with no clear fix direction, so it is not a good first issue.
索引モデルが issue の本文から書いたものです。
説明
Hi,
Not sure if this is a bug, or an expected change after https://github.com/dotnet/fsharp/pull/19971, but as it came across as a breaking change to me I'll ask in case.
When doing testing with https://github.com/fable-hub/Scriptorium/pull/21 I noticed that if I have the code
let now = System.DateTime.UtcNow
let startAt =
$"%02d{now.Hour}:%02d{now.Minute}:%02d{now.Second}"
and compile that with NativeAOT using the .NET 10 SDK then the resulting executable works correctly, but compiling the same code with the .NET11-RC1 SDK then it crashes at runtime with an exception similar to the one in https://github.com/fable-hub/Scriptorium/pull/21.
This doesn't seem ideal, even given the known issues with F# style format specifiers, if it worked before and doesn't now?
fwiw, looking at the binary with ILSpy, the .NET 10 build that works decompiles as
string startAt2 = (startAt2@10 = ExtraTopLevelOperators.PrintFormatToString(new PrintfFormat<string, Unit, string, string, Tuple<int, int, int>>("%02d%P():%02d%P():%02d%P()", new object[3]
{
Program.now.Hour,
Program.now.Minute,
Program.now.Second
}, null)));
and the .NET 11 build that doesn't shows as
string startAt2 = (startAt2@9 = ExtraTopLevelOperators.PrintFormatToString(new PrintfFormat<FSharpFunc<int, string>, Unit, string, string, int>("%02d")).Invoke(Program.now.Hour) + ":" + ExtraTopLevelOperators.PrintFormatToString(new PrintfFormat<FSharpFunc<int, string>, Unit, string, string, int>("%02d")).Invoke(Program.now.Minute) + ":" + ExtraTopLevelOperators.PrintFormatToString(new PrintfFormat<FSharpFunc<int, string>, Unit, string, string, int>("%02d")).Invoke(Program.now.Second));
Known workarounds
Doing $"{now.Hour:D2}:{now.Minute:D2}:{now.Second:D2}" works in the RC1 SDK, so it can at least be made to work that way.
Thanks.
- 主要言語
- F#
- スター
- 4.3k
- フォーク
- 880
- 平均マージ
- 4日 14分
- マージ済み PR(30日)
- 99
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/fsharp のほかの issue
-
Semantic classification cache for opened documents is never populated (written to the unopened-documents cache)対応中かも @xperiandri が 37 日前に担当しました。 オープンNeeds-Triage
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 3 日以内に返信
-
Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/fsharp#20265 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
Bug Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
Feature Request Needs-Triage
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
メンテナーはふだん 3 日以内に返信
-
Feature Request Needs-Triage
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 3 日以内に返信
似ている issue
-
flang:semantics
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
llvm/llvm-project#231051 ·
メンテナーはふだん 1 日以内に返信
-
bug derived types format I/O medium priority semantics
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
webgpu-tools/wesl-rs#329 ·
メンテナーはふだん 1 日以内に返信
-
compiler/runtime
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信