如何解决Fantomas.FCS与FSharp.Compiler.Text的ISourceText类型兼容性问题?
类型不兼容问题:Fantomas.FCS的ISourceText冲突
我正在使用Fantomas.FCS的parseFile函数,代码如下:
open FSharp.Compiler.Text open Fantomas.FCS.Parse // ... let ast, errors = parseFile false (FSharp.Compiler.Text.SourceText.ofString "let mutable x = 3") []
但编译器抛出如下错误:
The type 'FSharp.Compiler.Text.ISourceText' is not compatible with the type 'FSharp.Compiler.Text.ISourceText (Fantomas.FCS, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null)'
我发现ISourceText类型属于FSharp.Compiler.Service NuGet包,但安装其最新版本后仍无法解决冲突。当前使用的Fantomas.FCS版本是5.0.0-beta-002,查看它的依赖配置发现,它是直接从源码获取FSharp.Compiler.Text命名空间相关文件的。我尝试用Paket仿照同样的配置下载依赖,却遇到了传递依赖问题,而且这种方法操作起来也很繁琐。
请问有没有更简便的方法解决这个类型不兼容问题?
内容的提问来源于stack exchange,提问作者cheetomasta420
相关产品推荐
相关产品推荐

