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)
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- fsharp
- 领域
- compilers
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- F#
- 星标
- 4.3k
- 派生
- 883
- 平均合并
- 3 天 4 小时
- 30 天内合并 PR
- 88
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/fsharp 的其他 Issue
-
Needs-Triage
难度 1/5 1 小时以内 新手友好度 95/100
维护者通常 2 天内回复
-
Semantic classification cache for opened documents is never populated (written to the unopened-documents cache)可能已有人在做 @xperiandri 于 63 天前认领。 未关闭Needs-Triage
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 2 天内回复
-
Needs-Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
Bug Needs-Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
Needs-Triage
难度 4/5 3-5 天 新手友好度 42/100
维护者通常 2 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
GaloisInc/llvm-pretty#211 ·
-
bug good first issue self-hosted compiler
难度 2/5 1-3 小时 新手友好度 85/100
AeroForger/AeroFyl#1 ·
-
难度 2/5 1-3 小时 新手友好度 63/100
KhronosGroup/SPIRV-LLVM-Translator#4151 ·
维护者通常 2 天内回复
-
bug medium priority openmp parser
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
S3: friction & debt ws:emitter ws:wasm
难度 2/5 1-3 小时 新手友好度 78/100
MedakaLang/medaka#4913 ·
维护者通常 1 天内回复