Question about changed behavior of string interpolations in NativeAOT in the .NET 11 rc1 SDK
Maintainer thường phản hồi trong vòng 3 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- fsharp
- Lĩnh vực
- compilers
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- F#
- Star
- 4.3k
- Fork
- 880
- Merge trung bình
- 3 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 109
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/fsharp
-
Semantic classification cache for opened documents is never populated (written to the unopened-documents cache)Có thể đã có người làm @xperiandri đã nhận 39 ngày trước. Đang mởNeeds-Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Needs-Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/fsharp#20265 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Bug Needs-Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 3 ngày
-
F# tooling doesn't work in VSĐang mởArea-VS Bug Needs-Triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 5/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Feature Request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
dotnet/fsharp#20765 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của dotnet/fsharp
Issue tương tự
-
UB: (int) cast of a user double outside int range in dispatch / vm_index_is_int / flat_index_atĐang mởarea:runtime-vm
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
InauguralSystems/EigenScript#1748 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
KhronosGroup/glslang#4469 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
bradcypert/plum#319 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[llvm-cov] `export -format=lcov` writes the folded side of a branch as an untaken `BRDA` recordĐang mởtools:llvm-cov
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
llvm/llvm-project#231521 ·
Maintainer thường phản hồi trong vòng 1 ngày