Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c445c57
Fix issues with package management subdirectories (#12381)
KevinRansom Nov 16, 2021
db2c9da
split large methods sensibly (#12397)
dsyme Nov 16, 2021
0458724
Add debug emit docs (#12411)
dsyme Nov 17, 2021
641ace3
Small typo (#12412)
jamil7 Nov 17, 2021
f0f9c17
[main] Update dependencies from dotnet/arcade (#12310)
dotnet-maestro[bot] Nov 17, 2021
9cba74d
Fix 12384: non-nested direct mutrec bindings (#12395)
dsyme Nov 19, 2021
57ef580
add fantomas tool to repo (#12403)
dsyme Nov 19, 2021
76e65ac
Add with keyword to Syntax tree (#12400)
nojaf Nov 19, 2021
8faf123
Fixes 12414: int32 --> Nullable Int64 additional implicit conversion…
dsyme Nov 20, 2021
e989f81
[main] Update dependencies from dotnet/arcade (#12426)
dotnet-maestro[bot] Nov 22, 2021
ef7944d
make diagnostic numbers unique (#12428)
dsyme Nov 22, 2021
7512e5c
Localized file check-in by OneLocBuild Task: Build definition ID 499:…
dotnet-bot Nov 22, 2021
8c300e6
Improve error message for invalid member declarations (#12342)
Nov 22, 2021
c194738
update messages (#12427)
dsyme Nov 22, 2021
5be669b
Localized file check-in by OneLocBuild Task: Build definition ID 499:…
dotnet-bot Nov 22, 2021
3d15c43
Fix 12405 (#12406)
KevinRansom Nov 22, 2021
c5da378
Fix debug tailcalls for pipelines if /tailcalls+ is explicitly specif…
dsyme Nov 22, 2021
2080a47
Localized file check-in by OneLocBuild Task: Build definition ID 499:…
dotnet-bot Nov 22, 2021
69ece79
Rename FSharpReferencedProject.ProjectFileName for clarity (#12431)
baronfel Nov 23, 2021
edd4c3b
12322: Fix deep recursive expression processing (#12420)
dsyme Nov 23, 2021
ee93e05
UnmanagedCallersOnlyAttribute is unsupported (#12350)
Happypig375 Nov 23, 2021
a847a71
Added CI job for deterministic builds (#12335)
TIHan Nov 23, 2021
cd7847d
Added service_slim
ncave Nov 15, 2021
adcea08
Async ParseAndCheckProject by Alfonso
ncave Nov 15, 2021
760f583
Added ParseAndCheckFileInProject
ncave Nov 15, 2021
2a49718
Add Compile to service_slim and pub-sub pattern
alfonsogarciacaro Dec 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix 12384: non-nested direct mutrec bindings (dotnet#12395)
* fix non-nested mutrec bindings

* fix non-nested mutrec bindings

* fix non-nested mutrec bindings

* fix non-nested mutrec bindings
  • Loading branch information
dsyme authored Nov 19, 2021
commit 9cba74db3a0f4fd6d631231506e191f113a20b8b
22 changes: 20 additions & 2 deletions src/fsharp/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7552,8 +7552,26 @@ and GenModuleDef cenv (cgbuf: CodeGenBuffer) qname lazyInitInfo eenv x =
GenExnDef cenv cgbuf.mgbuf eenvinner m tc
else
GenTypeDef cenv cgbuf.mgbuf lazyInitInfo eenvinner m tc
for mbind in mbinds do
GenModuleBinding cenv cgbuf qname lazyInitInfo eenvinner m mbind

// Generate chunks of non-nested bindings together to allow recursive fixups.
let mutable bindsRemaining = mbinds
while not bindsRemaining.IsEmpty do
match bindsRemaining with
| ModuleOrNamespaceBinding.Binding _ :: _ ->
let recBinds =
bindsRemaining
|> List.takeWhile (function ModuleOrNamespaceBinding.Binding _ -> true | _ -> false)
|> List.map (function ModuleOrNamespaceBinding.Binding recBind -> recBind | _ -> failwith "unexpected")
let otherBinds =
bindsRemaining
|> List.skipWhile (function ModuleOrNamespaceBinding.Binding _ -> true | _ -> false)
GenLetRecBindings cenv cgbuf eenv (recBinds, m)
bindsRemaining <- otherBinds
| (ModuleOrNamespaceBinding.Module _ as mbind) :: rest ->
GenModuleBinding cenv cgbuf qname lazyInitInfo eenvinner m mbind
bindsRemaining <- rest
| [] -> failwith "unreachable"

eenvinner

| TMDefLet(bind, _) ->
Expand Down
164 changes: 164 additions & 0 deletions tests/fsharp/core/letrec/test.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,170 @@ module Test3 =
test "vwekjwve95" (tag()) 2
test "vwekjwve96" (tag()) 3

module Test12384 =
type Node =
{
Next: Node
Value: int
}

let rec one =
{
Next = two
Value = 1
}

and two =
{
Next = one
Value = 2
}
printfn "%A" one
printfn "%A" two
test "cweewlwne1" one.Value 1
test "cweewlwne2" one.Next.Value 2
test "cweewlwne3" one.Next.Next.Value 1
test "cweewlwne4" two.Value 2
test "cweewlwne5" two.Next.Value 1
test "cweewlwne6" two.Next.Next.Value 2

module Test12384b =
type Node =
{
Next: Node
Value: int
}

let rec one =
{
Next = two
Value = 1
}

and two =
{
Next = one
Value = 2
}
// Also test the case where the two recursive bindings occur with a nested module after
module M =
let f x = x + 1

printfn "%A" one
printfn "%A" two
test "cweewlwne1a" one.Value 1
test "cweewlwne2a" one.Next.Value 2
test "cweewlwne3a" one.Next.Next.Value 1
test "cweewlwne4a" two.Value 2
test "cweewlwne5a" two.Next.Value 1
test "cweewlwne6a" two.Next.Next.Value 2

module rec Test12384c =
type Node =
{
Next: Node
Value: int
}

let one =
{
Next = two
Value = 1
}

let two =
{
Next = one
Value = 2
}
// Also test the case where the two recursive bindings occur with a nested module after
module M =
let f x = x + 1

printfn "%A" one
printfn "%A" two
test "cweewlwne1b" one.Value 1
test "cweewlwne2b" one.Next.Value 2
test "cweewlwne3b" one.Next.Next.Value 1
test "cweewlwne4b" two.Value 2
test "cweewlwne5b" two.Next.Value 1
test "cweewlwne6b" two.Next.Next.Value 2


//Note, this case doesn't initialize successfully because of the intervening module. Tracked by #12384

(*
module rec Test12384d =
type Node =
{
Next: Node
Value: int
}

let one =
{
Next = two
Value = 1
}

// An intervening module declaration
module M =
let x() = one

let two =
{
Next = one
Value = 2
}

printfn "%A" one
printfn "%A" two
test "cweewlwne1b" one.Value 1
test "cweewlwne2b" one.Next.Value 2
test "cweewlwne3b" one.Next.Next.Value 1
test "cweewlwne1b" (M.x()).Value 1
test "cweewlwne2b" (M.x()).Next.Value 2
test "cweewlwne3b" (M.x()).Next.Next.Value 1
test "cweewlwne4b" two.Value 2
test "cweewlwne5b" two.Next.Value 1
test "cweewlwne6b" two.Next.Next.Value 2
*)

module rec Test12384e =
type Node =
{
Next: Node
Value: int
}

let one =
{
Next = two
Value = 1
}

// An intervening type declaration
type M() =
static member X() = one

let two =
{
Next = one
Value = 2
}

printfn "%A" one
printfn "%A" two
test "cweewlwne1b" one.Value 1
test "cweewlwne2b" one.Next.Value 2
test "cweewlwne3b" one.Next.Next.Value 1
test "cweewlwne1b" (M.X()).Value 1
test "cweewlwne2b" (M.X()).Next.Value 2
test "cweewlwne3b" (M.X()).Next.Next.Value 1
test "cweewlwne4b" two.Value 2
test "cweewlwne5b" two.Next.Value 1
test "cweewlwne6b" two.Next.Next.Value 2

#if TESTS_AS_APP
let RUN() = !failures
#else
Expand Down