Skip to content

Commit

Permalink
Fixes #17376 - Compiler hangs when compiling inline recursive invocat…
Browse files Browse the repository at this point in the history
…ion #17376 (#17394)
  • Loading branch information
KevinRansom authored Jul 9, 2024
1 parent a11071f commit 2234432
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.100.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### Fixed
* Compiler hangs when compiling inline recursive invocation ([Issue #17376](https://github.com/dotnet/fsharp/issues/17376), [PR #17394](https://github.com/dotnet/fsharp/pull/17394))

### Added

Expand Down
5 changes: 4 additions & 1 deletion src/Compiler/Optimize/Optimizer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3137,9 +3137,12 @@ and OptimizeVal cenv env expr (v: ValRef, m) =

| None ->
if v.ShouldInline then
warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m))
match valInfoForVal.ValExprInfo with
| UnknownValue -> error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m))
| _ -> warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m))
if v.InlineIfLambda then
warning(Error(FSComp.SR.optFailedToInlineSuggestedValue(v.DisplayName), m))

expr, (AddValEqualityInfo g m v
{ Info=valInfoForVal.ValExprInfo
HasEffect=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module RecursiveSafetyAnalysis =
(Error 1114, Line 8, Col 15, Line 8, Col 25, "The value 'E_RecursiveInline.test' was marked inline but was not bound in the optimization environment")
(Error 1113, Line 7, Col 16, Line 7, Col 20, "The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible")
(Warning 1116, Line 8, Col 15, Line 8, Col 25, "A value marked as 'inline' has an unexpected value")
(Warning 1118, Line 8, Col 15, Line 8, Col 25, "Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline'")
(Error 1118, Line 8, Col 15, Line 8, Col 25, "Failed to inline the value 'test' marked 'inline', perhaps because a recursive value was marked 'inline'")
]

// SOURCE=E_TypeDeclaration01.fs SCFLAGS="--langversion:5.0 --test:ErrorRanges" COMPILE_ONLY=1 # E_TypeDeclaration01.fs
Expand Down

0 comments on commit 2234432

Please sign in to comment.