[WIP] Improve initialization circularity analysis
This is a first cut at improving the circularity analysis for initialization, which has had a couple of bugs known for a while now
-
This case was being reported when it is not problematic: https://github.com/dotnet/fsharp/issues/7451
-
This case was not being reported when it is problematic:
let rec f(): int = h()
and g = f()
and h() = g + 1
- This case was not being reported when it is problematic. The definition was being allowed, but producing invalid results at runtime (the field2 contained a null value). Instead the definition should not be allowed.
type RecordType = { field1 : string; field2 : RecordType option; field3 : (unit -> RecordType * string) }
type C() =
let rec recordtype1 : RecordType = { field1 = "field1"; field2 = Some(recordtype1); field3 = ( fun () -> (recordtype1, "") )}
member x.V = recordtype1
C().V
- [ ] Get it through CI and bootstrap and see what tests get affected.
- [ ] Protect using a language feature flag
@dsyme It doesn't seem too much related, but maybe you could also take a look at https://github.com/dotnet/fsharp/issues/7931 or https://github.com/dotnet/fsharp/issues/5795 while working on this PR, since they're also about issues arising when having a recursive module/namespace?
@dsyme It doesn't seem too much related, but maybe you could also take a look at https://github.com/dotnet/fsharp/issues/7931 or https://github.com/dotnet/fsharp/issues/5795 while working on this PR, since they're also about issues arising when having a recursive module/namespace?
That's a different class of bugs - not related to initialization but rather recursive type checking.
/azp run
Azure Pipelines successfully started running 2 pipeline(s).
(The CI keeps timing out on this - I think the algorithm to find circularities in the dependency graphs is not fast enough)