Skip to content

Parser: fix tree for missing item in top tuple type #15909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

auduchinok
Copy link
Member

Partially fixes #15905. Fixes incorrect tree shape produced by recovery rules that caused an exception in type checking:

--- EXCEPTION #1/5 [ArgumentException]
Message = "
  The lists had different lengths.
  list2 is 1 element shorter than list1
"
ExceptionPath = Root.InnerException.InnerException.InnerException.InnerException
ClassName = System.ArgumentException
RemoteStackTraceString = "
  at Microsoft.FSharp.Core.DetailedExceptions.invalidArgDifferentListLength[?](String arg1, String arg2, Int32 diff) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 26
     at Microsoft.FSharp.Primitives.Basics.List.zipToFreshConsTail[a,b](FSharpList`1 cons, FSharpList`1 xs1, FSharpList`1 xs2) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 914
     at Microsoft.FSharp.Primitives.Basics.List.zip[T1,T2](FSharpList`1 xs1, FSharpList`1 xs2) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 926
     at Microsoft.FSharp.Primitives.Basics.List.map2[T1,T2,TResult](FSharpFunc`2 mapping, FSharpList`1 xs1, FSharpList`1 xs2) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 288
     at FSharp.Compiler.TypedTreeOps.GetTopTauTypeInFSharpForm(TcGlobals g, FSharpList`1 curriedArgInfos, TType tau, Range m) in C:\Developer\fsharp-rebase\src\Compiler\TypedTree\TypedTreeOps.fs:line 1710
     at FSharp.Compiler.TypedTreeOps.GetValReprTypeInFSharpForm(TcGlobals g, ValReprInfo valReprInfo, TType ty, Range m) in C:\Developer\fsharp-rebase\src\Compiler\TypedTree\TypedTreeOps.fs:line 1730
     at FSharp.Compiler.TypedTreeOps.GetValReprTypeInCompiledForm(TcGlobals g, ValReprInfo valReprInfo, Int32 numEnclosingTypars, TType ty, Range m) in C:\Developer\fsharp-rebase\src\Compiler\TypedTree\TypedTreeOps.fs:line 2628
     at FSharp.Compiler.CheckExpressions.PublishArguments(TcFileState cenv, TcEnv env, Val vspec, SynValSig synValSig, Int32 numEnclosingTypars) in C:\Developer\fsharp-rebase\src\Compiler\Checking\CheckExpressions.fs:line 12113
     at FSharp.Compiler.CheckExpressions.TcAndPublishValSpec@12136.Invoke(UnscopedTyparEnv tpenv, ValSpecResult valSpecResult) in C:\Developer\fsharp-rebase\src\Compiler\Checking\CheckExpressions.fs:line 12188
     at Microsoft.FSharp.Primitives.Basics.List.mapFold[TState,T,TResult](FSharpFunc`2 f, TState acc, FSharpList`1 xs) in D:\a\_work\1\s\src\FSharp.Core\local.fs:line 393
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4516-1.Invoke(CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Checking\CheckDeclarations.fs:line 4540
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4516-15.Invoke(CancellationToken ct)
     at FSharp.Compiler.DiagnosticsLogger.DiagnosticsLoggerExtensions.ReraiseIfWatsonable(Exception exn) in C:\Developer\fsharp-rebase\src\Compiler\Facilities\DiagnosticsLogger.fs:line 425
     at FSharp.Compiler.DiagnosticsLogger.DiagnosticsLoggerExtensions.DiagnosticsLogger.ErrorRecovery(DiagnosticsLogger x, Exception exn, Range m) in C:\Developer\fsharp-rebase\src\Compiler\Facilities\DiagnosticsLogger.fs:line 476
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4516-15.Invoke(CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Checking\CheckDeclarations.fs:line 4664
     at [email protected](CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Utilities\illib.fs:line 884
     at FSharp.Compiler.CheckDeclarations.TcModuleOrNamespaceSignatureElementsNonMutRec@4751-1.Invoke(CancellationToken ct)
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4570-6.Invoke(CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Checking\CheckDeclarations.fs:line 4576
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4516-15.Invoke(CancellationToken ct)
     at FSharp.Compiler.DiagnosticsLogger.DiagnosticsLoggerExtensions.ReraiseIfWatsonable(Exception exn) in C:\Developer\fsharp-rebase\src\Compiler\Facilities\DiagnosticsLogger.fs:line 425
     at FSharp.Compiler.DiagnosticsLogger.DiagnosticsLoggerExtensions.DiagnosticsLogger.ErrorRecovery(DiagnosticsLogger x, Exception exn, Range m) in C:\Developer\fsharp-rebase\src\Compiler\Facilities\DiagnosticsLogger.fs:line 476
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4516-15.Invoke(CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Checking\CheckDeclarations.fs:line 4664
     at [email protected](CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Utilities\illib.fs:line 884
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4640-14.Invoke(CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Checking\CheckDeclarations.fs:line 4659
     at FSharp.Compiler.CheckDeclarations.TcSignatureElementNonMutRec@4516-15.Invoke(CancellationToken ct)
     at [email protected](CancellationToken ct) in C:\Developer\fsharp-rebase\src\Compiler\Driver\ParseAndCheckInputs.fs:line 1329
     at [email protected](CancellationToken ct)
"

@auduchinok auduchinok requested a review from a team as a code owner August 31, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Exception during type checking may lead to FCS host process crash
5 participants