FS0193 on a call with an explicit type argument after an earlier call with the same argument types picked another overload (works in the .NET 10 SDK)
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả 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
Start with the overload resolution behavior described in the repro and run dotnet fsi repro.fsx using the provided script. The issue also points to FSharp.Compiler.ComponentTests and a failing Assert.Equal call in TransparentCompiler.fs; inspect the related component tests to locate the regression. Done means both calls compile and select the overloads described, with the component test passing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In the .NET 11 SDK (11.0.100-rc.1 and 11.0.100-rc.3) a call with an explicit type argument is rejected when an earlier call, with the same argument types but a different type argument, resolved to another overload of the same method. The .NET 10 SDK compiles the same code.
Repro steps
Save as repro.fsx and run dotnet fsi repro.fsx:
type A =
static member Eq<'T>(x: 'T, y: 'T) = "T,T"
static member Eq<'T>(x: seq<'T>, y: seq<'T>) = "seq,seq"
let first = A.Eq<int>([ 1 ], [ 1 ]) // picks the seq overload
let second = A.Eq<int list>([ 1 ], [ 1 ]) // should pick the 'T,'T overload with 'T = int list
Expected behavior
Both calls compile, and second picks Eq<'T>(x: 'T, y: 'T) with 'T = int list, as it does when it is the only call. On the .NET 10.0.402 SDK (F# 10) the script compiles and prints seq,seq and T,T.
Actual behavior
repro.fsx(6,29): error FS0193: Type constraint mismatch. The type
'int list'
is not compatible with type
'int list seq'
Without the first call the second one compiles and picks the T,T overload. It looks as if the result of resolving an overloaded call is remembered under the method and the argument types only, without the explicit type arguments.
Known workarounds
Give the two calls different argument types (for example arrays for one of them), or use the same explicit type argument in both.
Related information
- Reproduces with 11.0.100-rc.1.26420.103 and 11.0.100-rc.3.26522.148 (
dotnet fsi), Windows 11. Does not reproduce with 10.0.402. - Found in this repository's
FSharp.Compiler.ComponentTests:Assert.Equal<ReferenceOnDisk>(list, list)in one file (xUnit'sEqual<T>(IEnumerable<T>, IEnumerable<T>)) madeAssert.Equal<ProjectSnapshot.ReferenceOnDisk list>(list, list)in a later file (TransparentCompiler.fs) fail with the same error.
- Ngôn ngữ chính
- F#
- Star
- 4.3k
- Fork
- 883
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 88
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
-
Needs-Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
Maintainer thường phản hồi trong vòng 2 ngày
-
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 63 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 2 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 2 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 2 ngày
-
Needs-Triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của dotnet/fsharp
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
GaloisInc/llvm-pretty#211 ·
-
crash mlir
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
llvm/llvm-project#239604 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue self-hosted compiler
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
AeroForger/AeroFyl#1 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
KhronosGroup/SPIRV-LLVM-Translator#4151 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
anthropics/claudes-c-compiler#322 ·