小编Cra*_*aig的帖子

抑制F#编译器警告:可能的错误缩进:此标记超出了上下文

我有一些xunit测试我想布局如下可读性:

[<Fact>] let ``Has Hash Code 2``()          = target.GetHashCode().ShouldBe 2
[<Fact>] let ``ToString yields two``()      = target.ToString().ShouldBe "two"
[<Fact>] let ``Has underlysing type int``() = target.GetUnderlyingType().ShouldBe typeof<int>
Run Code Online (Sandbox Code Playgroud)

我在let语句上收到编译器警告:"可能的错误缩进:此标记在位置%s处开始上下文.尝试进一步缩进此标记或使用标准格式约定."

我试过,#nowarn "lexfltTokenIsOffsideOfContextStartedEarlier"但只是生成了另一个编译器警告"无效的警告号".

https://github.com/fsharp/fsharp/blob/057dbf77df7355321c3c18137c2d552bdfa1272b/src/fsharp/FSComp.txt中没有为此错误列出警告编号

有没有办法压制这个警告?

f# unit-testing readability xunit compiler-warnings

5
推荐指数
2
解决办法
965
查看次数

标签 统计

compiler-warnings ×1

f# ×1

readability ×1

unit-testing ×1

xunit ×1