Repro steps
- Create a new F# project with the following code in Program.fs:
let rec inline test m = test m in test 0
- Compile the project using
dotnet build.
In fact, any recursive inline function can be declared and then invoked somewhere.
Expected behavior
Compiler is expected to output some error because inline rec functions are not allowed and quit.
Actual behavior
Compiler outputs several errors and warnings and then hangs with continuously increasing memory consumption. Compiler output before hang (with paths stripped):
Program.fs(1,25): error FS1114: The value 'test' was marked inline but was not bound in the optimization environment [TestApp.fsproj]
Program.fs(1,16): error FS1113: The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible [TestApp.fsproj]
Program.fs(1,25): warning FS1116: A value marked as 'inline' has an unexpected value [TestApp.fsproj]
Program.fs(1,25): warning FS1118: Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline' [TestApp.fsproj]
Program.fs(1,25): error FS1114: The value 'test' was marked inline but was not bound in the optimization environment [TestApp.fsproj]
Program.fs(1,16): error FS1113: The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible [TestApp.fsproj]
Program.fs(1,25): error FS1114: The value 'test' was marked inline but was not bound in the optimization environment [TestApp.fsproj]
Program.fs(1,16): error FS1113: The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible [TestApp.fsproj]
N.B. This bug is contrived of course. I never thought of writing such code in real applications.
Repro steps
dotnet build.In fact, any recursive inline function can be declared and then invoked somewhere.
Expected behavior
Compiler is expected to output some error because inline rec functions are not allowed and quit.
Actual behavior
Compiler outputs several errors and warnings and then hangs with continuously increasing memory consumption. Compiler output before hang (with paths stripped):
N.B. This bug is contrived of course. I never thought of writing such code in real applications.